Class: Io::Flow::V0::Models::OrganizationPayout

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrganizationPayout

Returns a new instance of OrganizationPayout.



55146
55147
55148
55149
55150
55151
55152
55153
55154
55155
55156
55157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55146

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :account, :status, :amount, :attachments, :created_at, :updated_at], 'OrganizationPayout')
  @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

#accountObject (readonly)

Returns the value of attribute account.



55144
55145
55146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55144

def 
  @account
end

#amountObject (readonly)

Returns the value of attribute amount.



55144
55145
55146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55144

def amount
  @amount
end

#attachmentsObject (readonly)

Returns the value of attribute attachments.



55144
55145
55146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55144

def attachments
  @attachments
end

#bank_accountObject (readonly)

Returns the value of attribute bank_account.



55144
55145
55146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55144

def 
  @bank_account
end

#created_atObject (readonly)

Returns the value of attribute created_at.



55144
55145
55146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55144

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



55144
55145
55146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55144

def id
  @id
end

#statusObject (readonly)

Returns the value of attribute status.



55144
55145
55146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55144

def status
  @status
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



55144
55145
55146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55144

def updated_at
  @updated_at
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



55163
55164
55165
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55163

def copy(incoming={})
  OrganizationPayout.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



55167
55168
55169
55170
55171
55172
55173
55174
55175
55176
55177
55178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55167

def to_hash
  {
    :id => id,
    :account => .to_hash,
    :status => status.to_hash,
    :bank_account => .nil? ? nil : .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_jsonObject



55159
55160
55161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55159

def to_json
  JSON.dump(to_hash)
end