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.



26927
26928
26929
26930
26931
26932
26933
26934
26935
26936
26937
26938
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26927

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.



26925
26926
26927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26925

def address_book
  @address_book
end

#customerObject (readonly)

Returns the value of attribute customer.



26925
26926
26927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26925

def customer
  @customer
end

#identifiersObject (readonly)

Returns the value of attribute identifiers.



26925
26926
26927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26925

def identifiers
  @identifiers
end

#order_formObject (readonly)

Returns the value of attribute order_form.



26925
26926
26927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26925

def order_form
  @order_form
end

#payment_sourcesObject (readonly)

Returns the value of attribute payment_sources.



26925
26926
26927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26925

def payment_sources
  @payment_sources
end

#session_idObject (readonly)

Returns the value of attribute session_id.



26925
26926
26927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26925

def session_id
  @session_id
end

#urlsObject (readonly)

Returns the value of attribute urls.



26925
26926
26927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26925

def urls
  @urls
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26944
26945
26946
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26944

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

#subtype_to_hashObject



26948
26949
26950
26951
26952
26953
26954
26955
26956
26957
26958
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26948

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



26940
26941
26942
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26940

def to_json
  JSON.dump(to_hash)
end