class Io::Flow::V0::Models::CustomerOrder

Order details pertaining to a customer.

Attributes

destination[R]
number[R]
payments[R]
submitted_at[R]

Public Class Methods

new(incoming={}) click to toggle source
# 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

Public Instance Methods

copy(incoming={}) click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 38487
def to_json
  JSON.dump(to_hash)
end