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.



52321
52322
52323
52324
52325
52326
52327
52328
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52321

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.



52319
52320
52321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52319

def billing_address
  @billing_address
end

#order_detailsObject (readonly)

Returns the value of attribute order_details.



52319
52320
52321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52319

def order_details
  @order_details
end

#shipping_addressObject (readonly)

Returns the value of attribute shipping_address.



52319
52320
52321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52319

def shipping_address
  @shipping_address
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



52334
52335
52336
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52334

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

#subtype_to_hashObject



52338
52339
52340
52341
52342
52343
52344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52338

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



52330
52331
52332
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52330

def to_json
  JSON.dump(to_hash)
end