Class: MessenteApi::NumberVerificationApi

Inherits:
Object
  • Object
show all
Defined in:
lib/messente_api/api/number_verification_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ NumberVerificationApi

Returns a new instance of NumberVerificationApi.



19
20
21
# File 'lib/messente_api/api/number_verification_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/messente_api/api/number_verification_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#verify_number(username, password, to, opts = {}) ⇒ String

verify number

Parameters:

  • username (String)

    The API username

  • password (String)

    The API password

  • to (String)

    Receiver's phone number with the country code

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :template (String)

    Template of the message, including PIN code. Placeholder for PIN code is <PIN>. When not set, default template is used: &quot;Your Verification PIN code is <PIN>&quot;.

  • :pin_length (String)

    Length of the PIN code. Minumum 4 digits, maximum 16. Defaults to 4.

  • :from (String)

    Sender name. When not set, the default Sender name &quot;Verigator&quot; is used. This sender ID also needs to be added to your account beforehand.

  • :max_tries (String)

    Maximum number of times the PIN code is sent in total. Defaults to &quot;2&quot; - initial PIN code and one retry. It is discouraged to set this value to &quot;1&quot; as only the initial PIN code is sent and retry is disabled.

  • :retry_delay (String)

    For how long (in seconds) to wait for next retry, if the correct PIN code has not been entered yet? Defaults to 30 seconds.

  • :validity (String)

    For how long (in seconds) is the PIN code valid. Defaults to 5 minutes (300 seconds). Maximum 30 minutes (1800 seconds).

  • :ip (String)

    IP address of the client making verification request.

  • :browser (String)

    User Agent of the browser. For example &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36&quot;.

  • :cookie (String)

    Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed.

Returns:

  • (String)


37
38
39
40
# File 'lib/messente_api/api/number_verification_api.rb', line 37

def verify_number(username, password, to, opts = {})
  data, _status_code, _headers = verify_number_with_http_info(username, password, to, opts)
  data
end

#verify_number_with_http_info(username, password, to, opts = {}) ⇒ Array<(String, Integer, Hash)>

verify number

Parameters:

  • username (String)

    The API username

  • password (String)

    The API password

  • to (String)

    Receiver's phone number with the country code

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :template (String)

    Template of the message, including PIN code. Placeholder for PIN code is <PIN>. When not set, default template is used: &quot;Your Verification PIN code is <PIN>&quot;.

  • :pin_length (String)

    Length of the PIN code. Minumum 4 digits, maximum 16. Defaults to 4.

  • :from (String)

    Sender name. When not set, the default Sender name &quot;Verigator&quot; is used. This sender ID also needs to be added to your account beforehand.

  • :max_tries (String)

    Maximum number of times the PIN code is sent in total. Defaults to &quot;2&quot; - initial PIN code and one retry. It is discouraged to set this value to &quot;1&quot; as only the initial PIN code is sent and retry is disabled.

  • :retry_delay (String)

    For how long (in seconds) to wait for next retry, if the correct PIN code has not been entered yet? Defaults to 30 seconds.

  • :validity (String)

    For how long (in seconds) is the PIN code valid. Defaults to 5 minutes (300 seconds). Maximum 30 minutes (1800 seconds).

  • :ip (String)

    IP address of the client making verification request.

  • :browser (String)

    User Agent of the browser. For example &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36&quot;.

  • :cookie (String)

    Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed.

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/messente_api/api/number_verification_api.rb', line 57

