Class: Io::Flow::V0::Models::AddressSuggestion
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AddressSuggestion
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A suggested address (usually providing more accurate information). This object contains both the suggested address as well as metadata on which fields are actually different
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#postal ⇒ Object
readonly
Returns the value of attribute postal.
-
#province ⇒ Object
readonly
Returns the value of attribute province.
-
#streets ⇒ Object
readonly
Returns the value of attribute streets.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AddressSuggestion
constructor
A new instance of AddressSuggestion.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AddressSuggestion
Returns a new instance of AddressSuggestion.
29758 29759 29760 29761 29762 29763 29764 29765 29766 29767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29758 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:address, :streets, :city, :province, :postal, :country], 'AddressSuggestion') @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)) @streets = HttpClient::Preconditions.assert_boolean('streets', opts.delete(:streets)) @city = HttpClient::Preconditions.assert_boolean('city', opts.delete(:city)) @province = HttpClient::Preconditions.assert_boolean('province', opts.delete(:province)) @postal = HttpClient::Preconditions.assert_boolean('postal', opts.delete(:postal)) @country = HttpClient::Preconditions.assert_boolean('country', opts.delete(:country)) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
29756 29757 29758 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29756 def address @address end |
#city ⇒ Object (readonly)
Returns the value of attribute city.
29756 29757 29758 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29756 def city @city end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
29756 29757 29758 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29756 def country @country end |
#postal ⇒ Object (readonly)
Returns the value of attribute postal.
29756 29757 29758 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29756 def postal @postal end |
#province ⇒ Object (readonly)
Returns the value of attribute province.
29756 29757 29758 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29756 def province @province end |
#streets ⇒ Object (readonly)
Returns the value of attribute streets.
29756 29757 29758 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29756 def streets @streets end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
29773 29774 29775 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29773 def copy(incoming={}) AddressSuggestion.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
29777 29778 29779 29780 29781 29782 29783 29784 29785 29786 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29777 def to_hash { :address => address.to_hash, :streets => streets, :city => city, :province => province, :postal => postal, :country => country } end |
#to_json ⇒ Object
29769 29770 29771 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29769 def to_json JSON.dump(to_hash) end |