Class: Io::Flow::V0::Models::OrderInformationDetails

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 = {}) ⇒ OrderInformationDetails

Returns a new instance of OrderInformationDetails.



48448
48449
48450
48451
48452
48453
48454
48455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48448

def initialize(incoming={})
  super(:type => OrderInformation::Types::ORDER_INFORMATION_DETAILS)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:order_details], 'OrderInformationDetails')
  @order_details = (x = opts.delete(:order_details); x.is_a?(::Io::Flow::V0::Models::OrderDetails) ? x : ::Io::Flow::V0::Models::OrderDetails.new(x))
  @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)))
  @shipping_address = (x = opts.delete(:shipping_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PaymentAddressShipping) ? x : ::Io::Flow::V0::Models::PaymentAddressShipping.new(x)))
end

Instance Attribute Details

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



48446
48447
48448
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48446

def billing_address
  @billing_address
end

#order_detailsObject (readonly)

Returns the value of attribute order_details.



48446
48447
48448
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48446

def order_details
  @order_details
end

#shipping_addressObject (readonly)

Returns the value of attribute shipping_address.



48446
48447
48448
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48446

def shipping_address
  @shipping_address
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



48461
48462
48463
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48461

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

#subtype_to_hashObject



48465
48466
48467
48468
48469
48470
48471
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48465

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

#to_jsonObject



48457
48458
48459
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48457

def to_json
  JSON.dump(to_hash)
end