Class: YNAB::Category

Inherits:
ApiModelBase show all
Defined in:
lib/ynab/models/category.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Category

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
# File 'lib/ynab/models/category.rb', line 273

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::Category` 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::Category`. 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?(:'category_group_id')
    self.category_group_id = attributes[:'category_group_id']
  end

  if attributes.key?(:'category_group_name')
    self.category_group_name = attributes[:'category_group_name']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'hidden')
    self.hidden = attributes[:'hidden']
  end

  if attributes.key?(:'original_category_group_id')
    self.original_category_group_id = attributes[:'original_category_group_id']
  end

  if attributes.key?(:'note')
    self.note = attributes[:'note']
  end

  if attributes.key?(:'budgeted')
    self.budgeted = attributes[:'budgeted']
  end

  if attributes.key?(:'activity')
    self.activity = attributes[:'activity']
  end

  if attributes.key?(:'balance')
    self.balance = attributes[:'balance']
  end

  if attributes.key?(:'goal_type')
    self.goal_type = attributes[:'goal_type']
  end

  if attributes.key?(:'goal_needs_whole_amount')
    self.goal_needs_whole_amount = attributes[:'goal_needs_whole_amount']
  end

  if attributes.key?(:'goal_day')
    self.goal_day = attributes[:'goal_day']
  end

  if attributes.key?(:'goal_cadence')
    self.goal_cadence = attributes[:'goal_cadence']
  end

  if attributes.key?(:'goal_cadence_frequency')
    self.goal_cadence_frequency = attributes[:'goal_cadence_frequency']
  end

  if attributes.key?(:'goal_creation_month')
    self.goal_creation_month = attributes[:'goal_creation_month']
  end

  if attributes.key?(:'goal_target')
    self.goal_target = attributes[:'goal_target']
  end

  if attributes.key?(:'goal_target_month')
    self.goal_target_month = attributes[:'goal_target_month']
  end

  if attributes.key?(:'goal_target_date')
    self.goal_target_date = attributes[:'goal_target_date']
  end

  if attributes.key?(:'goal_percentage_complete')
    self.goal_percentage_complete = attributes[:'goal_percentage_complete']
  end

  if attributes.key?(:'goal_months_to_budget')
    self.goal_months_to_budget = attributes[:'goal_months_to_budget']
  end

  if attributes.key?(:'goal_under_funded')
    self.goal_under_funded = attributes[:'goal_under_funded']
  end

  if attributes.key?(:'goal_overall_funded')
    self.goal_overall_funded = attributes[:'goal_overall_funded']
  end

  if attributes.key?(:'goal_overall_left')
    self.goal_overall_left = attributes[:'goal_overall_left']
  end

  if attributes.key?(:'goal_snoozed_at')
    self.goal_snoozed_at = attributes[:'goal_snoozed_at']
  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?(:'activity_formatted')
    self.activity_formatted = attributes[:'activity_formatted']
  end

  if attributes.key?(:'activity_currency')
    self.activity_currency = attributes[:'activity_currency']
  end

  if attributes.key?(:'budgeted_formatted')
    self.budgeted_formatted = attributes[:'budgeted_formatted']
  end

  if attributes.key?(:'budgeted_currency')
    self.budgeted_currency = attributes[:'budgeted_currency']
  end

  if attributes.key?(:'goal_target_formatted')
    self.goal_target_formatted = attributes[:'goal_target_formatted']
  end

  if attributes.key?(:'goal_target_currency')
    self.goal_target_currency = attributes[:'goal_target_currency']
  end

  if attributes.key?(:'goal_under_funded_formatted')
    self.goal_under_funded_formatted = attributes[:'goal_under_funded_formatted']
  end

  if attributes.key?(:'goal_under_funded_currency')
    self.goal_under_funded_currency = attributes[:'goal_under_funded_currency']
  end

  if attributes.key?(:'goal_overall_funded_formatted')
    self.goal_overall_funded_formatted = attributes[:'goal_overall_funded_formatted']
  end

  if attributes.key?(:'goal_overall_funded_currency')
    self.goal_overall_funded_currency = attributes[:'goal_overall_funded_currency']
  end

  if attributes.key?(:'goal_overall_left_formatted')
    self.goal_overall_left_formatted = attributes[:'goal_overall_left_formatted']
  end

  if attributes.key?(:'goal_overall_left_currency')
    self.goal_overall_left_currency = attributes[:'goal_overall_left_currency']
  end
end

Instance Attribute Details

