Class: OpenapiClient::AddressesApi
- Inherits:
-
Object
- Object
- OpenapiClient::AddressesApi
- Defined in:
- lib/openapi_client/api/addresses_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ AddressesApi
constructor
A new instance of AddressesApi.
-
#parse_address(parse_address_request_body, opts = {}) ⇒ ParseAddressResponseBody
Parse an address The address-recognition API makes it easy for you to extract address data from unstructured text, including the recipient name, line 1, line 2, city, postal code, and more.
-
#parse_address_with_http_info(parse_address_request_body, opts = {}) ⇒ Array<(ParseAddressResponseBody, Integer, Hash)>
Parse an address The address-recognition API makes it easy for you to extract address data from unstructured text, including the recipient name, line 1, line 2, city, postal code, and more.
-
#validate_address(address_to_validate, opts = {}) ⇒ Array<AddressValidationResult>
Validate An Address Address validation ensures accurate addresses and can lead to reduced shipping costs by preventing address correction surcharges.
-
#validate_address_with_http_info(address_to_validate, opts = {}) ⇒ Array<(Array<AddressValidationResult>, Integer, Hash)>
Validate An Address Address validation ensures accurate addresses and can lead to reduced shipping costs by preventing address correction surcharges.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ AddressesApi
Returns a new instance of AddressesApi.
19 20 21 |
# File 'lib/openapi_client/api/addresses_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/openapi_client/api/addresses_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#parse_address(parse_address_request_body, opts = {}) ⇒ ParseAddressResponseBody
Parse an address The address-recognition API makes it easy for you to extract address data from unstructured text, including the recipient name, line 1, line 2, city, postal code, and more. Data often enters your system as unstructured text (for example: emails, SMS messages, support tickets, or other documents). ShipEngine’s address-recognition API helps you extract meaningful, structured data from this unstructured text. The parsed address data is returned in the same structure that’s used for other ShipEngine APIs, such as address validation, rate quotes, and shipping labels. > Note: Address recognition is currently supported for the United States, Canada, Australia, New Zealand, the United Kingdom, and Ireland.
27 28 29 30 |
# File 'lib/openapi_client/api/addresses_api.rb', line 27 def parse_address(parse_address_request_body, opts = {}) data, _status_code, _headers = parse_address_with_http_info(parse_address_request_body, opts) data end |
#parse_address_with_http_info(parse_address_request_body, opts = {}) ⇒ Array<(ParseAddressResponseBody, Integer, Hash)>
Parse an address The address-recognition API makes it easy for you to extract address data from unstructured text, including the recipient name, line 1, line 2, city, postal code, and more. Data often enters your system as unstructured text (for example: emails, SMS messages, support tickets, or other documents). ShipEngine's address-recognition API helps you extract meaningful, structured data from this unstructured text. The parsed address data is returned in the same structure that's used for other ShipEngine APIs, such as address validation, rate quotes, and shipping labels. > Note: Address recognition is currently supported for the United States, Canada, Australia, New Zealand, the United Kingdom, and Ireland.
37 38 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 |
# File 'lib/openapi_client/api/addresses_api.rb', line 37 def parse_address_with_http_info(parse_address_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AddressesApi.parse_address ...' end # verify the required parameter 'parse_address_request_body' is set if @api_client.config.client_side_validation && parse_address_request_body.nil? fail ArgumentError, "Missing the required parameter 'parse_address_request_body' when calling AddressesApi.parse_address" end # resource path local_var_path = '/v1/addresses/recognize' # query parameters query_params = opts[:query_params] || {} # 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(parse_address_request_body) # return_type return_type = opts[:return_type] || 'ParseAddressResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :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(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AddressesApi#parse_address\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#validate_address(address_to_validate, opts = {}) ⇒ Array<AddressValidationResult>
Validate An Address Address validation ensures accurate addresses and can lead to reduced shipping costs by preventing address correction surcharges. ShipEngine cross references multiple databases to validate addresses and identify potential deliverability issues.
91 92 93 94 |
# File 'lib/openapi_client/api/addresses_api.rb', line 91 def validate_address(address_to_validate, opts = {}) data, _status_code, _headers = validate_address_with_http_info(address_to_validate, opts) data end |
#validate_address_with_http_info(address_to_validate, opts = {}) ⇒ Array<(Array<AddressValidationResult>, Integer, Hash)>
Validate An Address Address validation ensures accurate addresses and can lead to reduced shipping costs by preventing address correction surcharges. ShipEngine cross references multiple databases to validate addresses and identify potential deliverability issues.
101 102 103 104 105 106 107 108 109 110 111 112 113 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 |
# File 'lib/openapi_client/api/addresses_api.rb', line 101 def validate_address_with_http_info(address_to_validate, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AddressesApi.validate_address ...' end # verify the required parameter 'address_to_validate' is set if @api_client.config.client_side_validation && address_to_validate.nil? fail ArgumentError, "Missing the required parameter 'address_to_validate' when calling AddressesApi.validate_address" end # resource path local_var_path = '/v1/addresses/validate' # query parameters query_params = opts[:query_params] || {} # 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(address_to_validate) # return_type return_type = opts[:return_type] || 'Array<AddressValidationResult>' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AddressesApi#validate_address\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |