Class: Io::Flow::V0::Models::ChannelPayout
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ChannelPayout
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
-
#bank_account ⇒ Object
readonly
Returns the value of attribute bank_account.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ChannelPayout
constructor
A new instance of ChannelPayout.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ChannelPayout
Returns a new instance of ChannelPayout.
35287 35288 35289 35290 35291 35292 35293 35294 35295 35296 35297 35298 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35287 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :account, :status, :amount, :attachments, :created_at, :updated_at], 'ChannelPayout') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @account = (x = opts.delete(:account); x.is_a?(::Io::Flow::V0::Models::AccountReference) ? x : ::Io::Flow::V0::Models::AccountReference.new(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::PayoutStatus) ? x : ::Io::Flow::V0::Models::PayoutStatus.from_json(x)) @bank_account = (x = opts.delete(:bank_account); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BankAccountSummary) ? x : ::Io::Flow::V0::Models::BankAccountSummary.new(x))) @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @attachments = HttpClient::Preconditions.assert_class('attachments', opts.delete(:attachments), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PayoutAttachment) ? x : ::Io::Flow::V0::Models::PayoutAttachment.new(x)) } @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
#account ⇒ Object (readonly)
Returns the value of attribute account.
35285 35286 35287 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35285 def account @account end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
35285 35286 35287 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35285 def amount @amount end |
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
35285 35286 35287 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35285 def @attachments end |
#bank_account ⇒ Object (readonly)
Returns the value of attribute bank_account.
35285 35286 35287 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35285 def bank_account @bank_account end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
35285 35286 35287 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35285 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
35285 35286 35287 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35285 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
35285 35286 35287 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35285 def status @status end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
35285 35286 35287 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35285 def updated_at @updated_at end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35304 35305 35306 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35304 def copy(incoming={}) ChannelPayout.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35308 35309 35310 35311 35312 35313 35314 35315 35316 35317 35318 35319 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35308 def to_hash { :id => id, :account => account.to_hash, :status => status.to_hash, :bank_account => bank_account.nil? ? nil : bank_account.to_hash, :amount => amount.to_f.to_s, :attachments => .map { |o| o.to_hash }, :created_at => created_at, :updated_at => updated_at } end |
#to_json ⇒ Object
35300 35301 35302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35300 def to_json JSON.dump(to_hash) end |