Class: Io::Flow::V0::Models::AddressVerification
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AddressVerification
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Address verification returns information on whether or not an address is valid and deliverable - meaning carriers will accept this address. Also returns suggestions for address correction, including data to highlight specific fields to correct.
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#suggestions ⇒ Object
readonly
Returns the value of attribute suggestions.
-
#valid ⇒ Object
readonly
Returns the value of attribute valid.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AddressVerification
constructor
A new instance of AddressVerification.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AddressVerification
Returns a new instance of AddressVerification.
27626 27627 27628 27629 27630 27631 27632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27626 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:address, :valid], 'AddressVerification') @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)) @valid = HttpClient::Preconditions.assert_boolean('valid', opts.delete(:valid)) @suggestions = HttpClient::Preconditions.assert_class('suggestions', (x = opts.delete(:suggestions); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AddressSuggestion) ? x : ::Io::Flow::V0::Models::AddressSuggestion.new(x)) } end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
27624 27625 27626 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27624 def address @address end |
#suggestions ⇒ Object (readonly)
Returns the value of attribute suggestions.
27624 27625 27626 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27624 def suggestions @suggestions end |
#valid ⇒ Object (readonly)
Returns the value of attribute valid.
27624 27625 27626 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27624 def valid @valid end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
27638 27639 27640 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27638 def copy(incoming={}) AddressVerification.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
27642 27643 27644 27645 27646 27647 27648 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27642 def to_hash { :address => address.to_hash, :valid => valid, :suggestions => suggestions.map { |o| o.to_hash } } end |
#to_json ⇒ Object
27634 27635 27636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27634 def to_json JSON.dump(to_hash) end |