Class: Io::Flow::V0::Models::ChannelStatement

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 = {}) ⇒ ChannelStatement

Returns a new instance of ChannelStatement.



35444
35445
35446
35447
35448
35449
35450
35451
35452
35453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35444

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :account, :ending_balance, :settlement, :attachments, :created_at], 'ChannelStatement')
  @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))
  @ending_balance = HttpClient::Preconditions.assert_class('ending_balance', HttpClient::Helper.to_big_decimal(opts.delete(:ending_balance)), BigDecimal)
  @settlement = (x = opts.delete(:settlement); x.is_a?(::Io::Flow::V0::Models::Settlement) ? x : ::Io::Flow::V0::Models::Settlement.from_json(x))
  @attachments = HttpClient::Preconditions.assert_class('attachments', opts.delete(:attachments), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Attachment) ? x : ::Io::Flow::V0::Models::Attachment.new(x)) }
  @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



35442
35443
35444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35442

def 
  @account
end

#attachmentsObject (readonly)

Returns the value of attribute attachments.



35442
35443
35444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35442

def attachments
  @attachments
end

#created_atObject (readonly)

Returns the value of attribute created_at.



35442
35443
35444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35442

def created_at
  @created_at
end

#ending_balanceObject (readonly)

Returns the value of attribute ending_balance.



35442
35443
35444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35442

def ending_balance
  @ending_balance
end

#idObject (readonly)

Returns the value of attribute id.



35442
35443
35444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35442

def id
  @id
end

#settlementObject (readonly)

Returns the value of attribute settlement.



35442
35443
35444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35442

def settlement
  @settlement
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35459
35460
35461
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35459

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

#to_hashObject



35463
35464
35465
35466
35467
35468
35469
35470
35471
35472
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35463

def to_hash
  {
    :id => id,
    :account => .to_hash,
    :ending_balance => ending_balance.to_f.to_s,
    :settlement => settlement.to_hash,
    :attachments => attachments.map { |o| o.to_hash },
    :created_at => created_at
  }
end

#to_jsonObject



35455
35456
35457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35455

def to_json
  JSON.dump(to_hash)
end