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
@@ -0,0 +1,136 @@
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 SaveCategoryGroupResponse < ApiModelBase
15
+ attr_accessor :data
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'data' => :'data'
21
+ }
22
+ end
23
+
24
+ # Returns all the JSON keys this model knows about
25
+ def self.acceptable_attributes
26
+ attribute_map.values
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'data' => :'SaveCategoryGroupResponseData'
33
+ }
34
+ end
35
+
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new([
39
+ ])
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ if (!attributes.is_a?(Hash))
46
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveCategoryGroupResponse` initialize method"
47
+ end
48
+
49
+ # check to see if the attribute exists and convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h|
51
+ if (!self.class.attribute_map.key?(k.to_sym))
52
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveCategoryGroupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ end
54
+ h[k.to_sym] = v
55
+ }
56
+
57
+ if attributes.key?(:'data')
58
+ self.data = attributes[:'data']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ return false if @data.nil?
73
+ true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ data == o.data
82
+ end
83
+
84
+ # @see the `==` method
85
+ # @param [Object] Object to be compared
86
+ def eql?(o)
87
+ self == o
88
+ end
89
+
90
+ # Calculates hash code according to all attributes.
91
+ # @return [Integer] Hash code
92
+ def hash
93
+ [data].hash
94
+ end
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def self.build_from_hash(attributes)
100
+ return nil unless attributes.is_a?(Hash)
101
+ attributes = attributes.transform_keys(&:to_sym)
102
+ transformed_hash = {}
103
+ openapi_types.each_pair do |key, type|
104
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
105
+ transformed_hash["#{key}"] = nil
106
+ elsif type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the attribute
108
+ # is documented as an array but the input is not
109
+ if attributes[attribute_map[key]].is_a?(Array)
110
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
111
+ end
112
+ elsif !attributes[attribute_map[key]].nil?
113
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
114
+ end
115
+ end
116
+ new(transformed_hash)
117
+ end
118
+
119
+ # Returns the object in the form of hash
120
+ # @return [Hash] Returns the object in the form of hash
121
+ def to_hash
122
+ hash = {}
123
+ self.class.attribute_map.each_pair do |attr, param|
124
+ value = self.send(attr)
125
+ if value.nil?
126
+ is_nullable = self.class.openapi_nullable.include?(attr)
127
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
128
+ end
129
+
130
+ hash[param] = _to_hash(value)
131
+ end
132
+ hash
133
+ end
134
+ end
135
+
136
+ end
@@ -0,0 +1,147 @@
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 SaveCategoryGroupResponseData < ApiModelBase
15
+ attr_accessor :category_group
16
+
17
+ # The knowledge of the server
18
+ attr_accessor :server_knowledge
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'category_group' => :'category_group',
24
+ :'server_knowledge' => :'server_knowledge'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'category_group' => :'CategoryGroup',
37
+ :'server_knowledge' => :'Integer'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveCategoryGroupResponseData` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveCategoryGroupResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'category_group')
63
+ self.category_group = attributes[:'category_group']
64
+ end
65
+
66
+ if attributes.key?(:'server_knowledge')
67
+ self.server_knowledge = attributes[:'server_knowledge']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ invalid_properties = Array.new
75
+ invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ return false if @category_group.nil?
82
+ return false if @server_knowledge.nil?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ category_group == o.category_group &&
92
+ server_knowledge == o.server_knowledge
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [category_group, server_knowledge].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ openapi_types.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash["#{key}"] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
122
+ end
123
+ elsif !attributes[attribute_map[key]].nil?
124
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
125
+ end
126
+ end
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Returns the object in the form of hash
131
+ # @return [Hash] Returns the object in the form of hash
132
+ def to_hash
133
+ hash = {}
134
+ self.class.attribute_map.each_pair do |attr, param|
135
+ value = self.send(attr)
136
+ if value.nil?
137
+ is_nullable = self.class.openapi_nullable.include?(attr)
138
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
139
+ end
140
+
141
+ hash[param] = _to_hash(value)
142
+ end
143
+ hash
144
+ end
145
+ end
146
+
147
+ end
@@ -11,7 +11,7 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module YNAB
14
- class SaveCategoryResponse
14
+ class SaveCategoryResponse < 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 SaveCategoryResponseData
14
+ class SaveCategoryResponseData < ApiModelBase
15
15
  attr_accessor :category
