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



21516
21517
21518
21519
21520
21521
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21516

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))
end

Instance Attribute Details

#contactObject (readonly)

Returns the value of attribute contact.



21514
21515
21516
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21514

def contact
  @contact
end

#locationObject (readonly)

Returns the value of attribute location.



21514
21515
21516
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21514

def location
  @location
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



21527
21528
21529
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21527

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

#to_hashObject



21531
21532
21533
21534
21535
21536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21531

def to_hash
  {
    :contact => contact.to_hash,
    :location => location.to_hash
  }
end

#to_jsonObject



21523
21524
21525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21523

def to_json
  JSON.dump(to_hash)
end