Class: Io::Flow::V0::Models::CustomerOrder
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CustomerOrder
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Order details pertaining to a customer.
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#payments ⇒ Object
readonly
Returns the value of attribute payments.
-
#submitted_at ⇒ Object
readonly
Returns the value of attribute submitted_at.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CustomerOrder
constructor
A new instance of CustomerOrder.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CustomerOrder
Returns a new instance of CustomerOrder.
38478 38479 38480 38481 38482 38483 38484 38485 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38478 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:number, :destination], 'CustomerOrder') @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::OrderAddress) ? x : ::Io::Flow::V0::Models::OrderAddress.new(x)) @payments = (x = opts.delete(:payments); x.nil? ? nil : HttpClient::Preconditions.assert_class('payments', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderPayment) ? x : ::Io::Flow::V0::Models::OrderPayment.new(x)) }) @submitted_at = (x = opts.delete(:submitted_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('submitted_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
38476 38477 38478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38476 def destination @destination end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
38476 38477 38478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38476 def number @number end |
#payments ⇒ Object (readonly)
Returns the value of attribute payments.
38476 38477 38478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38476 def payments @payments end |
#submitted_at ⇒ Object (readonly)
Returns the value of attribute submitted_at.
38476 38477 38478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38476 def submitted_at @submitted_at end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
38491 38492 38493 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38491 def copy(incoming={}) CustomerOrder.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
38495 38496 38497 38498 38499 38500 38501 38502 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38495 def to_hash { :number => number, :destination => destination.to_hash, :payments => payments.nil? ? nil : payments.map { |o| o.to_hash }, :submitted_at => submitted_at } end |
#to_json ⇒ Object
38487 38488 38489 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38487 def to_json JSON.dump(to_hash) end |