Class: ModernTreasury::BalanceReport
- Defined in:
- lib/modern_treasury/models/balance_report.rb
Overview
BalanceReport Model.
Instance Attribute Summary collapse
-
#as_of_date ⇒ Date
The date of the balance report in local time.
-
#as_of_time ⇒ DateTime
The time (24-hour clock) of the balance report in local time.
-
#balance_report_type ⇒ BalanceReportType
The specific type of balance report.
-
#balances ⇒ Array[Balance]
An array of ‘Balance` objects.
-
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#id ⇒ UUID | String
TODO: Write general description for this method.
-
#internal_account_id ⇒ UUID | String
The ID of one of your organization’s Internal Accounts.
-
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#object ⇒ String
TODO: Write general description for this method.
-
#updated_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(id:, object:, live_mode:, created_at:, updated_at:, balance_report_type:, as_of_date:, as_of_time:, balances:, internal_account_id:) ⇒ BalanceReport
constructor
A new instance of BalanceReport.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_as_of_time ⇒ Object
- #to_custom_created_at ⇒ Object
- #to_custom_updated_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id:, object:, live_mode:, created_at:, updated_at:, balance_report_type:, as_of_date:, as_of_time:, balances:, internal_account_id:) ⇒ BalanceReport
Returns a new instance of BalanceReport.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/modern_treasury/models/balance_report.rb', line 85 def initialize(id:, object:, live_mode:, created_at:, updated_at:, balance_report_type:, as_of_date:, as_of_time:, balances:, internal_account_id:) @id = id @object = object @live_mode = live_mode @created_at = created_at @updated_at = updated_at @balance_report_type = balance_report_type @as_of_date = as_of_date @as_of_time = as_of_time @balances = balances @internal_account_id = internal_account_id end |
Instance Attribute Details
#as_of_date ⇒ Date
The date of the balance report in local time.
43 44 45 |
# File 'lib/modern_treasury/models/balance_report.rb', line 43 def as_of_date @as_of_date end |
#as_of_time ⇒ DateTime
The time (24-hour clock) of the balance report in local time.
47 48 49 |
# File 'lib/modern_treasury/models/balance_report.rb', line 47 def as_of_time @as_of_time end |
#balance_report_type ⇒ BalanceReportType
The specific type of balance report. One of ‘intraday`, `previous_day`, `real_time`, or `other`.
39 40 41 |
# File 'lib/modern_treasury/models/balance_report.rb', line 39 def balance_report_type @balance_report_type end |
#balances ⇒ Array[Balance]
An array of ‘Balance` objects.
51 52 53 |
# File 'lib/modern_treasury/models/balance_report.rb', line 51 def balances @balances end |
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
29 30 31 |
# File 'lib/modern_treasury/models/balance_report.rb', line 29 def created_at @created_at end |
#id ⇒ UUID | String
TODO: Write general description for this method
15 16 17 |
# File 'lib/modern_treasury/models/balance_report.rb', line 15 def id @id end |
#internal_account_id ⇒ UUID | String
The ID of one of your organization’s Internal Accounts.
55 56 57 |
# File 'lib/modern_treasury/models/balance_report.rb', line 55 def internal_account_id @internal_account_id end |
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
24 25 26 |
# File 'lib/modern_treasury/models/balance_report.rb', line 24 def live_mode @live_mode end |
#object ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/modern_treasury/models/balance_report.rb', line 19 def object @object end |
#updated_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
34 35 36 |
# File 'lib/modern_treasury/models/balance_report.rb', line 34 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/modern_treasury/models/balance_report.rb', line 101 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil object = hash.key?('object') ? hash['object'] : nil live_mode = hash.key?('live_mode') ? hash['live_mode'] : nil created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) end balance_report_type = hash.key?('balance_report_type') ? hash['balance_report_type'] : nil as_of_date = hash.key?('as_of_date') ? hash['as_of_date'] : nil as_of_time = if hash.key?('as_of_time') (DateTimeHelper.from_rfc3339(hash['as_of_time']) if hash['as_of_time']) end # Parameter is an array, so we need to iterate through it balances = nil unless hash['balances'].nil? balances = [] hash['balances'].each do |structure| balances << (Balance.from_hash(structure) if structure) end end balances = nil unless hash.key?('balances') internal_account_id = hash.key?('internal_account_id') ? hash['internal_account_id'] : nil # Create object from extracted values. BalanceReport.new(id: id, object: object, live_mode: live_mode, created_at: created_at, updated_at: updated_at, balance_report_type: balance_report_type, as_of_date: as_of_date, as_of_time: as_of_time, balances: balances, internal_account_id: internal_account_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/modern_treasury/models/balance_report.rb', line 58 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['object'] = 'object' @_hash['live_mode'] = 'live_mode' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['balance_report_type'] = 'balance_report_type' @_hash['as_of_date'] = 'as_of_date' @_hash['as_of_time'] = 'as_of_time' @_hash['balances'] = 'balances' @_hash['internal_account_id'] = 'internal_account_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 82 83 |
# File 'lib/modern_treasury/models/balance_report.rb', line 79 def self.nullables %w[ as_of_time ] end |
.optionals ⇒ Object
An array for optional fields
74 75 76 |
# File 'lib/modern_treasury/models/balance_report.rb', line 74 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
168 169 170 171 172 173 174 175 |
# File 'lib/modern_treasury/models/balance_report.rb', line 168 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, object: #{@object.inspect}, live_mode:"\ " #{@live_mode.inspect}, created_at: #{@created_at.inspect}, updated_at:"\ " #{@updated_at.inspect}, balance_report_type: #{@balance_report_type.inspect}, as_of_date:"\ " #{@as_of_date.inspect}, as_of_time: #{@as_of_time.inspect}, balances:"\ " #{@balances.inspect}, internal_account_id: #{@internal_account_id.inspect}>" end |
#to_custom_as_of_time ⇒ Object
154 155 156 |
# File 'lib/modern_treasury/models/balance_report.rb', line 154 def to_custom_as_of_time DateTimeHelper.to_rfc3339(as_of_time) end |
#to_custom_created_at ⇒ Object
146 147 148 |
# File 'lib/modern_treasury/models/balance_report.rb', line 146 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_updated_at ⇒ Object
150 151 152 |
# File 'lib/modern_treasury/models/balance_report.rb', line 150 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
159 160 161 162 163 164 165 |
# File 'lib/modern_treasury/models/balance_report.rb', line 159 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\ " #{@created_at}, updated_at: #{@updated_at}, balance_report_type: #{@balance_report_type},"\ " as_of_date: #{@as_of_date}, as_of_time: #{@as_of_time}, balances: #{@balances},"\ " internal_account_id: #{@internal_account_id}>" end |