Class: Io::Flow::V0::Models::PaymentAddressShipping

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 = {}) ⇒ PaymentAddressShipping

Returns a new instance of PaymentAddressShipping.



50018
50019
50020
50021
50022
50023
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50018

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:contact, :location], 'PaymentAddressShipping')
  @contact = (x = opts.delete(:contact); x.is_a?(::Io::Flow::V0::Models::PaymentContactShipping) ? x : ::Io::Flow::V0::Models::PaymentContactShipping.new(x))
  @location = (x = opts.delete(:location); x.is_a?(::Io::Flow::V0::Models::PaymentAddress) ? x : ::Io::Flow::V0::Models::PaymentAddress.new(x))
end

Instance Attribute Details

#contactObject (readonly)

Returns the value of attribute contact.



50016
50017
50018
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50016

def contact
  @contact
end

#locationObject (readonly)

Returns the value of attribute location.



50016
50017
50018
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50016

def location
  @location
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



50029
50030
50031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50029

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

#to_hashObject



50033
50034
50035
50036
50037
50038
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50033

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

#to_jsonObject



50025
50026
50027
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50025

def to_json
  JSON.dump(to_hash)
end