Class: Io::Flow::V0::Models::ShippingAddress
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShippingAddress
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#center_key ⇒ Object
readonly
Returns the value of attribute center_key.
-
#center_reference ⇒ Object
readonly
Returns the value of attribute center_reference.
-
#contact ⇒ Object
readonly
Returns the value of attribute contact.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShippingAddress
constructor
A new instance of ShippingAddress.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingAddress
Returns a new instance of ShippingAddress.
50136 50137 50138 50139 50140 50141 50142 50143 50144 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50136 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:contact, :location], 'ShippingAddress') @contact = (x = opts.delete(:contact); x.is_a?(::Io::Flow::V0::Models::Contact) ? x : ::Io::Flow::V0::Models::Contact.new(x)) @location = (x = opts.delete(:location); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)) @center_key = (x = opts.delete(:center_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('center_key', x, String)) @center_reference = (x = opts.delete(:center_reference); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CenterReference) ? x : ::Io::Flow::V0::Models::CenterReference.new(x))) @service = (x = opts.delete(:service); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ServiceSummary) ? x : ::Io::Flow::V0::Models::ServiceSummary.new(x))) end |
Instance Attribute Details
#center_key ⇒ Object (readonly)
Returns the value of attribute center_key.
50134 50135 50136 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50134 def center_key @center_key end |
#center_reference ⇒ Object (readonly)
Returns the value of attribute center_reference.
50134 50135 50136 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50134 def center_reference @center_reference end |
#contact ⇒ Object (readonly)
Returns the value of attribute contact.
50134 50135 50136 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50134 def contact @contact end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
50134 50135 50136 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50134 def location @location end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
50134 50135 50136 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50134 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
50150 50151 50152 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50150 def copy(incoming={}) ShippingAddress.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
50154 50155 50156 50157 50158 50159 50160 50161 50162 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50154 def to_hash { :contact => contact.to_hash, :location => location.to_hash, :center_key => center_key, :center_reference => center_reference.nil? ? nil : center_reference.to_hash, :service => service.nil? ? nil : service.to_hash } end |
#to_json ⇒ Object
50146 50147 50148 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50146 def to_json JSON.dump(to_hash) end |