Class: Io::Flow::V0::Models::ChannelStatement
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ChannelStatement
- 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 = {}) ⇒ ChannelStatement
constructor
A new instance of ChannelStatement.
- #to_hash ⇒ Object
- #to_json ⇒ Object
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
#account ⇒ Object (readonly)
Returns the value of attribute account.
35442 35443 35444 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35442 def account @account end |
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
35442 35443 35444 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35442 def @attachments end |
#created_at ⇒ Object (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_balance ⇒ Object (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 |
#id ⇒ Object (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 |
#settlement ⇒ Object (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_hash ⇒ Object
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 => 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
35455 35456 35457 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35455 def to_json JSON.dump(to_hash) end |