ynab 3.9.0 → 5.0.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 (232) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +4 -2
  4. data/README.md +47 -39
  5. data/Rakefile +3 -3
  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 +4 -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/TransactionsApi.md +48 -48
  46. data/docs/UserApi.md +2 -2
  47. data/examples/category-balance.rb +2 -2
  48. data/examples/create-multiple-transactions.rb +2 -2
  49. data/examples/create-transaction.rb +2 -2
  50. data/examples/{budget-list.rb → plan-list.rb} +6 -6
  51. data/examples/{budget-month.rb → plan-month.rb} +9 -10
  52. data/examples/update-category-budgeted.rb +2 -2
  53. data/examples/update-multiple-transactions.rb +3 -3
  54. data/lib/ynab/api/accounts_api.rb +33 -34
  55. data/lib/ynab/api/categories_api.rb +293 -66
  56. data/lib/ynab/api/deprecated_api.rb +11 -11
  57. data/lib/ynab/api/money_movements_api.rb +282 -0
  58. data/lib/ynab/api/months_api.rb +35 -36
  59. data/lib/ynab/api/payee_locations_api.rb +33 -34
  60. data/lib/ynab/api/payees_api.rb +31 -32
  61. data/lib/ynab/api/{budgets_api.rb → plans_api.rb} +55 -56
  62. data/lib/ynab/api/scheduled_transactions_api.rb +55 -56
  63. data/lib/ynab/api/transactions_api.rb +130 -131
  64. data/lib/ynab/api/user_api.rb +2 -3
  65. data/lib/ynab/api_client.rb +0 -2
  66. data/lib/ynab/api_model_base.rb +85 -0
  67. data/lib/ynab/models/account.rb +4 -81
  68. data/lib/ynab/models/account_response.rb +1 -75
  69. data/lib/ynab/models/account_response_data.rb +1 -75
  70. data/lib/ynab/models/accounts_response.rb +1 -75
  71. data/lib/ynab/models/accounts_response_data.rb +1 -75
  72. data/lib/ynab/models/bulk_response.rb +1 -75
  73. data/lib/ynab/models/bulk_response_data.rb +1 -75
  74. data/lib/ynab/models/bulk_response_data_bulk.rb +1 -75
  75. data/lib/ynab/models/bulk_transactions.rb +1 -75
  76. data/lib/ynab/models/categories_response.rb +1 -75
  77. data/lib/ynab/models/categories_response_data.rb +1 -75
  78. data/lib/ynab/models/category.rb +16 -79
  79. data/lib/ynab/models/category_group.rb +1 -75
  80. data/lib/ynab/models/category_group_with_categories.rb +2 -76
  81. data/lib/ynab/models/category_response.rb +1 -75
  82. data/lib/ynab/models/category_response_data.rb +1 -75
  83. data/lib/ynab/models/currency_format.rb +2 -76
  84. data/lib/ynab/models/date_format.rb +2 -76
  85. data/lib/ynab/models/error_detail.rb +1 -75
  86. data/lib/ynab/models/error_response.rb +1 -75
  87. data/lib/ynab/models/existing_category.rb +180 -0
  88. data/lib/ynab/models/existing_transaction.rb +1 -79
  89. data/lib/ynab/models/hybrid_transaction.rb +1 -85
  90. data/lib/ynab/models/hybrid_transactions_response.rb +1 -75
  91. data/lib/ynab/models/hybrid_transactions_response_data.rb +1 -75
  92. data/lib/ynab/models/{budget_summary_response_data.rb → money_movement.rb} +95 -93
  93. data/lib/ynab/models/money_movement_group.rb +179 -0
  94. data/lib/ynab/models/{budget_summary_response.rb → money_movement_groups_response.rb} +4 -78
  95. data/lib/ynab/models/money_movement_groups_response_data.rb +149 -0
  96. data/lib/ynab/models/{budget_settings_response.rb → money_movements_response.rb} +4 -78
  97. data/lib/ynab/models/{budget_detail_response_data.rb → money_movements_response_data.rb} +13 -85
  98. data/lib/ynab/models/month_detail.rb +3 -79
  99. data/lib/ynab/models/month_detail_response.rb +1 -75
  100. data/lib/ynab/models/month_detail_response_data.rb +1 -75
  101. data/lib/ynab/models/month_summaries_response.rb +1 -75
  102. data/lib/ynab/models/month_summaries_response_data.rb +1 -75
  103. data/lib/ynab/models/month_summary.rb +2 -76
  104. data/lib/ynab/models/new_category.rb +180 -0
  105. data/lib/ynab/models/new_transaction.rb +1 -79
  106. data/lib/ynab/models/patch_category_group_wrapper.rb +136 -0
  107. data/lib/ynab/models/patch_category_wrapper.rb +2 -76
  108. data/lib/ynab/models/patch_month_category_wrapper.rb +1 -75
  109. data/lib/ynab/models/patch_payee_wrapper.rb +1 -75
  110. data/lib/ynab/models/patch_transactions_wrapper.rb +1 -75
  111. data/lib/ynab/models/payee.rb +1 -75
  112. data/lib/ynab/models/payee_location.rb +1 -75
  113. data/lib/ynab/models/payee_location_response.rb +1 -75
  114. data/lib/ynab/models/payee_location_response_data.rb +1 -75
  115. data/lib/ynab/models/payee_locations_response.rb +1 -75
  116. data/lib/ynab/models/payee_locations_response_data.rb +1 -75
  117. data/lib/ynab/models/payee_response.rb +1 -75
  118. data/lib/ynab/models/payee_response_data.rb +1 -75
  119. data/lib/ynab/models/payees_response.rb +1 -75
  120. data/lib/ynab/models/payees_response_data.rb +1 -75
  121. data/lib/ynab/models/{budget_detail.rb → plan_detail.rb} +7 -83
  122. data/lib/ynab/models/plan_detail_response.rb +136 -0
  123. data/lib/ynab/models/plan_detail_response_data.rb +147 -0
  124. data/lib/ynab/models/{budget_settings.rb → plan_settings.rb} +5 -79
  125. data/lib/ynab/models/{budget_detail_response.rb → plan_settings_response.rb} +4 -78
  126. data/lib/ynab/models/{budget_settings_response_data.rb → plan_settings_response_data.rb} +4 -78
  127. data/lib/ynab/models/{budget_summary.rb → plan_summary.rb} +7 -83
  128. data/lib/ynab/models/plan_summary_response.rb +136 -0
  129. data/lib/ynab/models/plan_summary_response_data.rb +147 -0
  130. data/lib/ynab/models/post_account_wrapper.rb +1 -75
  131. data/lib/ynab/models/post_category_group_wrapper.rb +136 -0
  132. data/lib/ynab/models/post_category_wrapper.rb +136 -0
  133. data/lib/ynab/models/post_scheduled_transaction_wrapper.rb +1 -75
  134. data/lib/ynab/models/post_transactions_wrapper.rb +1 -75
  135. data/lib/ynab/models/put_scheduled_transaction_wrapper.rb +1 -75
  136. data/lib/ynab/models/put_transaction_wrapper.rb +1 -75
  137. data/lib/ynab/models/save_account.rb +1 -75
  138. data/lib/ynab/models/save_category.rb +18 -81
  139. data/lib/ynab/models/save_category_group.rb +148 -0
  140. data/lib/ynab/models/save_category_group_response.rb +136 -0
  141. data/lib/ynab/models/save_category_group_response_data.rb +147 -0
  142. data/lib/ynab/models/save_category_response.rb +1 -75
  143. data/lib/ynab/models/save_category_response_data.rb +1 -75
  144. data/lib/ynab/models/save_month_category.rb +2 -76
  145. data/lib/ynab/models/save_payee.rb +1 -75
  146. data/lib/ynab/models/save_payee_response.rb +1 -75
  147. data/lib/ynab/models/save_payee_response_data.rb +1 -75
  148. data/lib/ynab/models/save_scheduled_transaction.rb +1 -75
  149. data/lib/ynab/models/save_sub_transaction.rb +1 -75
  150. data/lib/ynab/models/save_transaction_with_id_or_import_id.rb +1 -79
  151. data/lib/ynab/models/save_transaction_with_optional_fields.rb +1 -75
  152. data/lib/ynab/models/save_transactions_response.rb +1 -75
  153. data/lib/ynab/models/save_transactions_response_data.rb +1 -75
  154. data/lib/ynab/models/scheduled_sub_transaction.rb +1 -75
  155. data/lib/ynab/models/scheduled_transaction_detail.rb +1 -80
  156. data/lib/ynab/models/scheduled_transaction_response.rb +1 -75
  157. data/lib/ynab/models/scheduled_transaction_response_data.rb +1 -75
  158. data/lib/ynab/models/scheduled_transaction_summary.rb +1 -75
  159. data/lib/ynab/models/scheduled_transactions_response.rb +1 -75
  160. data/lib/ynab/models/scheduled_transactions_response_data.rb +1 -75
  161. data/lib/ynab/models/sub_transaction.rb +1 -75
  162. data/lib/ynab/models/transaction_detail.rb +1 -85
  163. data/lib/ynab/models/transaction_response.rb +1 -75
  164. data/lib/ynab/models/transaction_response_data.rb +1 -75
  165. data/lib/ynab/models/transaction_summary.rb +1 -75
  166. data/lib/ynab/models/transactions_import_response.rb +1 -75
  167. data/lib/ynab/models/transactions_import_response_data.rb +1 -75
  168. data/lib/ynab/models/transactions_response.rb +1 -75
  169. data/lib/ynab/models/transactions_response_data.rb +1 -75
  170. data/lib/ynab/models/user.rb +1 -75
  171. data/lib/ynab/models/user_response.rb +1 -75
  172. data/lib/ynab/models/user_response_data.rb +1 -75
  173. data/lib/ynab/overrides/transactions_api.rb +6 -6
  174. data/lib/ynab/version.rb +1 -1
  175. data/lib/ynab.rb +28 -13
  176. data/open_api_spec.yaml +1161 -916
  177. data/spec/api/accounts_spec.rb +9 -9
  178. data/spec/api/categories_spec.rb +9 -9
  179. data/spec/api/months_spec.rb +7 -7
  180. data/spec/api/payee_locations_spec.rb +7 -7
  181. data/spec/api/payees_spec.rb +7 -7
  182. data/spec/api/plans_spec.rb +55 -0
  183. data/spec/api/scheduled_transactions_spec.rb +9 -9
  184. data/spec/api/transactions_spec.rb +27 -27
  185. data/spec/fixtures/vcr_cassettes/account.yml +2 -2
  186. data/spec/fixtures/vcr_cassettes/accounts.yml +2 -2
  187. data/spec/fixtures/vcr_cassettes/accounts_unauthorized.yml +2 -2
  188. data/spec/fixtures/vcr_cassettes/bulk_transactions.yml +2 -2
  189. data/spec/fixtures/vcr_cassettes/categories.yml +2 -2
  190. data/spec/fixtures/vcr_cassettes/categories_unauthorized.yml +2 -2
  191. data/spec/fixtures/vcr_cassettes/category.yml +2 -2
  192. data/spec/fixtures/vcr_cassettes/category_transactions.yml +2 -2
  193. data/spec/fixtures/vcr_cassettes/create_account.yml +2 -2
  194. data/spec/fixtures/vcr_cassettes/create_scheduled_transaction.yml +2 -2
  195. data/spec/fixtures/vcr_cassettes/create_transaction.yml +2 -2
  196. data/spec/fixtures/vcr_cassettes/create_transactions.yml +2 -2
  197. data/spec/fixtures/vcr_cassettes/import_transactions.yml +2 -2
  198. data/spec/fixtures/vcr_cassettes/month.yml +2 -2
  199. data/spec/fixtures/vcr_cassettes/month_transactions.yml +2 -2
  200. data/spec/fixtures/vcr_cassettes/months.yml +2 -2
  201. data/spec/fixtures/vcr_cassettes/months_unauthorized.yml +2 -2
  202. data/spec/fixtures/vcr_cassettes/multiple_transactions.yml +2 -2
  203. data/spec/fixtures/vcr_cassettes/patch_month_category.yml +2 -2
  204. data/spec/fixtures/vcr_cassettes/payee.yml +2 -2
  205. data/spec/fixtures/vcr_cassettes/payee_location.yml +2 -2
  206. data/spec/fixtures/vcr_cassettes/payee_locations.yml +2 -2
  207. data/spec/fixtures/vcr_cassettes/payee_locations_unauthorized.yml +2 -2
  208. data/spec/fixtures/vcr_cassettes/payee_transactions.yml +2 -2
  209. data/spec/fixtures/vcr_cassettes/payees.yml +2 -2
  210. data/spec/fixtures/vcr_cassettes/payees_unauthorized.yml +2 -2
  211. data/spec/fixtures/vcr_cassettes/{budget.yml → plan.yml} +3 -3
  212. data/spec/fixtures/vcr_cassettes/{budgets.yml → plans.yml} +3 -3
  213. data/spec/fixtures/vcr_cassettes/{budgets_unauthorized.yml → plans_unauthorized.yml} +3 -3
  214. data/spec/fixtures/vcr_cassettes/scheduled_transaction.yml +2 -2
  215. data/spec/fixtures/vcr_cassettes/scheduled_transactions.yml +2 -2
  216. data/spec/fixtures/vcr_cassettes/scheduled_transactions_unauthorized.yml +2 -2
  217. data/spec/fixtures/vcr_cassettes/transaction.yml +2 -2
  218. data/spec/fixtures/vcr_cassettes/transactions.yml +2 -2
  219. data/spec/fixtures/vcr_cassettes/transactions_invalid_flags.yml +2 -2
  220. data/spec/fixtures/vcr_cassettes/transactions_unauthorized.yml +2 -2
  221. data/spec/fixtures/vcr_cassettes/update_transaction.yml +2 -2
  222. data/spec/fixtures/vcr_cassettes/update_transactions.yml +2 -2
  223. data/templates/gem.mustache +3 -2
  224. data/templates/partial_model_generic.mustache +1 -1
  225. data/ynab.gemspec +1 -2
  226. metadata +64 -33
  227. data/docs/BudgetSettingsResponseData.md +0 -8
  228. data/docs/BudgetSummary.md +0 -15
  229. data/docs/BudgetSummaryResponse.md +0 -8
  230. data/docs/BudgetSummaryResponseData.md +0 -9
  231. data/docs/BudgetsApi.md +0 -68
  232. data/spec/api/budgets_spec.rb +0 -55
