ynab 3.8.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +3 -1
  4. data/README.md +48 -40
  5. data/Rakefile +1 -1
  6. data/docs/Account.md +3 -3
  7. data/docs/AccountsApi.md +12 -12
  8. data/docs/CategoriesApi.md +89 -25
  9. data/docs/Category.md +5 -3
  10. data/docs/CategoryGroupWithCategories.md +1 -1
  11. data/docs/ExistingCategory.md +12 -0
  12. data/docs/MoneyMovement.md +16 -0
  13. data/docs/MoneyMovementGroup.md +12 -0
  14. data/docs/MoneyMovementGroupsResponse.md +8 -0
  15. data/docs/MoneyMovementGroupsResponseData.md +9 -0
  16. data/docs/MoneyMovementsApi.md +89 -0
  17. data/docs/{BudgetSettingsResponse.md → MoneyMovementsResponse.md} +2 -2
  18. data/docs/MoneyMovementsResponseData.md +9 -0
  19. data/docs/MonthDetail.md +2 -2
  20. data/docs/MonthSummary.md +1 -1
  21. data/docs/MonthsApi.md +13 -13
  22. data/docs/NewCategory.md +12 -0
  23. data/docs/PatchCategoryGroupWrapper.md +8 -0
  24. data/docs/PatchCategoryWrapper.md +1 -1
  25. data/docs/PayeeLocationsApi.md +12 -12
  26. data/docs/PayeesApi.md +11 -11
  27. data/docs/{BudgetDetail.md → PlanDetail.md} +4 -4
  28. data/docs/PlanDetailResponse.md +8 -0
  29. data/docs/{BudgetDetailResponseData.md → PlanDetailResponseData.md} +2 -2
  30. data/docs/{BudgetSettings.md → PlanSettings.md} +1 -1
  31. data/docs/{BudgetDetailResponse.md → PlanSettingsResponse.md} +2 -2
  32. data/docs/PlanSettingsResponseData.md +8 -0
  33. data/docs/PlanSummary.md +15 -0
  34. data/docs/PlanSummaryResponse.md +8 -0
  35. data/docs/PlanSummaryResponseData.md +9 -0
  36. data/docs/PlansApi.md +68 -0
  37. data/docs/PostCategoryGroupWrapper.md +8 -0
  38. data/docs/PostCategoryWrapper.md +8 -0
  39. data/docs/SaveCategory.md +2 -1
  40. data/docs/SaveCategoryGroup.md +8 -0
  41. data/docs/SaveCategoryGroupResponse.md +8 -0
  42. data/docs/SaveCategoryGroupResponseData.md +9 -0
  43. data/docs/SaveMonthCategory.md +1 -1
  44. data/docs/ScheduledTransactionsApi.md +20 -20
  45. data/docs/TransactionResponseData.md +1 -0
  46. data/docs/TransactionsApi.md +48 -48
  47. data/docs/UserApi.md +2 -2
  48. data/examples/category-balance.rb +2 -2
  49. data/examples/create-multiple-transactions.rb +2 -2
  50. data/examples/create-transaction.rb +2 -2
  51. data/examples/{budget-list.rb → plan-list.rb} +6 -6
  52. data/examples/{budget-month.rb → plan-month.rb} +9 -10
  53. data/examples/update-category-budgeted.rb +2 -2
  54. data/examples/update-multiple-transactions.rb +3 -3
  55. data/lib/ynab/api/accounts_api.rb +33 -34
  56. data/lib/ynab/api/categories_api.rb +293 -66
  57. data/lib/ynab/api/deprecated_api.rb +11 -11
  58. data/lib/ynab/api/money_movements_api.rb +282 -0
  59. data/lib/ynab/api/months_api.rb +35 -36
  60. data/lib/ynab/api/payee_locations_api.rb +33 -34
  61. data/lib/ynab/api/payees_api.rb +31 -32
  62. data/lib/ynab/api/{budgets_api.rb → plans_api.rb} +54 -55
  63. data/lib/ynab/api/scheduled_transactions_api.rb +55 -56
  64. data/lib/ynab/api/transactions_api.rb +130 -131
  65. data/lib/ynab/api/user_api.rb +2 -3
  66. data/lib/ynab/api_client.rb +0 -2
  67. data/lib/ynab/api_model_base.rb +85 -0
  68. data/lib/ynab/models/account.rb +4 -81
  69. data/lib/ynab/models/account_response.rb +1 -75
  70. data/lib/ynab/models/account_response_data.rb +1 -75
  71. data/lib/ynab/models/accounts_response.rb +1 -75
  72. data/lib/ynab/models/accounts_response_data.rb +1 -75
  73. data/lib/ynab/models/bulk_response.rb +1 -75
  74. data/lib/ynab/models/bulk_response_data.rb +1 -75
  75. data/lib/ynab/models/bulk_response_data_bulk.rb +1 -75
  76. data/lib/ynab/models/bulk_transactions.rb +1 -75
  77. data/lib/ynab/models/categories_response.rb +1 -75
  78. data/lib/ynab/models/categories_response_data.rb +1 -75
  79. data/lib/ynab/models/category.rb +27 -79
  80. data/lib/ynab/models/category_group.rb +1 -75
  81. data/lib/ynab/models/category_group_with_categories.rb +2 -76
  82. data/lib/ynab/models/category_response.rb +1 -75
  83. data/lib/ynab/models/category_response_data.rb +1 -75
  84. data/lib/ynab/models/currency_format.rb +2 -76
  85. data/lib/ynab/models/date_format.rb +2 -76
  86. data/lib/ynab/models/error_detail.rb +1 -75
  87. data/lib/ynab/models/error_response.rb +1 -75
  88. data/lib/ynab/models/existing_category.rb +180 -0
  89. data/lib/ynab/models/existing_transaction.rb +1 -79
  90. data/lib/ynab/models/hybrid_transaction.rb +1 -85
  91. data/lib/ynab/models/hybrid_transactions_response.rb +1 -75
  92. data/lib/ynab/models/hybrid_transactions_response_data.rb +1 -75
  93. data/lib/ynab/models/money_movement.rb +223 -0
  94. data/lib/ynab/models/money_movement_group.rb +179 -0
  95. data/lib/ynab/models/{budget_summary_response.rb → money_movement_groups_response.rb} +4 -78
  96. data/lib/ynab/models/money_movement_groups_response_data.rb +149 -0
  97. data/lib/ynab/models/{budget_settings_response.rb → money_movements_response.rb} +4 -78
  98. data/lib/ynab/models/money_movements_response_data.rb +149 -0
  99. data/lib/ynab/models/month_detail.rb +3 -79
  100. data/lib/ynab/models/month_detail_response.rb +1 -75
  101. data/lib/ynab/models/month_detail_response_data.rb +1 -75
  102. data/lib/ynab/models/month_summaries_response.rb +1 -75
  103. data/lib/ynab/models/month_summaries_response_data.rb +1 -75
  104. data/lib/ynab/models/month_summary.rb +2 -76
  105. data/lib/ynab/models/new_category.rb +180 -0
  106. data/lib/ynab/models/new_transaction.rb +1 -79
  107. data/lib/ynab/models/patch_category_group_wrapper.rb +136 -0
  108. data/lib/ynab/models/patch_category_wrapper.rb +2 -76
  109. data/lib/ynab/models/patch_month_category_wrapper.rb +1 -75
  110. data/lib/ynab/models/patch_payee_wrapper.rb +1 -75
  111. data/lib/ynab/models/patch_transactions_wrapper.rb +1 -75
  112. data/lib/ynab/models/payee.rb +1 -75
  113. data/lib/ynab/models/payee_location.rb +1 -75
  114. data/lib/ynab/models/payee_location_response.rb +1 -75
  115. data/lib/ynab/models/payee_location_response_data.rb +1 -75
  116. data/lib/ynab/models/payee_locations_response.rb +1 -75
  117. data/lib/ynab/models/payee_locations_response_data.rb +1 -75
  118. data/lib/ynab/models/payee_response.rb +1 -75
  119. data/lib/ynab/models/payee_response_data.rb +1 -75
  120. data/lib/ynab/models/payees_response.rb +1 -75
  121. data/lib/ynab/models/payees_response_data.rb +1 -75
  122. data/lib/ynab/models/{budget_detail.rb → plan_detail.rb} +7 -83
  123. data/lib/ynab/models/plan_detail_response.rb +136 -0
  124. data/lib/ynab/models/{budget_detail_response_data.rb → plan_detail_response_data.rb} +4 -78
  125. data/lib/ynab/models/{budget_settings.rb → plan_settings.rb} +5 -79
  126. data/lib/ynab/models/{budget_detail_response.rb → plan_settings_response.rb} +4 -78
  127. data/lib/ynab/models/{budget_settings_response_data.rb → plan_settings_response_data.rb} +4 -78
  128. data/lib/ynab/models/{budget_summary.rb → plan_summary.rb} +7 -83
  129. data/lib/ynab/models/plan_summary_response.rb +136 -0
  130. data/lib/ynab/models/{budget_summary_response_data.rb → plan_summary_response_data.rb} +5 -79
  131. data/lib/ynab/models/post_account_wrapper.rb +1 -75
  132. data/lib/ynab/models/post_category_group_wrapper.rb +136 -0
  133. data/lib/ynab/models/post_category_wrapper.rb +136 -0
  134. data/lib/ynab/models/post_scheduled_transaction_wrapper.rb +1 -75
  135. data/lib/ynab/models/post_transactions_wrapper.rb +1 -75
  136. data/lib/ynab/models/put_scheduled_transaction_wrapper.rb +1 -75
  137. data/lib/ynab/models/put_transaction_wrapper.rb +1 -75
  138. data/lib/ynab/models/save_account.rb +1 -75
  139. data/lib/ynab/models/save_category.rb +18 -81
  140. data/lib/ynab/models/save_category_group.rb +148 -0
  141. data/lib/ynab/models/save_category_group_response.rb +136 -0
  142. data/lib/ynab/models/save_category_group_response_data.rb +147 -0
  143. data/lib/ynab/models/save_category_response.rb +1 -75
  144. data/lib/ynab/models/save_category_response_data.rb +1 -75
  145. data/lib/ynab/models/save_month_category.rb +2 -76
  146. data/lib/ynab/models/save_payee.rb +1 -75
  147. data/lib/ynab/models/save_payee_response.rb +1 -75
  148. data/lib/ynab/models/save_payee_response_data.rb +1 -75
  149. data/lib/ynab/models/save_scheduled_transaction.rb +1 -75
  150. data/lib/ynab/models/save_sub_transaction.rb +1 -75
  151. data/lib/ynab/models/save_transaction_with_id_or_import_id.rb +1 -79
  152. data/lib/ynab/models/save_transaction_with_optional_fields.rb +1 -75
  153. data/lib/ynab/models/save_transactions_response.rb +1 -75
  154. data/lib/ynab/models/save_transactions_response_data.rb +1 -75
  155. data/lib/ynab/models/scheduled_sub_transaction.rb +1 -75
  156. data/lib/ynab/models/scheduled_transaction_detail.rb +1 -80
  157. data/lib/ynab/models/scheduled_transaction_response.rb +1 -75
  158. data/lib/ynab/models/scheduled_transaction_response_data.rb +1 -75
  159. data/lib/ynab/models/scheduled_transaction_summary.rb +1 -75
  160. data/lib/ynab/models/scheduled_transactions_response.rb +1 -75
  161. data/lib/ynab/models/scheduled_transactions_response_data.rb +1 -75
  162. data/lib/ynab/models/sub_transaction.rb +1 -75
  163. data/lib/ynab/models/transaction_detail.rb +1 -85
  164. data/lib/ynab/models/transaction_flag_color.rb +2 -1
  165. data/lib/ynab/models/transaction_response.rb +1 -75
  166. data/lib/ynab/models/transaction_response_data.rb +16 -79
  167. data/lib/ynab/models/transaction_summary.rb +1 -75
  168. data/lib/ynab/models/transactions_import_response.rb +1 -75
  169. data/lib/ynab/models/transactions_import_response_data.rb +1 -75
  170. data/lib/ynab/models/transactions_response.rb +1 -75
  171. data/lib/ynab/models/transactions_response_data.rb +1 -75
  172. data/lib/ynab/models/user.rb +1 -75
  173. data/lib/ynab/models/user_response.rb +1 -75
  174. data/lib/ynab/models/user_response_data.rb +1 -75
  175. data/lib/ynab/overrides/transactions_api.rb +6 -6
  176. data/lib/ynab/version.rb +1 -1
  177. data/lib/ynab.rb +28 -13
  178. data/open_api_spec.yaml +1163 -905
  179. data/spec/api/accounts_spec.rb +9 -9
  180. data/spec/api/categories_spec.rb +9 -9
  181. data/spec/api/months_spec.rb +7 -7
  182. data/spec/api/payee_locations_spec.rb +7 -7
  183. data/spec/api/payees_spec.rb +7 -7
  184. data/spec/api/{budgets_spec.rb → plans_spec.rb} +12 -12
  185. data/spec/api/scheduled_transactions_spec.rb +9 -9
  186. data/spec/api/transactions_spec.rb +28 -28
  187. data/spec/fixtures/vcr_cassettes/plans.yml +49 -0
  188. data/spec/fixtures/vcr_cassettes/plans_unauthorized.yml +49 -0
  189. data/templates/gem.mustache +3 -2
  190. data/templates/partial_model_generic.mustache +1 -1
  191. data/ynab.gemspec +1 -2
  192. metadata +94 -59
  193. data/docs/BudgetSettingsResponseData.md +0 -8
  194. data/docs/BudgetSummary.md +0 -15
  195. data/docs/BudgetSummaryResponse.md +0 -8
  196. data/docs/BudgetSummaryResponseData.md +0 -9
  197. data/docs/BudgetsApi.md +0 -68
