class Io::Flow::V0::Models::CheckoutTokenOrderForm

Use this form to securly pass order and optional customer information to be created or updated.

Attributes

address_book[R]
customer[R]
identifiers[R]
order_form[R]
payment_sources[R]
session_id[R]
urls[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 36206
def initialize(incoming={})
  super(:discriminator => CheckoutTokenForm::Types::CHECKOUT_TOKEN_ORDER_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:order_form, :session_id], 'CheckoutTokenOrderForm')
  @order_form = (x = opts.delete(:order_form); x.is_a?(::Io::Flow::V0::Models::OrderForm) ? x : ::Io::Flow::V0::Models::OrderForm.new(x))
  @customer = (x = opts.delete(:customer); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CustomerForm) ? x : ::Io::Flow::V0::Models::CustomerForm.new(x)))
  @address_book = (x = opts.delete(:address_book); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CustomerAddressBookForm) ? x : ::Io::Flow::V0::Models::CustomerAddressBookForm.new(x)))
  @payment_sources = (x = opts.delete(:payment_sources); x.nil? ? nil : HttpClient::Preconditions.assert_class('payment_sources', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentSourceForm) ? x : ::Io::Flow::V0::Models::PaymentSourceForm.from_json(x)) })
  @session_id = HttpClient::Preconditions.assert_class('session_id', opts.delete(:session_id), String)
  @urls = (x = opts.delete(:urls); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CheckoutUrlsForm) ? x : ::Io::Flow::V0::Models::CheckoutUrlsForm.new(x)))
  @identifiers = (x = opts.delete(:identifiers); x.nil? ? nil : HttpClient::Preconditions.assert_class('identifiers', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderSubmissionIdentifierForm) ? x : ::Io::Flow::V0::Models::OrderSubmissionIdentifierForm.new(x)) })
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 36223
def copy(incoming={})
  CheckoutTokenOrderForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 36227
def subtype_to_hash
  {
    :order_form => order_form.to_hash,
    :customer => customer.nil? ? nil : customer.to_hash,
    :address_book => address_book.nil? ? nil : address_book.to_hash,
    :payment_sources => payment_sources.nil? ? nil : payment_sources.map { |o| o.to_hash },
    :session_id => session_id,
    :urls => urls.nil? ? nil : urls.to_hash,
    :identifiers => identifiers.nil? ? nil : identifiers.map { |o| o.to_hash }
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 36219
def to_json
  JSON.dump(to_hash)
end