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.



46348
46349
46350
46351
46352
46353
46354
46355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46348

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.



46346
46347
46348
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46346

def billing_address
  @billing_address
end

#order_detailsObject (readonly)

Returns the value of attribute order_details.



46346
46347
46348
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46346

def order_details
  @order_details
end

#shipping_addressObject (readonly)

Returns the value of attribute shipping_address.



46346
46347
46348
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46346

def shipping_address
  @shipping_address
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46361
46362
46363
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46361

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

#subtype_to_hashObject



46365
46366
46367
46368
46369
46370
46371
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46365

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



46357
46358
46359
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46357

def to_json
  JSON.dump(to_hash)
end