@@ -4,7 +4,6 @@
4
4
  #Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
5
5
 
6
6
  Generated by: OpenAPI Generator (https://openapi-generator.tech)
7
-
8
7
  =end
9
8
 
10
9
  require 'cgi'
@@ -16,7 +15,7 @@ module YNAB
16
15
  def initialize(api_client = ApiClient.default)
17
16
  @api_client = api_client
18
17
  end
19
- # User info
18
+ # Get user
20
19
  # Returns authenticated user information
21
20
  # @param [Hash] opts the optional parameters
22
21
  # @return [UserResponse]
@@ -25,7 +24,7 @@ module YNAB
25
24
  data
26
25
  end
27
26
 
28
- # User info
27
+ # Get user
29
28
  # Returns authenticated user information
30
29
  # @param [Hash] opts the optional parameters
31
30
  # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers
@@ -4,7 +4,6 @@
4
4
  #Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
5
5
 
6
6
  Generated by: OpenAPI Generator (https://openapi-generator.tech)
7
-
8
7
  =end
9
8
 
10
9
  require 'date'
@@ -195,7 +194,6 @@ module YNAB
195
194
  end
196
195
  end
197
196
  end
198
-
199
197
  # Check if the given MIME is a JSON MIME.
200
198
  # JSON MIME examples:
201
199
  # application/json
@@ -0,0 +1,85 @@
1
+ =begin
2
+ #YNAB API Endpoints
3
+
4
+ #Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
5
+
6
+ Generated by: OpenAPI Generator (https://openapi-generator.tech)
7
+
8
+ =end
9
+
10
+ module YNAB
11
+ class ApiModelBase
12
+ # Deserializes the data based on type
13
+ # @param string type Data type
14
+ # @param string value Value to be deserialized
15
+ # @return [Object] Deserialized data
16
+ def self._deserialize(type, value)
17
+ case type.to_sym
18
+ when :Time
19
+ Time.parse(value)
20
+ when :Date
21
+ Date.parse(value)
22
+ when :String
23
+ value.to_s
24
+ when :Integer
25
+ value.to_i
26
+ when :Float
27
+ value.to_f
28
+ when :Boolean
29
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
30
+ true
31
+ else
32
+ false
33
+ end
34
+ when :Object
35
+ # generic object (usually a Hash), return directly
36
+ value
37
+ when /\AArray<(?<inner_type>.+)>\z/
38
+ inner_type = Regexp.last_match[:inner_type]
39
+ value.map { |v| _deserialize(inner_type, v) }
40
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
41
+ k_type = Regexp.last_match[:k_type]
42
+ v_type = Regexp.last_match[:v_type]
43
+ {}.tap do |hash|
44
+ value.each do |k, v|
45
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
46
+ end
47
+ end
48
+ else # model
49
+ # models (e.g. Pet) or oneOf
50
+ klass = YNAB.const_get(type)
51
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
52
+ end
53
+ end
54
+
55
+ # Returns the string representation of the object
56
+ # @return [String] String presentation of the object
57
+ def to_s
58
+ to_hash.to_s
59
+ end
60
+
61
+ # to_body is an alias to to_hash (backward compatibility)
62
+ # @return [Hash] Returns the object in the form of hash
63
+ def to_body
64
+ to_hash
65
+ end
66
+
67
+ # Outputs non-array value in the form of hash
68
+ # For object, use to_hash. Otherwise, just return the value
69
+ # @param [Object] value Any valid value
70
+ # @return [Hash] Returns the value in the form of hash
71
+ def _to_hash(value)
72
+ if value.is_a?(Array)
73
+ value.compact.map { |v| _to_hash(v) }
74
+ elsif value.is_a?(Hash)
75
+ {}.tap do |hash|
76
+ value.each { |k, v| hash[k] = _to_hash(v) }
77
+ end
78
+ elsif value.respond_to? :to_hash
79
+ value.to_hash
80
+ else
81
+ value
82
+ end
83
+ end
84
+ end
85
+ end
@@ -11,14 +11,14 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module YNAB
14
- class Account
14
+ class Account < ApiModelBase
15
15
  attr_accessor :id
16
16
 
17
17
  attr_accessor :name
18
18
 
19
19
  attr_accessor :type
20
20
 
21
- # Whether this account is on budget or not
21
+ # Whether this account is \"on budget\" or not
22
22
  attr_accessor :on_budget
23
23
 
24
24
  # Whether this account is closed or not
@@ -26,7 +26,7 @@ module YNAB
26
26
 
27
27
  attr_accessor :note
28
28
 
29
- # The current balance of the account in milliunits format
29
+ # The current available balance of the account in milliunits format
30
30
  attr_accessor :balance
31
31
 
32
32
  # The current cleared balance of the account in milliunits format
@@ -47,7 +47,7 @@ module YNAB
47
47
  # A date/time specifying when the account was last reconciled.
48
48
  attr_accessor :last_reconciled_at
49
49
 
50
- # The original debt/loan account balance, specified in milliunits format.
50
+ # This field is deprecated and will always be null.
51
51
  attr_accessor :debt_original_balance
52
52
 
53
53
  attr_accessor :debt_interest_rates
@@ -141,9 +141,6 @@ module YNAB
141
141
  :'transfer_payee_id',
142
142
  :'last_reconciled_at',
143
143
  :'debt_original_balance',
144
- :'debt_interest_rates',
145
- :'debt_minimum_payments',
146
- :'debt_escrow_amounts',
147
144
  ])
148
145
  end
149
146
 
@@ -323,61 +320,6 @@ module YNAB
323
320
  new(transformed_hash)
324
321
  end
325
322
 
326
- # Deserializes the data based on type
327
- # @param string type Data type
328
- # @param string value Value to be deserialized
329
- # @return [Object] Deserialized data
330
- def self._deserialize(type, value)
331
- case type.to_sym
332
- when :Time
333
- Time.parse(value)
334
- when :Date
335
- Date.parse(value)
336
- when :String
337
- value.to_s
338
- when :Integer
339
- value.to_i
340
- when :Float
341
- value.to_f
342
- when :Boolean
343
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
344
- true
345
- else
346
- false
347
- end
348
- when :Object
349
- # generic object (usually a Hash), return directly
350
- value
351
- when /\AArray<(?<inner_type>.+)>\z/
352
- inner_type = Regexp.last_match[:inner_type]
353
- value.map { |v| _deserialize(inner_type, v) }
354
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
355
- k_type = Regexp.last_match[:k_type]
356
- v_type = Regexp.last_match[:v_type]
357
- {}.tap do |hash|
358
- value.each do |k, v|
359
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
360
- end
361
- end
362
- else # model
363
- # models (e.g. Pet) or oneOf
364
- klass = YNAB.const_get(type)
365
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
366
- end
367
- end
368
-
369
- # Returns the string representation of the object
370
- # @return [String] String presentation of the object
371
- def to_s
372
- to_hash.to_s
373
- end
374
-
375
- # to_body is an alias to to_hash (backward compatibility)
376
- # @return [Hash] Returns the object in the form of hash
377
- def to_body
378
- to_hash
379
- end
380
-
381
323
  # Returns the object in the form of hash
382
324
  # @return [Hash] Returns the object in the form of hash
383
325
  def to_hash
@@ -393,25 +335,6 @@ module YNAB
393
335
  end
394
336
  hash
395
337
  end
396
-
397
- # Outputs non-array value in the form of hash
398
- # For object, use to_hash. Otherwise, just return the value
399
- # @param [Object] value Any valid value
400
- # @return [Hash] Returns the value in the form of hash
401
- def _to_hash(value)
402
- if value.is_a?(Array)
403
- value.compact.map { |v| _to_hash(v) }
404
- elsif value.is_a?(Hash)
405
- {}.tap do |hash|
406
- value.each { |k, v| hash[k] = _to_hash(v) }
407
- end
408
- elsif value.respond_to? :to_hash
409
- value.to_hash
410
- else
411
- value
412
- end
413
- end
414
-
415
338
  end
416
339
 
417
340
  end
@@ -11,7 +11,7 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module YNAB
14
- class AccountResponse
14
+ class AccountResponse < ApiModelBase
15
15
  attr_accessor :data
16
16
 
17
17
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -116,61 +116,6 @@ module YNAB
116
116
  new(transformed_hash)
117
117
  end
118
118
 
119
- # Deserializes the data based on type
120
- # @param string type Data type
121
- # @param string value Value to be deserialized
122
- # @return [Object] Deserialized data
123
- def self._deserialize(type, value)
124
- case type.to_sym
125
- when :Time
126
- Time.parse(value)
127
- when :Date
128
- Date.parse(value)
129
- when :String
130
- value.to_s
131
- when :Integer
132
- value.to_i
133
- when :Float
134
- value.to_f
135
- when :Boolean
136
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
- true
138
- else
139
- false
140
- end
141
- when :Object
142
- # generic object (usually a Hash), return directly
143
- value
144
- when /\AArray<(?<inner_type>.+)>\z/
145
- inner_type = Regexp.last_match[:inner_type]
146
- value.map { |v| _deserialize(inner_type, v) }
147
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
- k_type = Regexp.last_match[:k_type]
149
- v_type = Regexp.last_match[:v_type]
150
- {}.tap do |hash|
151
- value.each do |k, v|
152
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
- end
154
- end
155
- else # model
156
- # models (e.g. Pet) or oneOf
157
- klass = YNAB.const_get(type)
158
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
159
- end
160
- end
161
-
162
- # Returns the string representation of the object
163
- # @return [String] String presentation of the object
164
- def to_s
165
- to_hash.to_s
166
- end
167
-
168
- # to_body is an alias to to_hash (backward compatibility)
169
- # @return [Hash] Returns the object in the form of hash
170
- def to_body
171
- to_hash
172
- end
173
-
174
119
  # Returns the object in the form of hash
175
120
  # @return [Hash] Returns the object in the form of hash
176
121
  def to_hash
@@ -186,25 +131,6 @@ module YNAB
186
131
  end
187
132
  hash
188
133
  end
189
-
190
- # Outputs non-array value in the form of hash
191
- # For object, use to_hash. Otherwise, just return the value
192
- # @param [Object] value Any valid value
193
- # @return [Hash] Returns the value in the form of hash
194
- def _to_hash(value)
195
- if value.is_a?(Array)
196
- value.compact.map { |v| _to_hash(v) }
197
- elsif value.is_a?(Hash)
198
- {}.tap do |hash|
199
- value.each { |k, v| hash[k] = _to_hash(v) }
200
- end
201
- elsif value.respond_to? :to_hash
202
- value.to_hash
203
- else
204
- value
205
- end
206
- end
207
-
208
134
  end
209
135
 
210
136
  end
@@ -11,7 +11,7 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module YNAB
14
- class AccountResponseData
14
+ class AccountResponseData < ApiModelBase
15
15
  attr_accessor :account
16
16
 
17
17
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -116,61 +116,6 @@ module YNAB
116
116
  new(transformed_hash)
117
117
  end
118
118
 
119
- # Deserializes the data based on type
120
- # @param string type Data type
121
- # @param string value Value to be deserialized
122
- # @return [Object] Deserialized data
123
- def self._deserialize(type, value)
124
- case type.to_sym
125
- when :Time
126
- Time.parse(value)
127
- when :Date
128
- Date.parse(value)
129
- when :String
130
- value.to_s
131
- when :Integer
132
- value.to_i
133
- when :Float
134
- value.to_f
135
- when :Boolean
136
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
- true
138
- else
139
- false
140
- end
141
- when :Object
142
- # generic object (usually a Hash), return directly
143
- value
144
- when /\AArray<(?<inner_type>.+)>\z/
145
- inner_type = Regexp.last_match[:inner_type]
146
- value.map { |v| _deserialize(inner_type, v) }
147
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
- k_type = Regexp.last_match[:k_type]
149
- v_type = Regexp.last_match[:v_type]
150
- {}.tap do |hash|
151
- value.each do |k, v|
152
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
- end
154
- end
155
- else # model
156
- # models (e.g. Pet) or oneOf
157
- klass = YNAB.const_get(type)
158
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
159
- end
160
- end
161
-
162
- # Returns the string representation of the object
163
- # @return [String] String presentation of the object
164
- def to_s
165
- to_hash.to_s
166
- end
167
-
168
- # to_body is an alias to to_hash (backward compatibility)
169
- # @return [Hash] Returns the object in the form of hash
170
- def to_body
171
- to_hash
172
- end
173
-
174
119
  # Returns the object in the form of hash
175
120
  # @return [Hash] Returns the object in the form of hash
176
121
  def to_hash
@@ -186,25 +131,6 @@ module YNAB
186
131
  end
187
132
  hash
188
133
  end
189
-
190
- # Outputs non-array value in the form of hash
191
- # For object, use to_hash. Otherwise, just return the value
192
- # @param [Object] value Any valid value
193
- # @return [Hash] Returns the value in the form of hash
194
- def _to_hash(value)
195
- if value.is_a?(Array)
196
- value.compact.map { |v| _to_hash(v) }
197
- elsif value.is_a?(Hash)
198
- {}.tap do |hash|
199
- value.each { |k, v| hash[k] = _to_hash(v) }
200
- end
201
- elsif value.respond_to? :to_hash
202
- value.to_hash
203
- else
204
- value
205
- end
206
- end
207
-
208
134
  end
209
135
 
210
136
  end
@@ -11,7 +11,7 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module YNAB
14
- class AccountsResponse
14
+ class AccountsResponse < ApiModelBase
15
15
  attr_accessor :data
16
16
 
17
17
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -116,61 +116,6 @@ module YNAB
116
116
  new(transformed_hash)
117
117
  end
118
118
 
119
- # Deserializes the data based on type
120
- # @param string type Data type
121
- # @param string value Value to be deserialized
122
- # @return [Object] Deserialized data
123
- def self._deserialize(type, value)
124
- case type.to_sym
125
- when :Time
126
- Time.parse(value)
127
- when :Date
128
- Date.parse(value)
129
- when :String
130
- value.to_s
131
- when :Integer
132
- value.to_i
133
- when :Float
134
- value.to_f
135
- when :Boolean
136
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
- true
138
- else
139
- false
140
- end
141
- when :Object
142
- # generic object (usually a Hash), return directly
143
- value
144
- when /\AArray<(?<inner_type>.+)>\z/
145
- inner_type = Regexp.last_match[:inner_type]
146
- value.map { |v| _deserialize(inner_type, v) }
147
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
- k_type = Regexp.last_match[:k_type]
149
- v_type = Regexp.last_match[:v_type]
150
- {}.tap do |hash|
151
- value.each do |k, v|
152
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
- end
154
- end
155
- else # model
156
- # models (e.g. Pet) or oneOf
157
- klass = YNAB.const_get(type)
158
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
159
- end
160
- end
161
-
162
- # Returns the string representation of the object
163
- # @return [String] String presentation of the object
164
- def to_s
165
- to_hash.to_s
166
- end
167
-
168
- # to_body is an alias to to_hash (backward compatibility)
169
- # @return [Hash] Returns the object in the form of hash
170
- def to_body
171
- to_hash
172
- end
173
-
174
119
  # Returns the object in the form of hash
175
120
  # @return [Hash] Returns the object in the form of hash
176
121
  def to_hash
@@ -186,25 +131,6 @@ module YNAB
186
131
  end
187
132
  hash
188
133
  end
189
-
190
- # Outputs non-array value in the form of hash
191
- # For object, use to_hash. Otherwise, just return the value
192
- # @param [Object] value Any valid value
193
- # @return [Hash] Returns the value in the form of hash
194
- def _to_hash(value)
195
- if value.is_a?(Array)
196
- value.compact.map { |v| _to_hash(v) }
197
- elsif value.is_a?(Hash)
198
- {}.tap do |hash|
199
- value.each { |k, v| hash[k] = _to_hash(v) }
200
- end
201
- elsif value.respond_to? :to_hash
202
- value.to_hash
203
- else
204
- value
205
- end
206
- end
207
-
208
134
  end
209
135
 
210
136
  end
@@ -11,7 +11,7 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module YNAB
14
- class AccountsResponseData
14
+ class AccountsResponseData < ApiModelBase
15
15
  attr_accessor :accounts
16
16
 
17
17
  # The knowledge of the server
@@ -129,61 +129,6 @@ module YNAB
129
129
  new(transformed_hash)
130
130
  end
131
131
 
132
- # Deserializes the data based on type
133
- # @param string type Data type
134
- # @param string value Value to be deserialized
135
- # @return [Object] Deserialized data
136
- def self._deserialize(type, value)
137
- case type.to_sym
138
- when :Time
139
- Time.parse(value)
140
- when :Date
141
- Date.parse(value)
142
- when :String
143
- value.to_s
144
- when :Integer
145
- value.to_i
146
- when :Float
147
- value.to_f
148
- when :Boolean
149
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
- true
151
- else
152
- false
153
- end
154
- when :Object
155
- # generic object (usually a Hash), return directly
156
- value
157
- when /\AArray<(?<inner_type>.+)>\z/
158
- inner_type = Regexp.last_match[:inner_type]
159
- value.map { |v| _deserialize(inner_type, v) }
160
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
- k_type = Regexp.last_match[:k_type]
162
- v_type = Regexp.last_match[:v_type]
163
- {}.tap do |hash|
164
- value.each do |k, v|
165
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
- end
167
- end
168
- else # model
169
- # models (e.g. Pet) or oneOf
170
- klass = YNAB.const_get(type)
171
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
- end
173
- end
174
-
175
- # Returns the string representation of the object
176
- # @return [String] String presentation of the object
177
- def to_s
178
- to_hash.to_s
179
- end
180
-
181
- # to_body is an alias to to_hash (backward compatibility)
182
- # @return [Hash] Returns the object in the form of hash
183
- def to_body
184
- to_hash
185
- end
186
-
187
132
  # Returns the object in the form of hash
188
133
  # @return [Hash] Returns the object in the form of hash
189
134
  def to_hash
@@ -199,25 +144,6 @@ module YNAB
199
144
  end
200
145
  hash
201
146
  end
202
-
203
- # Outputs non-array value in the form of hash
204
- # For object, use to_hash. Otherwise, just return the value
205
- # @param [Object] value Any valid value
206
- # @return [Hash] Returns the value in the form of hash
207
- def _to_hash(value)
208
- if value.is_a?(Array)
209
- value.compact.map { |v| _to_hash(v) }
210
- elsif value.is_a?(Hash)
211
- {}.tap do |hash|
212
- value.each { |k, v| hash[k] = _to_hash(v) }
213
- end
214
- elsif value.respond_to? :to_hash
215
- value.to_hash
216
- else
217
- value
218
- end
219
- end
220
-
221
147
  end
222
148
 
223
149
  end