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.



29137
29138
29139
29140
29141
29142
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29137

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.



29135
29136
29137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29135

def order
  @order
end

#paymentObject (readonly)

Returns the value of attribute payment.



29135
29136
29137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29135

def payment
  @payment
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29148
29149
29150
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29148

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

#to_hashObject



29152
29153
29154
29155
29156
29157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29152

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

#to_jsonObject



29144
29145
29146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29144

def to_json
  JSON.dump(to_hash)
end