Class: Io::Flow::V0::Models::OrderPayment
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderPayment
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
An Order Payment represents an individual payment applied to an order. The type of the payment can be used to further lookup transaction level detail
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#merchant_of_record ⇒ Object
readonly
Returns the value of attribute merchant_of_record.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OrderPayment
constructor
A new instance of OrderPayment.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderPayment
Returns a new instance of OrderPayment.
28716 28717 28718 28719 28720 28721 28722 28723 28724 28725 28726 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28716 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :type, :reference, :description, :total], 'OrderPayment') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::OrderPaymentType) ? x : ::Io::Flow::V0::Models::OrderPaymentType.apply(x)) @merchant_of_record = (x = (x = opts.delete(:merchant_of_record); x.nil? ? "flow" : x); x.is_a?(::Io::Flow::V0::Models::MerchantOfRecord) ? x : ::Io::Flow::V0::Models::MerchantOfRecord.apply(x)) @reference = HttpClient::Preconditions.assert_class('reference', opts.delete(:reference), String) @description = HttpClient::Preconditions.assert_class('description', opts.delete(:description), String) @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)) @address = (x = opts.delete(:address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
28714 28715 28716 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28714 def address @address end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
28714 28715 28716 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28714 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
28714 28715 28716 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28714 def id @id end |
#merchant_of_record ⇒ Object (readonly)
Returns the value of attribute merchant_of_record.
28714 28715 28716 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28714 def merchant_of_record @merchant_of_record end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
28714 28715 28716 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28714 def reference @reference end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
28714 28715 28716 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28714 def total @total end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
28714 28715 28716 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28714 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
28732 28733 28734 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28732 def copy(incoming={}) OrderPayment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
28736 28737 28738 28739 28740 28741 28742 28743 28744 28745 28746 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28736 def to_hash { :id => id, :type => type.value, :merchant_of_record => merchant_of_record.value, :reference => reference, :description => description, :total => total.to_hash, :address => address.nil? ? nil : address.to_hash } end |
#to_json ⇒ Object
28728 28729 28730 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28728 def to_json JSON.dump(to_hash) end |