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.



52120
52121
52122
52123
52124
52125
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52120

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.



52118
52119
52120
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52118

def contact
  @contact
end

#locationObject (readonly)

Returns the value of attribute location.



52118
52119
52120
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52118

def location
  @location
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



52131
52132
52133
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52131

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

#to_hashObject



52135
52136
52137
52138
52139
52140
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52135

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

#to_jsonObject



52127
52128
52129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52127

def to_json
  JSON.dump(to_hash)
end