Class: Io::Flow::V0::Models::ChannelTransaction
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ChannelTransaction
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#discounts ⇒ Object
readonly
Returns the value of attribute discounts.
-
#fees ⇒ Object
readonly
Returns the value of attribute fees.
-
#gross ⇒ Object
readonly
Returns the value of attribute gross.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#identifiers ⇒ Object
readonly
Returns the value of attribute identifiers.
-
#net ⇒ Object
readonly
Returns the value of attribute net.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#payment_request ⇒ Object
readonly
Returns the value of attribute payment_request.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#statement ⇒ Object
readonly
Returns the value of attribute statement.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#withholdings ⇒ Object
readonly
Returns the value of attribute withholdings.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ChannelTransaction
constructor
A new instance of ChannelTransaction.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ChannelTransaction
Returns a new instance of ChannelTransaction.
35644 35645 35646 35647 35648 35649 35650 35651 35652 35653 35654 35655 35656 35657 35658 35659 35660 35661 35662 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35644 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :currency, :source, :gross, :net, :created_at, :updated_at], 'ChannelTransaction') @statement = (x = opts.delete(:statement); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingChannelStatementReference) ? x : ::Io::Flow::V0::Models::BillingChannelStatementReference.new(x))) @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingChannelOrderSummary) ? x : ::Io::Flow::V0::Models::BillingChannelOrderSummary.new(x))) @payment_request = (x = opts.delete(:payment_request); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingChannelPaymentRequestReference) ? x : ::Io::Flow::V0::Models::BillingChannelPaymentRequestReference.new(x))) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @source = (x = opts.delete(:source); x.is_a?(::Io::Flow::V0::Models::TransactionSource) ? x : ::Io::Flow::V0::Models::TransactionSource.apply(x)) @parent = (x = opts.delete(:parent); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ParentTransactionSummary) ? x : ::Io::Flow::V0::Models::ParentTransactionSummary.new(x))) @gross = HttpClient::Preconditions.assert_class('gross', HttpClient::Helper.to_big_decimal(opts.delete(:gross)), BigDecimal) @fees = HttpClient::Preconditions.assert_class('fees', (x = opts.delete(:fees); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FeeDeduction) ? x : ::Io::Flow::V0::Models::FeeDeduction.new(x)) } @withholdings = HttpClient::Preconditions.assert_class('withholdings', (x = opts.delete(:withholdings); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::WithholdingDeduction) ? x : ::Io::Flow::V0::Models::WithholdingDeduction.new(x)) } @discounts = HttpClient::Preconditions.assert_class('discounts', (x = opts.delete(:discounts); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::BillingDiscount) ? x : ::Io::Flow::V0::Models::BillingDiscount.new(x)) } @net = HttpClient::Preconditions.assert_class('net', HttpClient::Helper.to_big_decimal(opts.delete(:net)), BigDecimal) @identifiers = HttpClient::Preconditions.assert_class('identifiers', (x = opts.delete(:identifiers); x.nil? ? {} : x), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('identifiers', d[1], String); h } @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime) @updated_at = HttpClient::Preconditions.assert_class('updated_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:updated_at)), DateTime) end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def currency @currency end |
#discounts ⇒ Object (readonly)
Returns the value of attribute discounts.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def discounts @discounts end |
#fees ⇒ Object (readonly)
Returns the value of attribute fees.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def fees @fees end |
#gross ⇒ Object (readonly)
Returns the value of attribute gross.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def gross @gross end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def id @id end |
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def identifiers @identifiers end |
#net ⇒ Object (readonly)
Returns the value of attribute net.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def net @net end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def order @order end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def parent @parent end |
#payment_request ⇒ Object (readonly)
Returns the value of attribute payment_request.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def payment_request @payment_request end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def source @source end |
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def statement @statement end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def updated_at @updated_at end |
#withholdings ⇒ Object (readonly)
Returns the value of attribute withholdings.
35642 35643 35644 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642 def withholdings @withholdings end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35668 35669 35670 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35668 def copy(incoming={}) ChannelTransaction.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35672 35673 35674 35675 35676 35677 35678 35679 35680 35681 35682 35683 35684 35685 35686 35687 35688 35689 35690 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35672 def to_hash { :statement => statement.nil? ? nil : statement.to_hash, :id => id, :order => order.nil? ? nil : order.to_hash, :payment_request => payment_request.nil? ? nil : payment_request.to_hash, :currency => currency, :source => source.value, :parent => parent.nil? ? nil : parent.to_hash, :gross => gross.to_f.to_s, :fees => fees.map { |o| o.to_hash }, :withholdings => withholdings.map { |o| o.to_hash }, :discounts => discounts.map { |o| o.to_hash }, :net => net.to_f.to_s, :identifiers => identifiers, :created_at => created_at, :updated_at => updated_at } end |
#to_json ⇒ Object
35664 35665 35666 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35664 def to_json JSON.dump(to_hash) end |