Class: Lob::UsVerificationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/lob/api/us_verifications_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UsVerificationsApi

Returns a new instance of UsVerificationsApi.



19
20
21
# File 'lib/lob/api/us_verifications_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/lob/api/us_verifications_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#bulk_us_verifications_with_http_info(multiple_components_list, opts = {}) ⇒ Array<(UsVerifications, Integer, Hash)>

verifyBulk Verify a list of US or US territory addresses with a live API key.

Parameters:

Options Hash (opts):

  • :_case (String)

    Casing of the verified address. Possible values are &#x60;upper&#x60; and &#x60;proper&#x60; for uppercased (e.g. &quot;PO BOX&quot;) and proper-cased (e.g. &quot;PO Box&quot;), respectively. (default to ‘upper’)

Returns:

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

    UsVerifications data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
# File 'lib/lob/api/us_verifications_api.rb', line 39

def bulk_us_verifications_with_http_info(multiple_components_list, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsVerificationsApi.bulk_us_verifications ...'
  end
  # verify the required parameter 'multiple_components_list' is set
  if @api_client.config.client_side_validation && multiple_components_list.nil?
    fail ArgumentError, "Missing the required parameter 'multiple_components_list' when calling UsVerificationsApi.bulk_us_verifications"
  end
  allowable_values = ["upper", "proper"]
  if @api_client.config.client_side_validation && opts[:'_case'] && !allowable_values.include?(opts[:'_case'])
    fail ArgumentError, "invalid value for \"_case\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/bulk/us_verifications'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'case'] = opts[:'_case'] if !opts[:'_case'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(multiple_components_list)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"UsVerificationsApi.bulk_us_verifications",
    :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: UsVerificationsApi#bulk_us_verifications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#us_verification_with_http_info(us_verifications_writable, opts = {}) ⇒ Array<(UsVerification, Integer, Hash)>

verifySingle Verify a US or US territory address with a live API key.

Parameters:

Options Hash (opts):

  • :_case (String)

    Casing of the verified address. Possible values are &#x60;upper&#x60; and &#x60;proper&#x60; for uppercased (e.g. &quot;PO BOX&quot;) and proper-cased (e.g. &quot;PO Box&quot;), respectively. (default to ‘upper’)

Returns:

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

    UsVerification data, response status code and response headers



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/lob/api/us_verifications_api.rb', line 114

def us_verification_with_http_info(us_verifications_writable, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsVerificationsApi.us_verification ...'
  end
  # verify the required parameter 'us_verifications_writable' is set
  if @api_client.config.client_side_validation && us_verifications_writable.nil?
    fail ArgumentError, "Missing the required parameter 'us_verifications_writable' when calling UsVerificationsApi.us_verification"
  end
  allowable_values = ["upper", "proper"]
  if @api_client.config.client_side_validation && opts[:'_case'] && !allowable_values.include?(opts[:'_case'])
    fail ArgumentError, "invalid value for \"_case\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/us_verifications'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'case'] = opts[:'_case'] if !opts[:'_case'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(us_verifications_writable)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"UsVerificationsApi.us_verification",
    :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: UsVerificationsApi#us_verification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#verifyBulk(multiple_components_list, opts = {}) ⇒ UsVerifications

verifyBulk Verify a list of US or US territory addresses with a live API key.

Parameters:

Options Hash (opts):

  • :_case (String)

    Casing of the verified address. Possible values are &#x60;upper&#x60; and &#x60;proper&#x60; for uppercased (e.g. &quot;PO BOX&quot;) and proper-cased (e.g. &quot;PO Box&quot;), respectively. (default to ‘upper’)

Returns:



28
29
30
31
# File 'lib/lob/api/us_verifications_api.rb', line 28

def verifyBulk(multiple_components_list, opts = {})
  data, _status_code, _headers = bulk_us_verifications_with_http_info(multiple_components_list, opts)
  data
end

#verifySingle(us_verifications_writable, opts = {}) ⇒ UsVerification

verifySingle Verify a US or US territory address with a live API key.

Parameters:

Options Hash (opts):

  • :_case (String)

    Casing of the verified address. Possible values are &#x60;upper&#x60; and &#x60;proper&#x60; for uppercased (e.g. &quot;PO BOX&quot;) and proper-cased (e.g. &quot;PO Box&quot;), respectively. (default to ‘upper’)

Returns:



103
104
105
106
# File 'lib/lob/api/us_verifications_api.rb', line 103

def verifySingle(us_verifications_writable, opts = {})
  data, _status_code, _headers = us_verification_with_http_info(us_verifications_writable, opts)
  data
end