#activityObject

Activity amount in milliunits format



35
36
37
# File 'lib/ynab/models/category.rb', line 35

def activity
  @activity
end

#activity_currencyObject

Activity of the category as a decimal currency amount



98
99
100
# File 'lib/ynab/models/category.rb', line 98

def activity_currency
  @activity_currency
end

#activity_formattedObject

Activity of the category formatted in the plan’s currency format



95
96
97
# File 'lib/ynab/models/category.rb', line 95

def activity_formatted
  @activity_formatted
end

#balanceObject

Available balance in milliunits format



38
39
40
# File 'lib/ynab/models/category.rb', line 38

def balance
  @balance
end

#balance_currencyObject

Available balance of the category as a decimal currency amount



92
93
94
# File 'lib/ynab/models/category.rb', line 92

def balance_currency
  @balance_currency
end

#balance_formattedObject

Available balance of the category formatted in the plan’s currency format



89
90
91
# File 'lib/ynab/models/category.rb', line 89

def balance_formatted
  @balance_formatted
end

#budgetedObject

Assigned (budgeted) amount in milliunits format



32
33
34
# File 'lib/ynab/models/category.rb', line 32

def budgeted
  @budgeted
end

#budgeted_currencyObject

Assigned (budgeted) amount of the category as a decimal currency amount



104
105
106
# File 'lib/ynab/models/category.rb', line 104

def budgeted_currency
  @budgeted_currency
end

#budgeted_formattedObject

Assigned (budgeted) amount of the category formatted in the plan’s currency format



101
102
103
# File 'lib/ynab/models/category.rb', line 101

def budgeted_formatted
  @budgeted_formatted
end

#category_group_idObject

Returns the value of attribute category_group_id.



17
18
19
# File 'lib/ynab/models/category.rb', line 17

def category_group_id
  @category_group_id
end

#category_group_nameObject

Returns the value of attribute category_group_name.



19
20
21
# File 'lib/ynab/models/category.rb', line 19

def category_group_name
  @category_group_name
end

#deletedObject

Whether or not the category has been deleted. Deleted categories will only be included in delta requests.



86
87
88
# File 'lib/ynab/models/category.rb', line 86

def deleted
  @deleted
end

#goal_cadenceObject

The goal cadence. Value in range 0-14. There are two subsets of these values which behave differently. For values 0, 1, 2, and 13, the goal’s due date repeats every goal_cadence * goal_cadence_frequency, where 0 = None, 1 = Monthly, 2 = Weekly, and 13 = Yearly. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. For values 3-12 and 14, goal_cadence_frequency is ignored and the goal’s due date repeats every goal_cadence, where 3 = Every 2 Months, 4 = Every 3 Months, …, 12 = Every 11 Months, and 14 = Every 2 Years.



50
51
52
# File 'lib/ynab/models/category.rb', line 50

def goal_cadence
  @goal_cadence
end

#goal_cadence_frequencyObject

The goal cadence frequency. When goal_cadence is 0, 1, 2, or 13, a goal’s due date repeats every goal_cadence * goal_cadence_frequency. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. When goal_cadence is 3-12 or 14, goal_cadence_frequency is ignored.



53
54
55
# File 'lib/ynab/models/category.rb', line 53

def goal_cadence_frequency
  @goal_cadence_frequency
end

#goal_creation_monthObject

The month a goal was created



56
57
58
# File 'lib/ynab/models/category.rb', line 56

def goal_creation_month
  @goal_creation_month
end

#goal_dayObject

A day offset modifier for the goal’s due date. When goal_cadence is 2 (Weekly), this value specifies which day of the week the goal is due (0 = Sunday, 6 = Saturday). Otherwise, this value specifies which day of the month the goal is due (1 = 1st, 31 = 31st, null = Last day of Month).



47
48
49
# File 'lib/ynab/models/category.rb', line 47

def goal_day
  @goal_day
end

#goal_months_to_budgetObject

The number of months, including the current month, left in the current goal period.



71
72
73
# File 'lib/ynab/models/category.rb', line 71

def goal_months_to_budget
  @goal_months_to_budget
end

#goal_needs_whole_amountObject

Indicates the monthly rollover behavior for "NEED"-type goals. When "true", the goal will always ask for the target amount in the new month ("Set Aside"). When "false", previous month category funding is used ("Refill"). For other goal types, this field will be null.



44
45
46
# File 'lib/ynab/models/category.rb', line 44