def verify_number_with_http_info(username, password, to, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NumberVerificationApi.verify_number ...'
  end
  # verify the required parameter 'username' is set
  if @api_client.config.client_side_validation && username.nil?
    fail ArgumentError, "Missing the required parameter 'username' when calling NumberVerificationApi.verify_number"
  end
  # verify the required parameter 'password' is set
  if @api_client.config.client_side_validation && password.nil?
    fail ArgumentError, "Missing the required parameter 'password' when calling NumberVerificationApi.verify_number"
  end
  # verify the required parameter 'to' is set
  if @api_client.config.client_side_validation && to.nil?
    fail ArgumentError, "Missing the required parameter 'to' when calling NumberVerificationApi.verify_number"
  end
  # resource path
  local_var_path = '/verify/start'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'username'] = username
  query_params[:'password'] = password
  query_params[:'to'] = to
  query_params[:'template'] = opts[:'template'] if !opts[:'template'].nil?
  query_params[:'pin_length'] = opts[:'pin_length'] if !opts[:'pin_length'].nil?
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'max_tries'] = opts[:'max_tries'] if !opts[:'max_tries'].nil?
  query_params[:'retry_delay'] = opts[:'retry_delay'] if !opts[:'retry_delay'].nil?
  query_params[:'validity'] = opts[:'validity'] if !opts[:'validity'].nil?
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'browser'] = opts[:'browser'] if !opts[:'browser'].nil?
  query_params[:'cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'String'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiPassword', 'apiUsername']

  new_options = opts.merge(
    :operation => :"NumberVerificationApi.verify_number",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NumberVerificationApi#verify_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#verify_pin(username, password, verification_id, pin, opts = {}) ⇒ String

verified the PIN code entered by the user.

Parameters:

  • username (String)

    The API username

  • password (String)

    The API password

  • verification_id (String)

    Verification ID returned by the successful verification request.

  • pin (String)

    PIN code entered by the user.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :ip (String)

    IP address of the client making verification request. If the IP address is from another country, PIN is required even if the cookies match.

  • :browser (String)

    User Agent of the browser. For example &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36&quot;.

  • :cookie (String)

    Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed.

Returns:

  • (String)


135
136
137
138
# File 'lib/messente_api/api/number_verification_api.rb', line 135

def verify_pin(username, password, verification_id, pin, opts = {})
  data, _status_code, _headers = verify_pin_with_http_info(username, password, verification_id, pin, opts)
  data
end

#verify_pin_with_http_info(username, password, verification_id, pin, opts = {}) ⇒ Array<(String, Integer, Hash)>

verified the PIN code entered by the user.

Parameters:

  • username (String)

    The API username

  • password (String)

    The API password

  • verification_id (String)

    Verification ID returned by the successful verification request.

  • pin (String)

    PIN code entered by the user.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :ip (String)

    IP address of the client making verification request. If the IP address is from another country, PIN is required even if the cookies match.

  • :browser (String)

    User Agent of the browser. For example &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36&quot;.

  • :cookie (String)

    Unique cookie assigned to this session. If a user tries logging in with the same cookie present, user is automatically logged in and no PIN code verification is needed.

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/messente_api/api/number_verification_api.rb', line 150

def verify_pin_with_http_info(username, password, verification_id, pin, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NumberVerificationApi.verify_pin ...'
  end
  # verify the required parameter 'username' is set
  if @api_client.config.client_side_validation && username.nil?
    fail ArgumentError, "Missing the required parameter 'username' when calling NumberVerificationApi.verify_pin"
  end
  # verify the required parameter 'password' is set
  if @api_client.config.client_side_validation && password.nil?
    fail ArgumentError, "Missing the required parameter 'password' when calling NumberVerificationApi.verify_pin"
  end
  # verify the required parameter 'verification_id' is set
  if @api_client.config.client_side_validation && verification_id.nil?
    fail ArgumentError, "Missing the required parameter 'verification_id' when calling NumberVerificationApi.verify_pin"
  end
  # verify the required parameter 'pin' is set
  if @api_client.config.client_side_validation && pin.nil?
    fail ArgumentError, "Missing the required parameter 'pin' when calling NumberVerificationApi.verify_pin"
  end
  # resource path
  local_var_path = '/verify/pin'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'username'] = username
  query_params[:'password'] = password
  query_params[:'verification_id'] = verification_id
  query_params[:'pin'] = pin
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'browser'] = opts[:'browser'] if !opts[:'browser'].nil?
  query_params[:'cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'String'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiPassword', 'apiUsername']

  new_options = opts.merge(
    :operation => :"NumberVerificationApi.verify_pin",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NumberVerificationApi#verify_pin\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end