Class: YNAB::Account
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- YNAB::Account
- Defined in:
- lib/ynab/models/account.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#balance ⇒ Object
The current available balance of the account in milliunits format.
-
#balance_currency ⇒ Object
The current available balance of the account as a decimal currency amount.
-
#balance_formatted ⇒ Object
The current available balance of the account formatted in the plan’s currency format.
-
#cleared_balance ⇒ Object
The current cleared balance of the account in milliunits format.
-
#cleared_balance_currency ⇒ Object
The current cleared balance of the account as a decimal currency amount.
-
#cleared_balance_formatted ⇒ Object
The current cleared balance of the account formatted in the plan’s currency format.
-
#closed ⇒ Object
Whether this account is closed or not.
-
#debt_escrow_amounts ⇒ Object
Returns the value of attribute debt_escrow_amounts.
-
#debt_interest_rates ⇒ Object
Returns the value of attribute debt_interest_rates.
-
#debt_minimum_payments ⇒ Object
Returns the value of attribute debt_minimum_payments.
-
#debt_original_balance ⇒ Object
This field is deprecated and will always be null.
-
#deleted ⇒ Object
Whether or not the account has been deleted.
-
#direct_import_in_error ⇒ Object
If an account linked to a financial institution (direct_import_linked=true) and the linked connection is not in a healthy state, this will be true.
-
#direct_import_linked ⇒ Object
Whether or not the account is linked to a financial institution for automatic transaction import.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_reconciled_at ⇒ Object
A date/time specifying when the account was last reconciled.
-
#name ⇒ Object
Returns the value of attribute name.
-
#note ⇒ Object
Returns the value of attribute note.
-
#on_budget ⇒ Object
Whether this account is "on budget" or not.
-
#transfer_payee_id ⇒ Object
The payee id which should be used when transferring to this account.
-
#type ⇒ Object
Returns the value of attribute type.
-
#uncleared_balance ⇒ Object
The current uncleared balance of the account in milliunits format.
-
#uncleared_balance_currency ⇒ Object
The current uncleared balance of the account as a decimal currency amount.
-
#uncleared_balance_formatted ⇒ Object
The current uncleared balance of the account formatted in the plan’s currency format.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3).
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Account
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Account
Initializes the object
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/ynab/models/account.rb', line 182 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::Account` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::Account`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'on_budget') self.on_budget = attributes[:'on_budget'] end if attributes.key?(:'closed') self.closed = attributes[:'closed'] end if attributes.key?(:'note') self.note = attributes[:'note'] end if attributes.key?(:'balance') self.balance = attributes[:'balance'] end if attributes.key?(:'cleared_balance') self.cleared_balance = attributes[:'cleared_balance'] end if attributes.key?(:'uncleared_balance') self.uncleared_balance = attributes[:'uncleared_balance'] end if attributes.key?(:'transfer_payee_id') self.transfer_payee_id = attributes[:'transfer_payee_id'] end if attributes.key?(:'direct_import_linked') self.direct_import_linked = attributes[:'direct_import_linked'] end if attributes.key?(:'direct_import_in_error') self.direct_import_in_error = attributes[:'direct_import_in_error'] end if attributes.key?(:'last_reconciled_at') self.last_reconciled_at = attributes[:'last_reconciled_at'] end if attributes.key?(:'debt_original_balance') self.debt_original_balance = attributes[:'debt_original_balance'] end if attributes.key?(:'debt_interest_rates') if (value = attributes[:'debt_interest_rates']).is_a?(Hash) self.debt_interest_rates = value end end if attributes.key?(:'debt_minimum_payments') if (value = attributes[:'debt_minimum_payments']).is_a?(Hash) self.debt_minimum_payments = value end end if attributes.key?(:'debt_escrow_amounts') if (value = attributes[:'debt_escrow_amounts']).is_a?(Hash) self.debt_escrow_amounts = value end end if attributes.key?(:'deleted') self.deleted = attributes[:'deleted'] end if attributes.key?(:'balance_formatted') self.balance_formatted = attributes[:'balance_formatted'] end if attributes.key?(:'balance_currency') self.balance_currency = attributes[:'balance_currency'] end if attributes.key?(:'cleared_balance_formatted') self.cleared_balance_formatted = attributes[:'cleared_balance_formatted'] end if attributes.key?(:'cleared_balance_currency') self.cleared_balance_currency = attributes[:'cleared_balance_currency'] end if attributes.key?(:'uncleared_balance_formatted') self.uncleared_balance_formatted = attributes[:'uncleared_balance_formatted'] end if attributes.key?(:'uncleared_balance_currency') self.uncleared_balance_currency = attributes[:'uncleared_balance_currency'] end end |
Instance Attribute Details
#balance ⇒ Object
The current available balance of the account in milliunits format
30 31 32 |
# File 'lib/ynab/models/account.rb', line 30 def balance @balance end |
#balance_currency ⇒ Object
The current available balance of the account as a decimal currency amount
66 67 68 |
# File 'lib/ynab/models/account.rb', line 66 def balance_currency @balance_currency end |
#balance_formatted ⇒ Object
The current available balance of the account formatted in the plan’s currency format
63 64 65 |
# File 'lib/ynab/models/account.rb', line 63 def balance_formatted @balance_formatted end |
#cleared_balance ⇒ Object
The current cleared balance of the account in milliunits format
33 34 35 |
# File 'lib/ynab/models/account.rb', line 33 def cleared_balance @cleared_balance end |
#cleared_balance_currency ⇒ Object
The current cleared balance of the account as a decimal currency amount
72 73 74 |
# File 'lib/ynab/models/account.rb', line 72 def cleared_balance_currency @cleared_balance_currency end |
#cleared_balance_formatted ⇒ Object
The current cleared balance of the account formatted in the plan’s currency format
69 70 71 |
# File 'lib/ynab/models/account.rb', line 69 def cleared_balance_formatted @cleared_balance_formatted end |
#closed ⇒ Object
Whether this account is closed or not
25 26 27 |
# File 'lib/ynab/models/account.rb', line 25 def closed @closed end |
#debt_escrow_amounts ⇒ Object
Returns the value of attribute debt_escrow_amounts.
57 58 59 |
# File 'lib/ynab/models/account.rb', line 57 def debt_escrow_amounts @debt_escrow_amounts end |
#debt_interest_rates ⇒ Object
Returns the value of attribute debt_interest_rates.
53 54 55 |
# File 'lib/ynab/models/account.rb', line 53 def debt_interest_rates @debt_interest_rates end |
#debt_minimum_payments ⇒ Object
Returns the value of attribute debt_minimum_payments.
55 56 57 |
# File 'lib/ynab/models/account.rb', line 55 def debt_minimum_payments @debt_minimum_payments end |
#debt_original_balance ⇒ Object
This field is deprecated and will always be null.
51 52 53 |
# File 'lib/ynab/models/account.rb', line 51 def debt_original_balance @debt_original_balance end |
#deleted ⇒ Object
Whether or not the account has been deleted. Deleted accounts will only be included in delta requests.
60 61 62 |
# File 'lib/ynab/models/account.rb', line 60 def deleted @deleted end |
#direct_import_in_error ⇒ Object
If an account linked to a financial institution (direct_import_linked=true) and the linked connection is not in a healthy state, this will be true.
45 46 47 |
# File 'lib/ynab/models/account.rb', line 45 def direct_import_in_error @direct_import_in_error end |
#direct_import_linked ⇒ Object
Whether or not the account is linked to a financial institution for automatic transaction import.
42 43 44 |
# File 'lib/ynab/models/account.rb', line 42 def direct_import_linked @direct_import_linked end |
#id ⇒ Object
Returns the value of attribute id.
15 16 17 |
# File 'lib/ynab/models/account.rb', line 15 def id @id end |
#last_reconciled_at ⇒ Object
A date/time specifying when the account was last reconciled.
48 49 50 |
# File 'lib/ynab/models/account.rb', line 48 def last_reconciled_at @last_reconciled_at end |
#name ⇒ Object
Returns the value of attribute name.
17 18 19 |
# File 'lib/ynab/models/account.rb', line 17 def name @name end |
#note ⇒ Object
Returns the value of attribute note.
27 28 29 |
# File 'lib/ynab/models/account.rb', line 27 def note @note end |
#on_budget ⇒ Object
Whether this account is "on budget" or not
22 23 24 |
# File 'lib/ynab/models/account.rb', line 22 def on_budget @on_budget end |
#transfer_payee_id ⇒ Object
The payee id which should be used when transferring to this account
39 40 41 |
# File 'lib/ynab/models/account.rb', line 39 def transfer_payee_id @transfer_payee_id end |
#type ⇒ Object
Returns the value of attribute type.
19 20 21 |
# File 'lib/ynab/models/account.rb', line 19 def type @type end |
#uncleared_balance ⇒ Object
The current uncleared balance of the account in milliunits format
36 37 38 |
# File 'lib/ynab/models/account.rb', line 36 def uncleared_balance @uncleared_balance end |
#uncleared_balance_currency ⇒ Object
The current uncleared balance of the account as a decimal currency amount
78 79 80 |
# File 'lib/ynab/models/account.rb', line 78 def uncleared_balance_currency @uncleared_balance_currency end |
#uncleared_balance_formatted ⇒ Object
The current uncleared balance of the account formatted in the plan’s currency format
75 76 77 |
# File 'lib/ynab/models/account.rb', line 75 def uncleared_balance_formatted @uncleared_balance_formatted end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
133 134 135 |
# File 'lib/ynab/models/account.rb', line 133 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 |
# File 'lib/ynab/models/account.rb', line 103 def self.attribute_map { :'id' => :'id', :'name' => :'name', :'type' => :'type', :'on_budget' => :'on_budget', :'closed' => :'closed', :'note' => :'note', :'balance' => :'balance', :'cleared_balance' => :'cleared_balance', :'uncleared_balance' => :'uncleared_balance', :'transfer_payee_id' => :'transfer_payee_id', :'direct_import_linked' => :'direct_import_linked', :'direct_import_in_error' => :'direct_import_in_error', :'last_reconciled_at' => :'last_reconciled_at', :'debt_original_balance' => :'debt_original_balance', :'debt_interest_rates' => :'debt_interest_rates', :'debt_minimum_payments' => :'debt_minimum_payments', :'debt_escrow_amounts' => :'debt_escrow_amounts', :'deleted' => :'deleted', :'balance_formatted' => :'balance_formatted', :'balance_currency' => :'balance_currency', :'cleared_balance_formatted' => :'cleared_balance_formatted', :'cleared_balance_currency' => :'cleared_balance_currency', :'uncleared_balance_formatted' => :'uncleared_balance_formatted', :'uncleared_balance_currency' => :'uncleared_balance_currency' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/ynab/models/account.rb', line 367 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3)
174 175 176 177 178 |
# File 'lib/ynab/models/account.rb', line 174 def self.openapi_all_of [ :'AccountBase' ] end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
168 169 170 171 |
# File 'lib/ynab/models/account.rb', line 168 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/ynab/models/account.rb', line 138 def self.openapi_types { :'id' => :'String', :'name' => :'String', :'type' => :'AccountType', :'on_budget' => :'Boolean', :'closed' => :'Boolean', :'note' => :'String', :'balance' => :'Integer', :'cleared_balance' => :'Integer', :'uncleared_balance' => :'Integer', :'transfer_payee_id' => :'String', :'direct_import_linked' => :'Boolean', :'direct_import_in_error' => :'Boolean', :'last_reconciled_at' => :'Time', :'debt_original_balance' => :'Integer', :'debt_interest_rates' => :'Hash<String, Integer>', :'debt_minimum_payments' => :'Hash<String, Integer>', :'debt_escrow_amounts' => :'Hash<String, Integer>', :'deleted' => :'Boolean', :'balance_formatted' => :'String', :'balance_currency' => :'Float', :'cleared_balance_formatted' => :'String', :'cleared_balance_currency' => :'Float', :'uncleared_balance_formatted' => :'String', :'uncleared_balance_currency' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/ynab/models/account.rb', line 323 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && name == o.name && type == o.type && on_budget == o.on_budget && closed == o.closed && note == o.note && balance == o.balance && cleared_balance == o.cleared_balance && uncleared_balance == o.uncleared_balance && transfer_payee_id == o.transfer_payee_id && direct_import_linked == o.direct_import_linked && direct_import_in_error == o.direct_import_in_error && last_reconciled_at == o.last_reconciled_at && debt_original_balance == o.debt_original_balance && debt_interest_rates == o.debt_interest_rates && debt_minimum_payments == o.debt_minimum_payments && debt_escrow_amounts == o.debt_escrow_amounts && deleted == o.deleted && balance_formatted == o.balance_formatted && balance_currency == o.balance_currency && cleared_balance_formatted == o.cleared_balance_formatted && cleared_balance_currency == o.cleared_balance_currency && uncleared_balance_formatted == o.uncleared_balance_formatted && uncleared_balance_currency == o.uncleared_balance_currency end |
#eql?(o) ⇒ Boolean
354 355 356 |
# File 'lib/ynab/models/account.rb', line 354 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
360 361 362 |
# File 'lib/ynab/models/account.rb', line 360 def hash [id, name, type, on_budget, closed, note, balance, cleared_balance, uncleared_balance, transfer_payee_id, direct_import_linked, direct_import_in_error, last_reconciled_at, debt_original_balance, debt_interest_rates, debt_minimum_payments, debt_escrow_amounts, deleted, balance_formatted, balance_currency, cleared_balance_formatted, cleared_balance_currency, uncleared_balance_formatted, uncleared_balance_currency].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
300 301 302 303 |
# File 'lib/ynab/models/account.rb', line 300 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/ynab/models/account.rb', line 389 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/ynab/models/account.rb', line 307 def valid? return false if @id.nil? return false if @name.nil? return false if @type.nil? return false if @on_budget.nil? return false if @closed.nil? return false if @balance.nil? return false if @cleared_balance.nil? return false if @uncleared_balance.nil? return false if @transfer_payee_id.nil? return false if @deleted.nil? true end |