class Io::Flow::V0::Models::Statement

Attributes

account[R]
attachments[R]
created_at[R]
ending_balance[R]
id[R]
settlement[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68688
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :account, :ending_balance, :settlement, :attachments, :created_at], 'Statement')
  @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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68703
def copy(incoming={})
  Statement.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 68707
def to_hash
  {
    :id => id,
    :account => 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_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68699
def to_json
  JSON.dump(to_hash)
end