def goal_needs_whole_amount
  @goal_needs_whole_amount
end

#goal_overall_fundedObject

The total amount funded towards the goal within the current goal period.



77
78
79
# File 'lib/ynab/models/category.rb', line 77

def goal_overall_funded
  @goal_overall_funded
end

#goal_overall_funded_currencyObject

The total amount funded towards the goal as a decimal currency amount



122
123
124
# File 'lib/ynab/models/category.rb', line 122

def goal_overall_funded_currency
  @goal_overall_funded_currency
end

#goal_overall_funded_formattedObject

The total amount funded towards the goal formatted in the plan’s currency format



119
120
121
# File 'lib/ynab/models/category.rb', line 119

def goal_overall_funded_formatted
  @goal_overall_funded_formatted
end

#goal_overall_leftObject

The amount of funding still needed to complete the goal within the current goal period.



80
81
82
# File 'lib/ynab/models/category.rb', line 80

def goal_overall_left
  @goal_overall_left
end

#goal_overall_left_currencyObject

The amount of funding still needed to complete the goal as a decimal currency amount



128
129
130
# File 'lib/ynab/models/category.rb', line 128

def goal_overall_left_currency
  @goal_overall_left_currency
end

#goal_overall_left_formattedObject

The amount of funding still needed to complete the goal formatted in the plan’s currency format



125
126
127
# File 'lib/ynab/models/category.rb', line 125

def goal_overall_left_formatted
  @goal_overall_left_formatted
end

#goal_percentage_completeObject

The percentage completion of the goal



68
69
70
# File 'lib/ynab/models/category.rb', line 68

def goal_percentage_complete
  @goal_percentage_complete
end

#goal_snoozed_atObject

The date/time the goal was snoozed. If the goal is not snoozed, this will be null.



83
84
85
# File 'lib/ynab/models/category.rb', line 83

def goal_snoozed_at
  @goal_snoozed_at
end

#goal_targetObject

The goal target amount in milliunits



59
60
61
# File 'lib/ynab/models/category.rb', line 59

def goal_target
  @goal_target
end

#goal_target_currencyObject

The goal target amount as a decimal currency amount



110
111
112
# File 'lib/ynab/models/category.rb', line 110

def goal_target_currency
  @goal_target_currency
end

#goal_target_dateObject

The target date for the goal to be completed. Only some goal types specify this date.



65
66
67
# File 'lib/ynab/models/category.rb', line 65

def goal_target_date
  @goal_target_date
end

#goal_target_formattedObject

The goal target amount formatted in the plan’s currency format



107
108
109
# File 'lib/ynab/models/category.rb', line 107

def goal_target_formatted
  @goal_target_formatted
end

#goal_target_monthObject

