Skip to content

Commit

Permalink
rename number insight methods
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkahan committed Oct 21, 2024
1 parent a3ba43c commit 62ef878
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ This is the Python server SDK to help you use Vonage APIs in your Python applica

## Installation

It's recommended to create a new virtual environment to install the SDK. You can do this with

```bash
# Create the virtual environment
python3 -m venv venv

# Activate the virtual environment
. ./venv/bin/activate
```

To install the Python SDK package using pip:

```bash
Expand Down
3 changes: 3 additions & 0 deletions number_insight/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.0.3
- Rename `basic_number_insight` -> `get_basic_info`, `standard_number_insight` -> `get_standard_info`, `advanced_async_number_insight` -> `get_advanced_info_async`, `advanced_sync_number_insight` -> `get_advanced_info_sync`

# 1.0.2
- Support for Python 3.13, drop support for 3.8

Expand Down
2 changes: 1 addition & 1 deletion number_insight/src/vonage_number_insight/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.2'
__version__ = '1.0.3'
6 changes: 3 additions & 3 deletions number_insight/src/vonage_number_insight/number_insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def http_client(self) -> HttpClient:
return self._http_client

@validate_call
def basic_number_insight(self, options: BasicInsightRequest) -> BasicInsightResponse:
def get_basic_info(self, options: BasicInsightRequest) -> BasicInsightResponse:
"""Get basic number insight information about a phone number.
Args:
Expand Down Expand Up @@ -83,7 +83,7 @@ def standard_number_insight(
return StandardInsightResponse(**response)

@validate_call
def advanced_async_number_insight(
def get_advanced_info_async(
self, options: AdvancedAsyncInsightRequest
) -> AdvancedAsyncInsightResponse:
"""Get advanced number insight information about a phone number asynchronously.
Expand All @@ -108,7 +108,7 @@ def advanced_async_number_insight(
return AdvancedAsyncInsightResponse(**response)

@validate_call
def advanced_sync_number_insight(
def get_advanced_info_sync(
self, options: AdvancedSyncInsightRequest
) -> AdvancedSyncInsightResponse:
"""Get advanced number insight information about a phone number synchronously.
Expand Down
12 changes: 6 additions & 6 deletions number_insight/tests/test_number_insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_basic_insight():
'basic_insight.json',
)
options = BasicInsightRequest(number='12345678900', country_code='US')
response = number_insight.basic_number_insight(options)
response = number_insight.get_basic_info(options)
assert response.status == 0
assert response.status_message == 'Success'

Expand All @@ -50,7 +50,7 @@ def test_basic_insight_error():

with raises(NumberInsightError) as e:
options = BasicInsightRequest(number='1234567890', country_code='US')
number_insight.basic_number_insight(options)
number_insight.get_basic_info(options)
assert e.match('Invalid request :: Not valid number format detected')


Expand Down Expand Up @@ -85,7 +85,7 @@ def test_advanced_async_insight():
country_code='GB',
cnam=True,
)
response = number_insight.advanced_async_number_insight(options)
response = number_insight.get_advanced_info_async(options)
assert response.status == 0
assert response.request_id == '434205b5-90ec-4ee2-a337-7b40d9683420'
assert response.number == '447700900000'
Expand All @@ -108,7 +108,7 @@ def test_advanced_async_insight_error():
cnam=True,
)
with raises(NumberInsightError) as e:
number_insight.advanced_async_number_insight(options)
number_insight.get_advanced_info_async(options)
assert e.match('Invalid credentials')


Expand All @@ -127,7 +127,7 @@ def test_advanced_async_insight_partial_error(caplog):
country_code='GB',
cnam=True,
)
response = number_insight.advanced_async_number_insight(options)
response = number_insight.get_advanced_info_async(options)
assert 'Not all parameters are available' in caplog.text
assert response.status == 43

Expand All @@ -143,7 +143,7 @@ def test_advanced_sync_insight(caplog):
options = AdvancedSyncInsightRequest(
number='12345678900', country_code='US', cnam=True
)
response = number_insight.advanced_sync_number_insight(options)
response = number_insight.get_advanced_info_sync(options)

assert 'Not all parameters are available' in caplog.text
assert response.status == 44
Expand Down
2 changes: 1 addition & 1 deletion vonage/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"vonage-network-auth>=1.0.0",
"vonage-network-sim-swap>=1.0.0",
"vonage-network-number-verification>=1.0.0",
"vonage-number-insight>=1.0.2",
"vonage-number-insight>=1.0.3",
"vonage-numbers>=1.0.2",
"vonage-sms>=1.1.3",
"vonage-subaccounts>=1.0.3",
Expand Down

0 comments on commit 62ef878

Please sign in to comment.