Class: Io::Flow::V0::Models::CheckoutTokenOrderForm

Inherits:
CheckoutTokenForm show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

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

Instance Attribute Summary collapse

Attributes inherited from CheckoutTokenForm

#discriminator

Instance Method Summary collapse

Methods inherited from CheckoutTokenForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ CheckoutTokenOrderForm

Returns a new instance of CheckoutTokenOrderForm.



26355
26356
26357
26358
26359
26360
26361
26362
26363
26364
26365
26366
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26355

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

Instance Attribute Details

#address_bookObject (readonly)

Returns the value of attribute address_book.



26353
26354
26355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26353

def address_book
  @address_book
end

#customerObject (readonly)

Returns the value of attribute customer.



26353
26354
26355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26353

def customer
  @customer
end

#identifiersObject (readonly)

Returns the value of attribute identifiers.



26353
26354
26355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26353

def identifiers
  @identifiers
end

#order_formObject (readonly)

Returns the value of attribute order_form.



26353
26354
26355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26353

def order_form
  @order_form
end

#payment_sourcesObject (readonly)

Returns the value of attribute payment_sources.



26353
26354
26355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26353

def payment_sources
  @payment_sources
end

#session_idObject (readonly)

Returns the value of attribute session_id.



26353
26354
26355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26353

def session_id
  @session_id
end

#urlsObject (readonly)

Returns the value of attribute urls.



26353
26354
26355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26353

def urls
  @urls
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26372
26373
26374
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26372

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

#subtype_to_hashObject



26376
26377
26378
26379
26380
26381
26382
26383
26384
26385
26386
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26376

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_jsonObject



26368
26369
26370
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26368

def to_json
  JSON.dump(to_hash)
end