Class: Io::Flow::V0::Models::CustomerAddressBookContact
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CustomerAddressBookContact
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Preferences may indicate a contact is preferred for billing, invoicing, and/or shipping.
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#address_preferences ⇒ Object
readonly
Returns the value of attribute address_preferences.
-
#contact ⇒ Object
readonly
Returns the value of attribute contact.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CustomerAddressBookContact
constructor
A new instance of CustomerAddressBookContact.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CustomerAddressBookContact
Returns a new instance of CustomerAddressBookContact.
28807 28808 28809 28810 28811 28812 28813 28814 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28807 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :address, :contact, :address_preferences], 'CustomerAddressBookContact') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)) @contact = (x = opts.delete(:contact); x.is_a?(::Io::Flow::V0::Models::Contact) ? x : ::Io::Flow::V0::Models::Contact.new(x)) @address_preferences = HttpClient::Preconditions.assert_class('address_preferences', opts.delete(:address_preferences), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::CustomerAddressPreference) ? x : ::Io::Flow::V0::Models::CustomerAddressPreference.new(x)) } end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
28805 28806 28807 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28805 def address @address end |
#address_preferences ⇒ Object (readonly)
Returns the value of attribute address_preferences.
28805 28806 28807 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28805 def address_preferences @address_preferences end |
#contact ⇒ Object (readonly)
Returns the value of attribute contact.
28805 28806 28807 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28805 def contact @contact end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
28805 28806 28807 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28805 def id @id end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
28820 28821 28822 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28820 def copy(incoming={}) CustomerAddressBookContact.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
28824 28825 28826 28827 28828 28829 28830 28831 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28824 def to_hash { :id => id, :address => address.to_hash, :contact => contact.to_hash, :address_preferences => address_preferences.map { |o| o.to_hash } } end |
#to_json ⇒ Object
28816 28817 28818 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28816 def to_json JSON.dump(to_hash) end |