Class: Io::Flow::V0::Models::CustomerLastUsed

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

Overview

Last used details pertaining to a customer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ CustomerLastUsed

Returns a new instance of CustomerLastUsed.



38449
38450
38451
38452
38453
38454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38449

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:order, :payment], 'CustomerLastUsed')
  @order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::CustomerOrder) ? x : ::Io::Flow::V0::Models::CustomerOrder.new(x))
  @payment = (x = opts.delete(:payment); x.is_a?(::Io::Flow::V0::Models::CustomerPayment) ? x : ::Io::Flow::V0::Models::CustomerPayment.new(x))
end

Instance Attribute Details

#orderObject (readonly)

Returns the value of attribute order.



38447
38448
38449
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38447

def order
  @order
end

#paymentObject (readonly)

Returns the value of attribute payment.



38447
38448
38449
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38447

def payment
  @payment
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



38460
38461
38462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38460

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

#to_hashObject



38464
38465
38466
38467
38468
38469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38464

def to_hash
  {
    :order => order.to_hash,
    :payment => payment.to_hash
  }
end

#to_jsonObject



38456
38457
38458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38456

def to_json
  JSON.dump(to_hash)
end