16
16
 
17
17
  # The knowledge of the server
@@ -127,61 +127,6 @@ module YNAB
127
127
  new(transformed_hash)
128
128
  end
129
129
 
130
- # Deserializes the data based on type
131
- # @param string type Data type
132
- # @param string value Value to be deserialized
133
- # @return [Object] Deserialized data
134
- def self._deserialize(type, value)
135
- case type.to_sym
136
- when :Time
137
- Time.parse(value)
138
- when :Date
139
- Date.parse(value)
140
- when :String
141
- value.to_s
142
- when :Integer
143
- value.to_i
144
- when :Float
145
- value.to_f
146
- when :Boolean
147
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
- true
149
- else
150
- false
151
- end
152
- when :Object
153
- # generic object (usually a Hash), return directly
154
- value
155
- when /\AArray<(?<inner_type>.+)>\z/
156
- inner_type = Regexp.last_match[:inner_type]
157
- value.map { |v| _deserialize(inner_type, v) }
158
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
- k_type = Regexp.last_match[:k_type]
160
- v_type = Regexp.last_match[:v_type]
161
- {}.tap do |hash|
162
- value.each do |k, v|
163
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
- end
165
- end
166
- else # model
167
- # models (e.g. Pet) or oneOf
168
- klass = YNAB.const_get(type)
169
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
- end
171
- end
172
-
173
- # Returns the string representation of the object
174
- # @return [String] String presentation of the object
175
- def to_s
176
- to_hash.to_s
177
- end
178
-
179
- # to_body is an alias to to_hash (backward compatibility)
180
- # @return [Hash] Returns the object in the form of hash
181
- def to_body
182
- to_hash
183
- end
184
-
185
130
  # Returns the object in the form of hash
186
131
  # @return [Hash] Returns the object in the form of hash
187
132
  def to_hash
@@ -197,25 +142,6 @@ module YNAB
197
142
  end
198
143
  hash
199
144
  end
200
-
201
- # Outputs non-array value in the form of hash
202
- # For object, use to_hash. Otherwise, just return the value
203
- # @param [Object] value Any valid value
204
- # @return [Hash] Returns the value in the form of hash
205
- def _to_hash(value)
206
- if value.is_a?(Array)
207
- value.compact.map { |v| _to_hash(v) }
208
- elsif value.is_a?(Hash)
209
- {}.tap do |hash|
210
- value.each { |k, v| hash[k] = _to_hash(v) }
211
- end
212
- elsif value.respond_to? :to_hash
213
- value.to_hash
214
- else
215
- value
216
- end
217
- end
218
-
219
145
  end
220
146
 
221
147
  end
@@ -11,8 +11,8 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module YNAB
14
- class SaveMonthCategory
15
- # Budgeted amount in milliunits format
14
+ class SaveMonthCategory < ApiModelBase
15
+ # Assigned (budgeted) amount in milliunits format
16
16
  attr_accessor :budgeted
17
17
 
18
18
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -117,61 +117,6 @@ module YNAB
117
117
  new(transformed_hash)
118
118
  end
119
119
 
120
- # Deserializes the data based on type
121
- # @param string type Data type
122
- # @param string value Value to be deserialized
123
- # @return [Object] Deserialized data
124
- def self._deserialize(type, value)
125
- case type.to_sym
126
- when :Time
127
- Time.parse(value)
128
- when :Date
129
- Date.parse(value)
130
- when :String
131
- value.to_s
132
- when :Integer
133
- value.to_i
134
- when :Float
135
- value.to_f
136
- when :Boolean
137
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
- true
139
- else
140
- false
141
- end
142
- when :Object
143
- # generic object (usually a Hash), return directly
144
- value
145
- when /\AArray<(?<inner_type>.+)>\z/
146
- inner_type = Regexp.last_match[:inner_type]
147
- value.map { |v| _deserialize(inner_type, v) }
148
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
- k_type = Regexp.last_match[:k_type]
150
- v_type = Regexp.last_match[:v_type]
151
- {}.tap do |hash|
152
- value.each do |k, v|
153
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
- end
155
- end
156
- else # model
157
- # models (e.g. Pet) or oneOf
158
- klass = YNAB.const_get(type)
159
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
160
- end
161
- end
162
-
163
- # Returns the string representation of the object
164
- # @return [String] String presentation of the object
165
- def to_s
166
- to_hash.to_s
167
- end
168
-
169
- # to_body is an alias to to_hash (backward compatibility)
170
- # @return [Hash] Returns the object in the form of hash
171
- def to_body
172
- to_hash
173
- end
174
-
175
120
  # Returns the object in the form of hash