@@ -11,7 +11,7 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module YNAB
14
- class MonthDetailResponse
14
+ class MonthDetailResponse < 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 MonthDetailResponseData
14
+ class MonthDetailResponseData < ApiModelBase
15
15
  attr_accessor :month
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 MonthSummariesResponse
14
+ class MonthSummariesResponse < 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 MonthSummariesResponseData
14
+ class MonthSummariesResponseData < ApiModelBase
15
15
  attr_accessor :months
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
@@ -11,7 +11,7 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module YNAB
14
- class MonthSummary
14
+ class MonthSummary < ApiModelBase
15
15
  attr_accessor :month
16
16
 
17
17
  attr_accessor :note
@@ -19,7 +19,7 @@ module YNAB
19
19
  # The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month
20
20
  attr_accessor :income
21
21
 
22
- # The total amount budgeted in the month
22
+ # The total amount assigned (budgeted) in the month
23
23
  attr_accessor :budgeted
24
24
 
25
25
  # The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign'
@@ -192,61 +192,6 @@ module YNAB
192
192
  new(transformed_hash)
193
193
  end
194
194
 
195
- # Deserializes the data based on type
196
- # @param string type Data type
197
- # @param string value Value to be deserialized
198
- # @return [Object] Deserialized data
199
- def self._deserialize(type, value)
200
- case type.to_sym
201
- when :Time
202
- Time.parse(value)
203
- when :Date
204
- Date.parse(value)
205
- when :String
206
- value.to_s
207
- when :Integer
208
- value.to_i
209
- when :Float
210
- value.to_f
211
- when :Boolean
212
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
213
- true
214
- else
215
- false
216
- end
217
- when :Object
218
- # generic object (usually a Hash), return directly
219
- value
220
- when /\AArray<(?<inner_type>.+)>\z/
221
- inner_type = Regexp.last_match[:inner_type]
222
- value.map { |v| _deserialize(inner_type, v) }
223
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
224
- k_type = Regexp.last_match[:k_type]
225
- v_type = Regexp.last_match[:v_type]
226
- {}.tap do |hash|
227
- value.each do |k, v|
228
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
229
- end
230
- end
231
- else # model
232
- # models (e.g. Pet) or oneOf
233
- klass = YNAB.const_get(type)
234
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
235
- end
236
- end
237
-
238
- # Returns the string representation of the object
239
- # @return [String] String presentation of the object
240
- def to_s
241
- to_hash.to_s
242
- end
243
-
244
- # to_body is an alias to to_hash (backward compatibility)
245
- # @return [Hash] Returns the object in the form of hash
246
- def to_body
247
- to_hash
248
- end
249
-
250
195
  # Returns the object in the form of hash
