Class: Io::Flow::V0::Models::Statement
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Statement
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#ending_balance ⇒ Object
readonly
Returns the value of attribute ending_balance.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#settlement ⇒ Object
readonly
Returns the value of attribute settlement.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Statement
constructor
A new instance of Statement.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Statement
Returns a new instance of Statement.
68688 68689 68690 68691 68692 68693 68694 68695 68696 68697 |
# 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 |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
68686 68687 68688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68686 def account @account end |
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
68686 68687 68688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68686 def @attachments end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
68686 68687 68688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68686 def created_at @created_at end |
#ending_balance ⇒ Object (readonly)
Returns the value of attribute ending_balance.
68686 68687 68688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68686 def ending_balance @ending_balance end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
68686 68687 68688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68686 def id @id end |
#settlement ⇒ Object (readonly)
Returns the value of attribute settlement.
68686 68687 68688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68686 def settlement @settlement end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
68703 68704 68705 |
# 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 ⇒ Object
68707 68708 68709 68710 68711 68712 68713 68714 68715 68716 |
# 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 => .map { |o| o.to_hash }, :created_at => created_at } end |
#to_json ⇒ Object
68699 68700 68701 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68699 def to_json JSON.dump(to_hash) end |