DEPRECATED: No longer used. Use ‘goal_target_date` instead.



62
63
64
# File 'lib/ynab/models/category.rb', line 62

def goal_target_month
  @goal_target_month
end

#goal_typeObject

The type of goal, if the category has a goal (TB=‘Target Category Balance’, TBD=‘Target Category Balance by Date’, MF=‘Monthly Funding’, NEED=‘Plan Your Spending’)



41
42
43
# File 'lib/ynab/models/category.rb', line 41

def goal_type
  @goal_type
end

#goal_under_fundedObject

The amount of funding still needed in the current month to stay on track towards completing the goal within the current goal period. This amount will generally correspond to the ‘Underfunded’ amount in the web and mobile clients except when viewing a category with a Needed for Spending Goal in a future month. The web and mobile clients will ignore any funding from a prior goal period when viewing category with a Needed for Spending Goal in a future month.



74
75
76
# File 'lib/ynab/models/category.rb', line 74

def goal_under_funded
  @goal_under_funded
end

#goal_under_funded_currencyObject

The goal underfunded amount as a decimal currency amount



116
117
118
# File 'lib/ynab/models/category.rb', line 116

def goal_under_funded_currency
  @goal_under_funded_currency
end

#goal_under_funded_formattedObject

The goal underfunded amount formatted in the plan’s currency format



113
114
115
# File 'lib/ynab/models/category.rb', line 113

def goal_under_funded_formatted
  @goal_under_funded_formatted
end

#hiddenObject

Whether or not the category is hidden



24
25
26
# File 'lib/ynab/models/category.rb', line 24

def hidden
  @hidden
end

#idObject

Returns the value of attribute id.



15
16
17
# File 'lib/ynab/models/category.rb', line 15

def id
  @id
end

#nameObject

Returns the value of attribute name.



21
22
23
# File 'lib/ynab/models/category.rb', line 21

def name
  @name
end

#noteObject

Returns the value of attribute note.



29
30
31
# File 'lib/ynab/models/category.rb', line 29

def note
  @note
end

#original_category_group_idObject

DEPRECATED: No longer used. Value will always be null.



27
28
29
# File 'lib/ynab/models/category.rb', line 27

def original_category_group_id
  @original_category_group_id
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



199
200
201
# File 'lib/ynab/models/category.rb', line 199

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/ynab/models/category.rb', line 153

def self.attribute_map
  {
    :'id' => :'id',
    :'category_group_id' => :'category_group_id',
    :'category_group_name' => :'category_group_name',
    :'name' => :'name',
    :'hidden' => :'hidden',
    :'original_category_group_id' => :'original_category_group_id',
    :'note' => :'note',
    :'budgeted' => :'budgeted',
    :'activity' => :'activity',
    :'balance' => :'balance',
    :'goal_type' => :'goal_type',
    :'goal_needs_whole_amount' => :'goal_needs_whole_amount',
    :'goal_day' => :'goal_day',
    :'goal_cadence' => :'goal_cadence',
    :'goal_cadence_frequency' => :'goal_cadence_frequency',
    :'goal_creation_month' => :'goal_creation_month',
    :'goal_target' => :'goal_target',
    :'goal_target_month' => :'goal_target_month',
    :'goal_target_date' => :'goal_target_date',
    :'goal_percentage_complete' => :'goal_percentage_complete',
    :'goal_months_to_budget' => :'goal_months_to_budget',
    :'goal_under_funded' => :'goal_under_funded',
    :'goal_overall_funded' => :'goal_overall_funded',
    :'goal_overall_left' => :'goal_overall_left',
    :'goal_snoozed_at' => :'goal_snoozed_at',
    :'deleted' => :'deleted',
    :'balance_formatted' => :'balance_formatted',
    :'balance_currency' => :'balance_currency',
    :'activity_formatted' => :'activity_formatted',
    :'activity_currency' => :'activity_currency',
    :'budgeted_formatted' => :'budgeted_formatted',
    :'budgeted_currency' => :'budgeted_currency',
    :'goal_target_formatted' => :'goal_target_formatted',
    :'goal_target_currency' => :'goal_target_currency',
    :'goal_under_funded_formatted' => :'goal_under_funded_formatted',
    :'goal_under_funded_currency' => :'goal_under_funded_currency',
    :'goal_overall_funded_formatted' => :'goal_overall_funded_formatted',
    :'goal_overall_funded_currency' => :'goal_overall_funded_currency',
    :'goal_overall_left_formatted' => :'goal_overall_left_formatted',
    :'goal_overall_left_currency' => :'goal_overall_left_currency'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'lib/ynab/models/category.rb', line 538

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_ofObject

List of class defined in allOf (OpenAPI v3)



265
266
267
268
269
# File 'lib/ynab/models/category.rb', line 265

def self.openapi_all_of
  [
  :'CategoryBase'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/ynab/models/category.rb', line 250

def self.openapi_nullable
  Set.new([
    :'goal_type',
    :'goal_target_formatted',
    :'goal_target_currency',
    :'goal_under_funded_formatted',
    :'goal_under_funded_currency',
    :'goal_overall_funded_formatted',
    :'goal_overall_funded_currency',
    :'goal_overall_left_formatted',
    :'goal_overall_left_currency'
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/ynab/models/category.rb', line 204

def self.openapi_types
  {
    :'id' => :'String',
    :'category_group_id' => :'String',
    :'category_group_name' => :'String',
    :'name' => :'String',
    :'hidden' => :'Boolean',
    :'original_category_group_id' => :'String',
    :'note' => :'String',
    :'budgeted' => :'Integer',
    :'activity' => :'Integer',
    :'balance' => :'Integer',
    :'goal_type' => :'String',
    :'goal_needs_whole_amount' => :'Boolean',
    :'goal_day' => :'Integer',
    :'goal_cadence' => :'Integer',
    :'goal_cadence_frequency' => :'Integer',
    :'goal_creation_month' => :'Date',
    :'goal_target' => :'Integer',
    :'goal_target_month' => :'Date',
    :'goal_target_date' => :'Date',
    :'goal_percentage_complete' => :'Integer',
    :'goal_months_to_budget' => :'Integer',
    :'goal_under_funded' => :'Integer',
    :'goal_overall_funded' => :'Integer',
    :'goal_overall_left' => :'Integer',
    :'goal_snoozed_at' => :'Time',
    :'deleted' => :'Boolean',
    :'balance_formatted' => :'String',
    :'balance_currency' => :'Float',
    :'activity_formatted' => :'String',
    :'activity_currency' => :'Float',
    :'budgeted_formatted' => :'String',
    :'budgeted_currency' => :'Float',
    :'goal_target_formatted' => :'String',
    :'goal_target_currency' => :'Float',
    :'goal_under_funded_formatted' => :'String',
    :'goal_under_funded_currency' => :'Float',
    :'goal_overall_funded_formatted' => :'String',
    :'goal_overall_funded_currency' => :'Float',
    :'goal_overall_left_formatted' => :'String',
    :'goal_overall_left_currency' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/ynab/models/category.rb', line 478

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      category_group_id == o.category_group_id &&
      category_group_name == o.category_group_name &&
      name == o.name &&
      hidden == o.hidden &&
      original_category_group_id == o.original_category_group_id &&
      note == o.note &&
      budgeted == o.budgeted &&
      activity == o.activity &&
      balance == o.balance &&
      goal_type == o.goal_type &&
      goal_needs_whole_amount == o.goal_needs_whole_amount &&
      goal_day == o.goal_day &&
      goal_cadence == o.goal_cadence &&
      goal_cadence_frequency == o.goal_cadence_frequency &&
      goal_creation_month == o.goal_creation_month &&
      goal_target == o.goal_target &&
      goal_target_month == o.goal_target_month &&
      goal_target_date == o.goal_target_date &&
      goal_percentage_complete == o.goal_percentage_complete &&
      goal_months_to_budget == o.goal_months_to_budget &&
      goal_under_funded == o.goal_under_funded &&
      goal_overall_funded == o.goal_overall_funded &&
      goal_overall_left == o.goal_overall_left &&
      goal_snoozed_at == o.goal_snoozed_at &&
      deleted == o.deleted &&
      balance_formatted == o.balance_formatted &&
      balance_currency == o.balance_currency &&
      activity_formatted == o.activity_formatted &&
      activity_currency == o.activity_currency &&
      budgeted_formatted == o.budgeted_formatted &&
      budgeted_currency == o.budgeted_currency &&
      goal_target_formatted == o.goal_target_formatted &&
      goal_target_currency == o.goal_target_currency &&
      goal_under_funded_formatted == o.goal_under_funded_formatted &&
      goal_under_funded_currency == o.goal_under_funded_currency &&
      goal_overall_funded_formatted == o.goal_overall_funded_formatted &&
      goal_overall_funded_currency == o.goal_overall_funded_currency &&
      goal_overall_left_formatted == o.goal_overall_left_formatted &&
      goal_overall_left_currency == o.goal_overall_left_currency
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


525
526
527
# File 'lib/ynab/models/category.rb', line 525

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



531
532
533
# File 'lib/ynab/models/category.rb', line 531

def hash
  [id, category_group_id, category_group_name, name, hidden, original_category_group_id, note, budgeted, activity, balance, goal_type, goal_needs_whole_amount, goal_day, goal_cadence, goal_cadence_frequency, goal_creation_month, goal_target, goal_target_month, goal_target_date, goal_percentage_complete, goal_months_to_budget, goal_under_funded, goal_overall_funded, goal_overall_left, goal_snoozed_at, deleted, balance_formatted, balance_currency, activity_formatted, activity_currency, budgeted_formatted, budgeted_currency, goal_target_formatted, goal_target_currency, goal_under_funded_formatted, goal_under_funded_currency, goal_overall_funded_formatted, goal_overall_funded_currency, goal_overall_left_formatted, goal_overall_left_currency].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



449
450
451
452
# File 'lib/ynab/models/category.rb', line 449

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/ynab/models/category.rb', line 560

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

Returns:

  • (Boolean)

    true if the model is valid



456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/ynab/models/category.rb', line 456

def valid?
  return false if @id.nil?
  return false if @category_group_id.nil?
  return false if @name.nil?
  return false if @hidden.nil?
  return false if @budgeted.nil?
  return false if @activity.nil?
  return false if @balance.nil?
  goal_type_validator = EnumAttributeValidator.new('String', ["TB", "TBD", "MF", "NEED", "DEBT"])
  return false unless goal_type_validator.valid?(@goal_type)
  return false if @deleted.nil?
  true
end