251
196
  # @return [Hash] Returns the object in the form of hash
252
197
  def to_hash
@@ -262,25 +207,6 @@ module YNAB
262
207
  end
263
208
  hash
264
209
  end
265
-
266
- # Outputs non-array value in the form of hash
267
- # For object, use to_hash. Otherwise, just return the value
268
- # @param [Object] value Any valid value
269
- # @return [Hash] Returns the value in the form of hash
270
- def _to_hash(value)
271
- if value.is_a?(Array)
272
- value.compact.map { |v| _to_hash(v) }
273
- elsif value.is_a?(Hash)
274
- {}.tap do |hash|
275
- value.each { |k, v| hash[k] = _to_hash(v) }
276
- end
277
- elsif value.respond_to? :to_hash
278
- value.to_hash
279
- else
280
- value
281
- end
282
- end
283
-
284
210
  end
285
211
 
286
212
  end
@@ -0,0 +1,180 @@
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
+ require 'date'
11
+ require 'time'
12
+
13
+ module YNAB
14
+ class NewCategory < ApiModelBase
15
+ attr_accessor :name
16
+
17
+ attr_accessor :note
18
+
19
+ attr_accessor :category_group_id
20
+
21
+ # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount.
22
+ attr_accessor :goal_target
23
+
24
+ # The goal target date in ISO format (e.g. 2016-12-01).
25
+ attr_accessor :goal_target_date
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'name' => :'name',
31
+ :'note' => :'note',
32
+ :'category_group_id' => :'category_group_id',
33
+ :'goal_target' => :'goal_target',
34
+ :'goal_target_date' => :'goal_target_date'
35
+ }
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'name' => :'String',
47
+ :'note' => :'String',
48
+ :'category_group_id' => :'String',
49
+ :'goal_target' => :'Integer',
50
+ :'goal_target_date' => :'Date'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
60
+ # List of class defined in allOf (OpenAPI v3)
61
+ def self.openapi_all_of
62
+ [
63
+ :'SaveCategory'
64
+ ]
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::NewCategory` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::NewCategory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'name')
83
+ self.name = attributes[:'name']
84
+ end
85
+
86
+ if attributes.key?(:'note')
87
+ self.note = attributes[:'note']
88
+ end
89
+
90
+ if attributes.key?(:'category_group_id')
91
+ self.category_group_id = attributes[:'category_group_id']
92
+ end
93
+
94
+ if attributes.key?(:'goal_target')
95
+ self.goal_target = attributes[:'goal_target']
96
+ end
97
+
98
+ if attributes.key?(:'goal_target_date')
99
+ self.goal_target_date = attributes[:'goal_target_date']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ true
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ name == o.name &&
122
+ note == o.note &&
123
+ category_group_id == o.category_group_id &&
124
+ goal_target == o.goal_target &&
125
+ goal_target_date == o.goal_target_date
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [name, note, category_group_id, goal_target, goal_target_date].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ attributes = attributes.transform_keys(&:to_sym)
146
+ transformed_hash = {}
147
+ openapi_types.each_pair do |key, type|
148
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
149
+ transformed_hash["#{key}"] = nil
150
+ elsif type =~ /\AArray<(.*)>/i
151
+ # check to ensure the input is an array given that the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[attribute_map[key]].is_a?(Array)
154
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
155
+ end
156
+ elsif !attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
158
+ end
159
+ end
160
+ new(transformed_hash)
161
+ end
162
+
163
+ # Returns the object in the form of hash
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_hash
166
+ hash = {}
167
+ self.class.attribute_map.each_pair do |attr, param|
168
+ value = self.send(attr)
169
+ if value.nil?
170
+ is_nullable = self.class.openapi_nullable.include?(attr)
171
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
172
+ end
173
+
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+ end
179
+
180
+ end