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.
33551 33552 33553 33554 33555 33556 33557 33558 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33551 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.
33549 33550 33551 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33549 def destination @destination end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
33549 33550 33551 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33549 def number @number end |
#payments ⇒ Object (readonly)
Returns the value of attribute payments.
33549 33550 33551 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33549 def payments @payments end |
#submitted_at ⇒ Object (readonly)
Returns the value of attribute submitted_at.
33549 33550 33551 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33549 def submitted_at @submitted_at end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
33564 33565 33566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33564 def copy(incoming={}) CustomerOrder.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
33568 33569 33570 33571 33572 33573 33574 33575 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33568 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
33560 33561 33562 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33560 def to_json JSON.dump(to_hash) end |