Class: Io::Flow::V0::Models::ShippingAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ShippingAddress

Returns a new instance of ShippingAddress.



44188
44189
44190
44191
44192
44193
44194
44195
44196
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44188

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_keyObject (readonly)

Returns the value of attribute center_key.



44186
44187
44188
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44186

def center_key
  @center_key
end

#center_referenceObject (readonly)

Returns the value of attribute center_reference.



44186
44187
44188
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44186

def center_reference
  @center_reference
end

#contactObject (readonly)

Returns the value of attribute contact.



44186
44187
44188
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44186

def contact
  @contact
end

#locationObject (readonly)

Returns the value of attribute location.



44186
44187
44188
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44186

def location
  @location
end

#serviceObject (readonly)

Returns the value of attribute service.



44186
44187
44188
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44186

def service
  @service
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44202
44203
44204
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44202

def copy(incoming={})
  ShippingAddress.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



44206
44207
44208
44209
44210
44211
44212
44213
44214
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44206

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_jsonObject



44198
44199
44200
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44198

def to_json
  JSON.dump(to_hash)
end