class Io::Flow::V0::Models::ChannelPayout

Attributes

account[R]
amount[R]
attachments[R]
bank_account[R]
created_at[R]
id[R]
status[R]
updated_at[R]

Public Class Methods

new(incoming={}) click to toggle source
# 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

Public Instance Methods

copy(incoming={}) click to toggle source
# 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() click to toggle source
# 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 => attachments.map { |o| o.to_hash },
    :created_at => created_at,
    :updated_at => updated_at
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 35300
def to_json
  JSON.dump(to_hash)
end