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.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#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.
36356 36357 36358 36359 36360 36361 36362 36363 36364 36365 36366 36367 36368 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36356 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::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.new(x))) @date = (x = opts.delete(:date); x.nil? ? nil : HttpClient::Preconditions.assert_class('date', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @attributes = HttpClient::Preconditions.assert_class('attributes', (x = opts.delete(:attributes); x.nil? ? {} : x), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
36354 36355 36356 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36354 def address @address end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
36354 36355 36356 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36354 def attributes @attributes end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
36354 36355 36356 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36354 def date @date end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
36354 36355 36356 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36354 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
36354 36355 36356 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36354 def id @id end |
#merchant_of_record ⇒ Object (readonly)
Returns the value of attribute merchant_of_record.
36354 36355 36356 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36354 def merchant_of_record @merchant_of_record end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
36354 36355 36356 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36354 def reference @reference end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
36354 36355 36356 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36354 def total @total end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
36354 36355 36356 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36354 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
36374 36375 36376 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36374 def copy(incoming={}) OrderPayment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
36378 36379 36380 36381 36382 36383 36384 36385 36386 36387 36388 36389 36390 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36378 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, :date => date, :attributes => attributes } end |
#to_json ⇒ Object
36370 36371 36372 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36370 def to_json JSON.dump(to_hash) end |