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.



15606
15607
15608
15609
15610
15611
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15606

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.



15604
15605
15606
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15604

def contact
  @contact
end

#locationObject (readonly)

Returns the value of attribute location.



15604
15605
15606
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15604

def location
  @location
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15617
15618
15619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15617

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

#to_hashObject



15621
15622
15623
15624
15625
15626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15621

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

#to_jsonObject



15613
15614
15615
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15613

def to_json
  JSON.dump(to_hash)
end