Class: Io::Flow::V0::Models::OrderInformationFlow

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

Instance Attribute Summary collapse

Attributes inherited from OrderInformation

#type

Instance Method Summary collapse

Methods inherited from OrderInformation

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ OrderInformationFlow

Returns a new instance of OrderInformationFlow.



48479
48480
48481
48482
48483
48484
48485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48479

def initialize(incoming={})
  super(:type => OrderInformation::Types::ORDER_INFORMATION_FLOW)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:order_number], 'OrderInformationFlow')
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @billing_address = (x = opts.delete(:billing_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PaymentAddressBilling) ? x : ::Io::Flow::V0::Models::PaymentAddressBilling.new(x)))
end

Instance Attribute Details

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



48477
48478
48479
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48477

def billing_address
  @billing_address
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



48477
48478
48479
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48477

def order_number
  @order_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



48491
48492
48493
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48491

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

#subtype_to_hashObject



48495
48496
48497
48498
48499
48500
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48495

def subtype_to_hash
  {
    :order_number => order_number,
    :billing_address => billing_address.nil? ? nil : billing_address.to_hash
  }
end

#to_jsonObject



48487
48488
48489
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48487

def to_json
  JSON.dump(to_hash)
end