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.



35307
35308
35309
35310
35311
35312
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35307

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.



35305
35306
35307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35305

def order
  @order
end

#paymentObject (readonly)

Returns the value of attribute payment.



35305
35306
35307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35305

def payment
  @payment
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35318
35319
35320
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35318

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

#to_hashObject



35322
35323
35324
35325
35326
35327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35322

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

#to_jsonObject



35314
35315
35316
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35314

def to_json
  JSON.dump(to_hash)
end