176
121
  # @return [Hash] Returns the object in the form of hash
177
122
  def to_hash
@@ -187,25 +132,6 @@ module YNAB
187
132
  end
188
133
  hash
189
134
  end
190
-
191
- # Outputs non-array value in the form of hash
192
- # For object, use to_hash. Otherwise, just return the value
193
- # @param [Object] value Any valid value
194
- # @return [Hash] Returns the value in the form of hash
195
- def _to_hash(value)
196
- if value.is_a?(Array)
197
- value.compact.map { |v| _to_hash(v) }
198
- elsif value.is_a?(Hash)
199
- {}.tap do |hash|
200
- value.each { |k, v| hash[k] = _to_hash(v) }
201
- end
202
- elsif value.respond_to? :to_hash
203
- value.to_hash
204
- else
205
- value
206
- end
207
- end
208
-
209
135
  end
210
136
 
211
137
  end
@@ -11,7 +11,7 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module YNAB
14
- class SavePayee
14
+ class SavePayee < ApiModelBase
15
15
  # The name of the payee. The name must be a maximum of 500 characters.
16
16
  attr_accessor :name
17
17
 
@@ -123,61 +123,6 @@ module YNAB
123
123
  new(transformed_hash)
124
124
  end
125
125
 
126
- # Deserializes the data based on type
127
- # @param string type Data type
128
- # @param string value Value to be deserialized
129
- # @return [Object] Deserialized data
130
- def self._deserialize(type, value)
131
- case type.to_sym
132
- when :Time
133
- Time.parse(value)
134
- when :Date
135
- Date.parse(value)
136
- when :String
137
- value.to_s
138
- when :Integer
139
- value.to_i
140
- when :Float
141
- value.to_f
142
- when :Boolean
143
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
- true
145
- else
146
- false
147
- end
148
- when :Object
149
- # generic object (usually a Hash), return directly
150
- value
151
- when /\AArray<(?<inner_type>.+)>\z/
152
- inner_type = Regexp.last_match[:inner_type]
153
- value.map { |v| _deserialize(inner_type, v) }
154
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
- k_type = Regexp.last_match[:k_type]
156
- v_type = Regexp.last_match[:v_type]
157
- {}.tap do |hash|
158
- value.each do |k, v|
159
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
- end
161
- end
162
- else # model
163
- # models (e.g. Pet) or oneOf
164
- klass = YNAB.const_get(type)
165
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
- end
167
- end
168
-
169
- # Returns the string representation of the object
170
- # @return [String] String presentation of the object
171
- def to_s
172
- to_hash.to_s
173
- end
174
-
175
- # to_body is an alias to to_hash (backward compatibility)
176
- # @return [Hash] Returns the object in the form of hash
177
- def to_body
178
- to_hash
179
- end
180
-
181
126
  # Returns the object in the form of hash
182
127
  # @return [Hash] Returns the object in the form of hash
183
128
  def to_hash
@@ -193,25 +138,6 @@ module YNAB
193
138
  end
194
139
  hash
195
140
  end
196
-
197
- # Outputs non-array value in the form of hash
198
- # For object, use to_hash. Otherwise, just return the value
199
- # @param [Object] value Any valid value
200
- # @return [Hash] Returns the value in the form of hash
201
- def _to_hash(value)
202
- if value.is_a?(Array)
203
- value.compact.map { |v| _to_hash(v) }
204
- elsif value.is_a?(Hash)
205
- {}.tap do |hash|
206
- value.each { |k, v| hash[k] = _to_hash(v) }
207
- end
208
- elsif value.respond_to? :to_hash
209
- value.to_hash
210
- else
211
- value
212
- end
213
- end
214
-
215
141
  end
216
142
 
217
143
  end