Skip to content

Commit 949c406

Browse files
committed
Updating Network SIM Swap and Number Verification code comments
1 parent f9bb0b3 commit 949c406

File tree

2 files changed

+49
-17
lines changed

2 files changed

+49
-17
lines changed

Diff for: lib/vonage/network_number_verification.rb

+33-8
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,29 @@ class NetworkNumberVerification < Namespace
1313

1414
self.request_body = JSON
1515

16-
# Make fraud check requests with a phone number by looking up fraud score and/or by checking sim swap status.
16+
# Verifies if the specified phone number (plain text or hashed format) matches the one that the user is currently using.
1717
#
1818
# @example
19-
# response = client.number_insight_2.fraud_check(type: 'phone', phone: '447900000000', insights: ['fraud_score'])
19+
# response = client.network_number_verification.verify(
20+
# phone_number: '+447900000000',
21+
# auth_data: {
22+
# oidc_auth_code: '0dadaeb4-7c79-4d39-b4b0-5a6cc08bf537',
23+
# redirect_uri: 'https://example.com/callback'
24+
# }
25+
# )
2026
#
21-
# @param [required, String] :type The type of number to check.
22-
# Accepted value is “phone” when a phone number is provided.
27+
# @param [required, String] :phone_number The phone number to check, in the E.164 format, prepended with a `+`.
2328
#
24-
# @param [required, String] :phone A single phone number that you need insight about in the E.164 format.
29+
# @param [required, Hash] :auth_data A hash of authentication data required for the client token request. Must contain the following keys:
30+
# @option auth_data [required, String] :oidc_auth_code The OIDC auth code.
31+
# @option auth_data [required, String] :redirect_uri The redirect URI.
32+
# @see https://developer.vonage.com/en/getting-started-network/authentication#client-authentication-flow
2533
#
26-
# @param [required, Array] :insights An array of strings indicating the fraud check insights required for the number.
27-
# Must be least one of: `fraud_score`, `sim_swap`
34+
# @param [required, Boolean] :hashed Whether the value of `phone_number` is hashed (true) or not hashed (false, the default).
2835
#
2936
# @return [Response]
3037
#
31-
# @see https://developer.vonage.com/en/api/number-insight.v2#fraud_check
38+
# @see https://developer.vonage.com/en/api/camara/number-verification#verifyNumberVerification
3239
#
3340
sig { params(phone_number: String, auth_data: Hash, hashed: T::Boolean).returns(Vonage::Response) }
3441
def verify(phone_number:, auth_data:, hashed: false)
@@ -54,6 +61,24 @@ def verify(phone_number:, auth_data:, hashed: false)
5461
)
5562
end
5663

64+
# Creates a URL for a client-side OIDC request.
65+
#
66+
# @example
67+
# response = client.network_number_verification.generate_oidc_uri(
68+
# phone_number: '+447900000000',
69+
# redirect_uri: 'https://example.com/callback'
70+
# )
71+
#
72+
# @param [required, String] :phone_number The phone number that will be checked during the verification request.
73+
#
74+
# @param [required, String] :redirect_uri The URI that will receive the callback containing the OIDC auth code.
75+
#
76+
# @param [optional, String] :state A string that you can use for tracking.
77+
# This field is optional, but it is recommended to set a unique identifier for each access token you generate.
78+
#
79+
# @return [String]
80+
#
81+
# @see https://developer.vonage.com/en/getting-started-network/authentication#1-make-an-oidc-request
5782
sig { params(phone_number: String, redirect_uri: String, state: T.nilable(String)).returns(String) }
5883
def generate_oidc_uri(phone_number:, redirect_uri:, state: nil)
5984
params = {

Diff for: lib/vonage/network_sim_swap.rb

+16-9
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,18 @@ class NetworkSIMSwap < Namespace
1313

1414
self.request_body = JSON
1515

16-
# Make fraud check requests with a phone number by looking up fraud score and/or by checking sim swap status.
16+
# Check if SIM swap has been performed during a past period.
1717
#
1818
# @example
19-
# response = client.number_insight_2.fraud_check(type: 'phone', phone: '447900000000', insights: ['fraud_score'])
19+
# response = client.network_sim_swap.check(phone_number: '+447900000000')
2020
#
21-
# @param [required, String] :type The type of number to check.
22-
# Accepted value is “phone” when a phone number is provided.
21+
# @param [required, String] :phone_number The phone number to check, in the E.164 format, prepended with a `+`.
2322
#
24-
# @param [required, String] :phone A single phone number that you need insight about in the E.164 format.
25-
#
26-
# @param [required, Array] :insights An array of strings indicating the fraud check insights required for the number.
27-
# Must be least one of: `fraud_score`, `sim_swap`
23+
# @param [optional, Integer] :max_age Period in hours to be checked for SIM swap
2824
#
2925
# @return [Response]
3026
#
31-
# @see https://developer.vonage.com/en/api/number-insight.v2#fraud_check
27+
# @see https://developer.vonage.com/en/api/camara/sim-swap#checkSimSwap
3228
#
3329
sig { params(phone_number: String, max_age: T.nilable(Integer)).returns(Vonage::Response) }
3430
def check(phone_number:, max_age: nil)
@@ -54,6 +50,17 @@ def check(phone_number:, max_age: nil)
5450
)
5551
end
5652

53+
# Get timestamp of last MSISDN <-> IMSI pairing change for a mobile user account provided with MSIDN.
54+
#
55+
# @example
56+
# response = client.network_sim_swap.retrieve_date(phone_number: '+447900000000')
57+
#
58+
# @param [required, String] :phone_number The phone number to check, in the E.164 format, prepended with a `+`.
59+
#
60+
# @return [Response]
61+
#
62+
# @see https://developer.vonage.com/en/api/camara/sim-swap#retrieveSimSwapDate
63+
#
5764
sig { params(phone_number: String).returns(Vonage::Response) }
5865
def retrieve_date(phone_number:)
5966
raise ArgumentError.new("`phone_number` must be in E.164 format") unless Phonelib.parse(phone_number).valid?

0 commit comments

Comments
 (0)