ynab 1.31.0 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. checksums.yaml +4 -4
  2. data/DEVELOPMENT.md +11 -0
  3. data/Gemfile +8 -0
  4. data/Gemfile.lock +42 -0
  5. data/README.md +3 -3
  6. data/Rakefile +58 -0
  7. data/config.json +9 -0
  8. data/docs/Account.md +25 -0
  9. data/docs/AccountResponse.md +8 -0
  10. data/docs/AccountResponseData.md +8 -0
  11. data/docs/AccountType.md +7 -0
  12. data/docs/AccountWrapper.md +8 -0
  13. data/docs/AccountsApi.md +70 -0
  14. data/docs/AccountsResponse.md +8 -0
  15. data/docs/AccountsResponseData.md +9 -0
  16. data/docs/AccountsWrapper.md +9 -0
  17. data/docs/BudgetDetail.md +24 -0
  18. data/docs/BudgetDetailAllOf.md +17 -0
  19. data/docs/BudgetDetailResponse.md +8 -0
  20. data/docs/BudgetDetailResponseData.md +9 -0
  21. data/docs/BudgetDetailWrapper.md +9 -0
  22. data/docs/BudgetSettings.md +9 -0
  23. data/docs/BudgetSettingsResponse.md +8 -0
  24. data/docs/BudgetSettingsResponseData.md +8 -0
  25. data/docs/BudgetSettingsWrapper.md +8 -0
  26. data/docs/BudgetSummary.md +15 -0
  27. data/docs/BudgetSummaryResponse.md +8 -0
  28. data/docs/BudgetSummaryResponseData.md +9 -0
  29. data/docs/BudgetSummaryWrapper.md +9 -0
  30. data/docs/BudgetsApi.md +68 -0
  31. data/docs/BulkIdWrapper.md +8 -0
  32. data/docs/BulkIds.md +9 -0
  33. data/docs/BulkResponse.md +8 -0
  34. data/docs/BulkResponseData.md +8 -0
  35. data/docs/BulkResponseDataBulk.md +9 -0
  36. data/docs/BulkTransactionCreateResponse.md +8 -0
  37. data/docs/BulkTransactionIds.md +8 -0
  38. data/docs/BulkTransactions.md +8 -0
  39. data/docs/CategoriesApi.md +94 -0
  40. data/docs/CategoriesResponse.md +8 -0
  41. data/docs/CategoriesResponseData.md +9 -0
  42. data/docs/Category.md +30 -0
  43. data/docs/CategoryGroup.md +11 -0
  44. data/docs/CategoryGroupWithCategories.md +12 -0
  45. data/docs/CategoryGroupWithCategoriesAllOf.md +8 -0
  46. data/docs/CategoryGroupsWrapper.md +9 -0
  47. data/docs/CategoryResponse.md +8 -0
  48. data/docs/CategoryResponseData.md +8 -0
  49. data/docs/CategoryWrapper.md +9 -0
  50. data/docs/CurrencyFormat.md +15 -0
  51. data/docs/DateFormat.md +8 -0
  52. data/docs/DeprecatedApi.md +28 -0
  53. data/docs/ErrorDetail.md +10 -0
  54. data/docs/ErrorResponse.md +8 -0
  55. data/docs/HybridTransaction.md +30 -0
  56. data/docs/HybridTransactionAllOf.md +12 -0
  57. data/docs/HybridTransactionsResponse.md +8 -0
  58. data/docs/HybridTransactionsResponseData.md +9 -0
  59. data/docs/HybridTransactionsWrapper.md +8 -0
  60. data/docs/LoanAccountPeriodicValue.md +7 -0
  61. data/docs/MonthDetail.md +16 -0
  62. data/docs/MonthDetailAllOf.md +8 -0
  63. data/docs/MonthDetailResponse.md +8 -0
  64. data/docs/MonthDetailResponseData.md +8 -0
  65. data/docs/MonthDetailWrapper.md +8 -0
  66. data/docs/MonthSummariesResponse.md +8 -0
  67. data/docs/MonthSummariesResponseData.md +9 -0
  68. data/docs/MonthSummariesWrapper.md +9 -0
  69. data/docs/MonthSummary.md +15 -0
  70. data/docs/MonthsApi.md +49 -0
  71. data/docs/PatchMonthCategoryWrapper.md +8 -0
  72. data/docs/PatchTransactionsWrapper.md +8 -0
  73. data/docs/Payee.md +11 -0
  74. data/docs/PayeeLocation.md +12 -0
  75. data/docs/PayeeLocationResponse.md +8 -0
  76. data/docs/PayeeLocationResponseData.md +8 -0
  77. data/docs/PayeeLocationWrapper.md +8 -0
  78. data/docs/PayeeLocationsApi.md +69 -0
  79. data/docs/PayeeLocationsResponse.md +8 -0
  80. data/docs/PayeeLocationsResponseData.md +8 -0
  81. data/docs/PayeeLocationsWrapper.md +8 -0
  82. data/docs/PayeeResponse.md +8 -0
  83. data/docs/PayeeResponseData.md +8 -0
  84. data/docs/PayeeWrapper.md +8 -0
  85. data/docs/PayeesApi.md +49 -0
  86. data/docs/PayeesResponse.md +8 -0
  87. data/docs/PayeesResponseData.md +9 -0
  88. data/docs/PayeesWrapper.md +9 -0
  89. data/docs/PostAccountWrapper.md +8 -0
  90. data/docs/PostTransactionsWrapper.md +9 -0
  91. data/docs/PutTransactionWrapper.md +8 -0
  92. data/docs/SaveAccount.md +10 -0
  93. data/docs/SaveAccountWrapper.md +8 -0
  94. data/docs/SaveCategoryResponse.md +8 -0
  95. data/docs/SaveCategoryResponseData.md +9 -0
  96. data/docs/SaveMonthCategory.md +8 -0
  97. data/docs/SaveMonthCategoryWrapper.md +8 -0
  98. data/docs/SaveSubTransaction.md +12 -0
  99. data/docs/SaveTransaction.md +19 -0
  100. data/docs/SaveTransactionWithId.md +20 -0
  101. data/docs/SaveTransactionWithIdAllOf.md +8 -0
  102. data/docs/SaveTransactionWithOptionalFields.md +19 -0
  103. data/docs/SaveTransactionWrapper.md +8 -0
  104. data/docs/SaveTransactionsResponse.md +8 -0
  105. data/docs/SaveTransactionsResponseData.md +12 -0
  106. data/docs/SaveTransactionsWrapper.md +9 -0
  107. data/docs/ScheduledSubTransaction.md +15 -0
  108. data/docs/ScheduledTransactionDetail.md +23 -0
  109. data/docs/ScheduledTransactionDetailAllOf.md +11 -0
  110. data/docs/ScheduledTransactionResponse.md +8 -0
  111. data/docs/ScheduledTransactionResponseData.md +8 -0
  112. data/docs/ScheduledTransactionSummary.md +19 -0
  113. data/docs/ScheduledTransactionWrapper.md +8 -0
  114. data/docs/ScheduledTransactionsApi.md +49 -0
  115. data/docs/ScheduledTransactionsResponse.md +8 -0
  116. data/docs/ScheduledTransactionsResponseData.md +9 -0
  117. data/docs/ScheduledTransactionsWrapper.md +8 -0
  118. data/docs/SubTransaction.md +18 -0
  119. data/docs/TransactionDetail.md +29 -0
  120. data/docs/TransactionDetailAllOf.md +11 -0
  121. data/docs/TransactionResponse.md +8 -0
  122. data/docs/TransactionResponseData.md +8 -0
  123. data/docs/TransactionSummary.md +25 -0
  124. data/docs/TransactionWrapper.md +8 -0
  125. data/docs/TransactionsApi.md +228 -0
  126. data/docs/TransactionsImportResponse.md +8 -0
  127. data/docs/TransactionsImportResponseData.md +8 -0
  128. data/docs/TransactionsResponse.md +8 -0
  129. data/docs/TransactionsResponseData.md +9 -0
  130. data/docs/TransactionsWrapper.md +9 -0
  131. data/docs/UpdateTransaction.md +20 -0
  132. data/docs/UpdateTransactionsWrapper.md +8 -0
  133. data/docs/User.md +8 -0
  134. data/docs/UserApi.md +25 -0
  135. data/docs/UserResponse.md +8 -0
  136. data/docs/UserResponseData.md +8 -0
  137. data/docs/UserWrapper.md +8 -0
  138. data/examples/budget-list.rb +21 -0
  139. data/examples/budget-month.rb +33 -0
  140. data/examples/category-balance.rb +23 -0
  141. data/examples/create-multiple-transactions.rb +42 -0
  142. data/examples/create-transaction.rb +30 -0
  143. data/examples/update-category-budgeted.rb +25 -0
  144. data/examples/update-multiple-transactions.rb +20 -0
  145. data/lib/ynab/api/accounts_api.rb +78 -41
  146. data/lib/ynab/api/budgets_api.rb +68 -36
  147. data/lib/ynab/api/categories_api.rb +108 -60
  148. data/lib/ynab/api/deprecated_api.rb +32 -17
  149. data/lib/ynab/api/months_api.rb +49 -28
  150. data/lib/ynab/api/payee_locations_api.rb +73 -41
  151. data/lib/ynab/api/payees_api.rb +49 -28
  152. data/lib/ynab/api/scheduled_transactions_api.rb +49 -28
  153. data/lib/ynab/api/transactions_api.rb +268 -140
  154. data/lib/ynab/api/user_api.rb +22 -12
  155. data/lib/ynab/api_client.rb +97 -95
  156. data/lib/ynab/configuration.rb +101 -14
  157. data/lib/ynab/models/account.rb +117 -55
  158. data/lib/ynab/models/account_response.rb +53 -18
  159. data/lib/ynab/models/account_response_data.rb +53 -18
  160. data/lib/ynab/models/account_type.rb +30 -20
  161. data/lib/ynab/models/accounts_response.rb +53 -18
  162. data/lib/ynab/models/accounts_response_data.rb +54 -19
  163. data/lib/ynab/models/budget_detail.rb +80 -35
  164. data/lib/ynab/models/budget_detail_all_of.rb +320 -0
  165. data/lib/ynab/models/budget_detail_response.rb +53 -18
  166. data/lib/ynab/models/budget_detail_response_data.rb +54 -19
  167. data/lib/ynab/models/budget_settings.rb +56 -29
  168. data/lib/ynab/models/budget_settings_response.rb +53 -18
  169. data/lib/ynab/models/budget_settings_response_data.rb +53 -18
  170. data/lib/ynab/models/budget_summary.rb +63 -26
  171. data/lib/ynab/models/budget_summary_response.rb +53 -18
  172. data/lib/ynab/models/budget_summary_response_data.rb +54 -20
  173. data/lib/ynab/models/bulk_response.rb +53 -18
  174. data/lib/ynab/models/bulk_response_data.rb +53 -18
  175. data/lib/ynab/models/bulk_response_data_bulk.rb +54 -19
  176. data/lib/ynab/models/bulk_transactions.rb +53 -18
  177. data/lib/ynab/models/categories_response.rb +53 -18
  178. data/lib/ynab/models/categories_response_data.rb +54 -19
  179. data/lib/ynab/models/category.rb +110 -48
  180. data/lib/ynab/models/category_group.rb +58 -23
  181. data/lib/ynab/models/category_group_with_categories.rb +67 -24
  182. data/lib/ynab/models/{save_month_category_wrapper.rb → category_group_with_categories_all_of.rb} +67 -29
  183. data/lib/ynab/models/category_response.rb +53 -18
  184. data/lib/ynab/models/category_response_data.rb +53 -18
  185. data/lib/ynab/models/currency_format.rb +62 -27
  186. data/lib/ynab/models/date_format.rb +53 -18
  187. data/lib/ynab/models/error_detail.rb +55 -20
  188. data/lib/ynab/models/error_response.rb +53 -18
  189. data/lib/ynab/models/hybrid_transaction.rb +118 -46
  190. data/lib/ynab/models/hybrid_transaction_all_of.rb +304 -0
  191. data/lib/ynab/models/hybrid_transactions_response.rb +53 -18
  192. data/lib/ynab/models/hybrid_transactions_response_data.rb +54 -19
  193. data/lib/ynab/models/month_detail.rb +72 -27
  194. data/lib/ynab/models/{update_transactions_wrapper.rb → month_detail_all_of.rb} +66 -30
  195. data/lib/ynab/models/month_detail_response.rb +53 -18
  196. data/lib/ynab/models/month_detail_response_data.rb +53 -18
  197. data/lib/ynab/models/month_summaries_response.rb +53 -18
  198. data/lib/ynab/models/month_summaries_response_data.rb +54 -19
  199. data/lib/ynab/models/month_summary.rb +63 -26
  200. data/lib/ynab/models/patch_month_category_wrapper.rb +53 -18
  201. data/lib/ynab/models/patch_transactions_wrapper.rb +53 -18
  202. data/lib/ynab/models/payee.rb +58 -22
  203. data/lib/ynab/models/payee_location.rb +58 -23
  204. data/lib/ynab/models/payee_location_response.rb +53 -18
  205. data/lib/ynab/models/payee_location_response_data.rb +53 -18
  206. data/lib/ynab/models/payee_locations_response.rb +53 -18
  207. data/lib/ynab/models/payee_locations_response_data.rb +53 -18
  208. data/lib/ynab/models/payee_response.rb +53 -18
  209. data/lib/ynab/models/payee_response_data.rb +53 -18
  210. data/lib/ynab/models/payees_response.rb +53 -18
  211. data/lib/ynab/models/payees_response_data.rb +54 -19
  212. data/lib/ynab/models/post_account_wrapper.rb +53 -18
  213. data/lib/ynab/models/post_transactions_wrapper.rb +54 -19
  214. data/lib/ynab/models/put_transaction_wrapper.rb +53 -18
  215. data/lib/ynab/models/save_account.rb +77 -20
  216. data/lib/ynab/models/save_category_response.rb +53 -18
  217. data/lib/ynab/models/save_category_response_data.rb +54 -19
  218. data/lib/ynab/models/save_month_category.rb +53 -18
  219. data/lib/ynab/models/save_sub_transaction.rb +61 -22
  220. data/lib/ynab/models/save_transaction.rb +88 -33
  221. data/lib/ynab/models/save_transaction_with_id.rb +102 -46
  222. data/lib/ynab/models/{save_transactions_wrapper.rb → save_transaction_with_id_all_of.rb} +60 -36
  223. data/lib/ynab/models/save_transaction_with_optional_fields.rb +81 -33
  224. data/lib/ynab/models/save_transactions_response.rb +53 -18
  225. data/lib/ynab/models/save_transactions_response_data.rb +57 -23
  226. data/lib/ynab/models/scheduled_sub_transaction.rb +66 -27
  227. data/lib/ynab/models/scheduled_transaction_detail.rb +94 -36
  228. data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +262 -0
  229. data/lib/ynab/models/scheduled_transaction_response.rb +53 -18
  230. data/lib/ynab/models/scheduled_transaction_response_data.rb +53 -18
  231. data/lib/ynab/models/scheduled_transaction_summary.rb +80 -32
  232. data/lib/ynab/models/scheduled_transactions_response.rb +53 -18
  233. data/lib/ynab/models/scheduled_transactions_response_data.rb +54 -19
  234. data/lib/ynab/models/sub_transaction.rb +71 -29
  235. data/lib/ynab/models/transaction_detail.rb +112 -44
  236. data/lib/ynab/models/{save_transaction_wrapper.rb → transaction_detail_all_of.rb} +102 -29
  237. data/lib/ynab/models/transaction_response.rb +53 -18
  238. data/lib/ynab/models/transaction_response_data.rb +53 -18
  239. data/lib/ynab/models/transaction_summary.rb +98 -40
  240. data/lib/ynab/models/transactions_import_response.rb +53 -18
  241. data/lib/ynab/models/transactions_import_response_data.rb +53 -18
  242. data/lib/ynab/models/transactions_response.rb +53 -18
  243. data/lib/ynab/models/transactions_response_data.rb +54 -19
  244. data/lib/ynab/models/user.rb +53 -18
  245. data/lib/ynab/models/user_response.rb +53 -18
  246. data/lib/ynab/models/user_response_data.rb +53 -18
  247. data/lib/ynab/version.rb +1 -1
  248. data/lib/ynab.rb +19 -14
  249. data/open_api_spec.yaml +3012 -0
  250. data/templates/api_client.mustache +274 -0
  251. data/templates/api_client_typhoeus_partial.mustache +156 -0
  252. data/templates/api_doc.mustache +44 -0
  253. data/templates/gem.mustache +84 -0
  254. data/templates/partial_model_generic_doc.mustache +9 -0
  255. data/ynab.gemspec +38 -0
  256. metadata +194 -87
  257. data/lib/ynab/models/loan_account_periodic_value.rb +0 -175
  258. data/lib/ynab/models/save_account_wrapper.rb +0 -189
  259. data/lib/ynab/models/update_transaction.rb +0 -407
  260. data/spec/models/transaction_detail_spec.rb +0 -11
@@ -3,17 +3,20 @@
3
3
 
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
- OpenAPI spec version: 1.0.0
6
+ The version of the OpenAPI document: 1.0.0
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.14
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module YNAB
16
17
  class SaveTransactionWithId
18
+ attr_accessor :id
19
+
17
20
  attr_accessor :account_id
18
21
 
19
22
  # The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored.
@@ -45,11 +48,9 @@ module YNAB
45
48
  # If specified, the new transaction will be assigned this `import_id` and considered \"imported\". We will also attempt to match this imported transaction to an existing \"user-entered\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.<br><br>Transactions imported through File Based Import or Direct Import (not through the API) are assigned an import_id in the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. Using a consistent format will prevent duplicates through Direct Import and File Based Import.<br><br>If import_id is omitted or specified as null, the transaction will be treated as a \"user-entered\" transaction. As such, it will be eligible to be matched against transactions later being imported (via DI, FBI, or API).
46
49
  attr_accessor :import_id
47
50
 
48
- # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
51
+ # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
49
52
  attr_accessor :subtransactions
50
53
 
51
- attr_accessor :id
52
-
53
54
  class EnumAttributeValidator
54
55
  attr_reader :datatype
55
56
  attr_reader :allowable_values
@@ -75,6 +76,7 @@ module YNAB
75
76
  # Attribute mapping from ruby-style variable name to JSON key.
76
77
  def self.attribute_map
77
78
  {
79
+ :'id' => :'id',
78
80
  :'account_id' => :'account_id',
79
81
  :'date' => :'date',
80
82
  :'amount' => :'amount',
@@ -86,14 +88,19 @@ module YNAB
86
88
  :'approved' => :'approved',
87
89
  :'flag_color' => :'flag_color',
88
90
  :'import_id' => :'import_id',
89
- :'subtransactions' => :'subtransactions',
90
- :'id' => :'id'
91
+ :'subtransactions' => :'subtransactions'
91
92
  }
92
93
  end
93
94
 
95
+ # Returns all the JSON keys this model knows about
96
+ def self.acceptable_attributes
97
+ attribute_map.values
98
+ end
99
+
94
100
  # Attribute type mapping.
95
- def self.swagger_types
101
+ def self.openapi_types
96
102
  {
103
+ :'id' => :'String',
97
104
  :'account_id' => :'String',
98
105
  :'date' => :'Date',
99
106
  :'amount' => :'Integer',
@@ -102,75 +109,100 @@ module YNAB
102
109
  :'category_id' => :'String',
103
110
  :'memo' => :'String',
104
111
  :'cleared' => :'String',
105
- :'approved' => :'BOOLEAN',
112
+ :'approved' => :'Boolean',
106
113
  :'flag_color' => :'String',
107
114
  :'import_id' => :'String',
108
- :'subtransactions' => :'Array<SaveSubTransaction>',
109
- :'id' => :'String'
115
+ :'subtransactions' => :'Array<SaveSubTransaction>'
110
116
  }
111
117
  end
112
118
 
119
+ # List of attributes with nullable: true
120
+ def self.openapi_nullable
121
+ Set.new([
122
+ :'payee_id',
123
+ :'payee_name',
124
+ :'category_id',
125
+ :'memo',
126
+ :'import_id',
127
+ ])
128
+ end
129
+
130
+ # List of class defined in allOf (OpenAPI v3)
131
+ def self.openapi_all_of
132
+ [
133
+ :'SaveTransactionWithIdAllOf',
134
+ :'SaveTransactionWithOptionalFields'
135
+ ]
136
+ end
137
+
113
138
  # Initializes the object
114
139
  # @param [Hash] attributes Model attributes in the form of hash
115
140
  def initialize(attributes = {})
116
- return unless attributes.is_a?(Hash)
141
+ if (!attributes.is_a?(Hash))
142
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransactionWithId` initialize method"
143
+ end
117
144
 
118
- # convert string to symbol for hash key
119
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
145
+ # check to see if the attribute exists and convert string to symbol for hash key
146
+ attributes = attributes.each_with_object({}) { |(k, v), h|
147
+ if (!self.class.attribute_map.key?(k.to_sym))
148
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransactionWithId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
149
+ end
150
+ h[k.to_sym] = v
151
+ }
152
+
153
+ if attributes.key?(:'id')
154
+ self.id = attributes[:'id']
155
+ end
120
156
 
121
- if attributes.has_key?(:'account_id')
157
+ if attributes.key?(:'account_id')
122
158
  self.account_id = attributes[:'account_id']
123
159
  end
124
160
 
125
- if attributes.has_key?(:'date')
161
+ if attributes.key?(:'date')
126
162
  self.date = attributes[:'date']
127
163
  end
128
164
 
129
- if attributes.has_key?(:'amount')
165
+ if attributes.key?(:'amount')
130
166
  self.amount = attributes[:'amount']
131
167
  end
132
168
 
133
- if attributes.has_key?(:'payee_id')
169
+ if attributes.key?(:'payee_id')
134
170
  self.payee_id = attributes[:'payee_id']
135
171
  end
136
172
 
137
- if attributes.has_key?(:'payee_name')
173
+ if attributes.key?(:'payee_name')
138
174
  self.payee_name = attributes[:'payee_name']
139
175
  end
140
176
 
141
- if attributes.has_key?(:'category_id')
177
+ if attributes.key?(:'category_id')
142
178
  self.category_id = attributes[:'category_id']
143
179
  end
144
180
 
145
- if attributes.has_key?(:'memo')
181
+ if attributes.key?(:'memo')
146
182
  self.memo = attributes[:'memo']
147
183
  end
148
184
 
149
- if attributes.has_key?(:'cleared')
185
+ if attributes.key?(:'cleared')
150
186
  self.cleared = attributes[:'cleared']
151
187
  end
152
188
 
153
- if attributes.has_key?(:'approved')
189
+ if attributes.key?(:'approved')
154
190
  self.approved = attributes[:'approved']
155
191
  end
156
192
 
157
- if attributes.has_key?(:'flag_color')
193
+ if attributes.key?(:'flag_color')
158
194
  self.flag_color = attributes[:'flag_color']
159
195
  end
160
196
 
161
- if attributes.has_key?(:'import_id')
197
+ if attributes.key?(:'import_id')
162
198
  self.import_id = attributes[:'import_id']
163
199
  end
164
200
 
165
- if attributes.has_key?(:'subtransactions')
201
+ if attributes.key?(:'subtransactions')
166
202
  if (value = attributes[:'subtransactions']).is_a?(Array)
167
203
  self.subtransactions = value
168
204
  end
169
205
  end
170
-
171
- if attributes.has_key?(:'id')
172
- self.id = attributes[:'id']
173
- end
174
206
  end
175
207
 
176
208
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -197,9 +229,9 @@ module YNAB
197
229
  def valid?
198
230
  return false if !@payee_name.nil? && @payee_name.to_s.length > 50
199
231
  return false if !@memo.nil? && @memo.to_s.length > 200
200
- cleared_validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
232
+ cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
201
233
  return false unless cleared_validator.valid?(@cleared)
202
- flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
234
+ flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
203
235
  return false unless flag_color_validator.valid?(@flag_color)
204
236
  return false if !@import_id.nil? && @import_id.to_s.length > 36
205
237
  true
@@ -228,12 +260,20 @@ module YNAB
228
260
  # Custom attribute writer method checking allowed values (enum).
229
261
  # @param [Object] cleared Object to be assigned
230
262
  def cleared=(cleared)
263
+ validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
264
+ unless validator.valid?(cleared)
265
+ fail ArgumentError, "invalid value for \"cleared\", must be one of #{validator.allowable_values}."
266
+ end
231
267
  @cleared = cleared
232
268
  end
233
269
 
234
270
  # Custom attribute writer method checking allowed values (enum).
235
271
  # @param [Object] flag_color Object to be assigned
236
272
  def flag_color=(flag_color)
273
+ validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
274
+ unless validator.valid?(flag_color)
275
+ fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
276
+ end
237
277
  @flag_color = flag_color
238
278
  end
239
279
 
@@ -252,6 +292,7 @@ module YNAB
252
292
  def ==(o)
253
293
  return true if self.equal?(o)
254
294
  self.class == o.class &&
295
+ id == o.id &&
255
296
  account_id == o.account_id &&
256
297
  date == o.date &&
257
298
  amount == o.amount &&
@@ -263,8 +304,7 @@ module YNAB
263
304
  approved == o.approved &&
264
305
  flag_color == o.flag_color &&
265
306
  import_id == o.import_id &&
266
- subtransactions == o.subtransactions &&
267
- id == o.id
307
+ subtransactions == o.subtransactions
268
308
  end
269
309
 
270
310
  # @see the `==` method
@@ -274,17 +314,28 @@ module YNAB
274
314
  end
275
315
 
276
316
  # Calculates hash code according to all attributes.
277
- # @return [Fixnum] Hash code
317
+ # @return [Integer] Hash code
278
318
  def hash
279
- [account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions, id].hash
319
+ [id, account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions].hash
280
320
  end
321
+
322
+ # Builds the object from hash
323
+ # @param [Hash] attributes Model attributes in the form of hash
324
+ # @return [Object] Returns the model itself
325
+ def self.build_from_hash(attributes)
326
+ new.build_from_hash(attributes)
327
+ end
328
+
281
329
  # Builds the object from hash
282
330
  # @param [Hash] attributes Model attributes in the form of hash
283
331
  # @return [Object] Returns the model itself
284
332
  def build_from_hash(attributes)
285
333
  return nil unless attributes.is_a?(Hash)
286
- self.class.swagger_types.each_pair do |key, type|
287
- if type =~ /\AArray<(.*)>/i
334
+ attributes = attributes.transform_keys(&:to_sym)
335
+ self.class.openapi_types.each_pair do |key, type|
336
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
337
+ self.send("#{key}=", nil)
338
+ elsif type =~ /\AArray<(.*)>/i
288
339
  # check to ensure the input is an array given that the attribute
289
340
  # is documented as an array but the input is not
290
341
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -292,7 +343,7 @@ module YNAB
292
343
  end
293
344
  elsif !attributes[self.class.attribute_map[key]].nil?
294
345
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
295
- end # or else data not found in attributes(hash), not an issue as the data can be optional
346
+ end
296
347
  end
297
348
 
298
349
  self
@@ -304,8 +355,8 @@ module YNAB
304
355
  # @return [Object] Deserialized data
305
356
  def _deserialize(type, value)
306
357
  case type.to_sym
307
- when :DateTime
308
- DateTime.parse(value)
358
+ when :Time
359
+ Time.parse(value)
309
360
  when :Date
310
361
  Date.parse(value)
311
362
  when :String
@@ -314,7 +365,7 @@ module YNAB
314
365
  value.to_i
315
366
  when :Float
316
367
  value.to_f
317
- when :BOOLEAN
368
+ when :Boolean
318
369
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
319
370
  true
320
371
  else
@@ -335,8 +386,9 @@ module YNAB
335
386
  end
336
387
  end
337
388
  else # model
338
- temp_model = YNAB.const_get(type).new
339
- temp_model.build_from_hash(value)
389
+ # models (e.g. Pet) or oneOf
390
+ klass = YNAB.const_get(type)
391
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
340
392
  end
341
393
  end
342
394
 
@@ -358,7 +410,11 @@ module YNAB
358
410
  hash = {}
359
411
  self.class.attribute_map.each_pair do |attr, param|
360
412
  value = self.send(attr)
361
- next if value.nil?
413
+ if value.nil?
414
+ is_nullable = self.class.openapi_nullable.include?(attr)
415
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
416
+ end
417
+
362
418
  hash[param] = _to_hash(value)
363
419
  end
364
420
  hash
@@ -1,55 +1,64 @@
1
1
  =begin
2
2
  #YNAB API Endpoints
3
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.youneedabudget.com
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
- OpenAPI spec version: 1.0.0
6
+ The version of the OpenAPI document: 1.0.0
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.14
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module YNAB
16
- class SaveTransactionsWrapper
17
- attr_accessor :transaction
18
-
19
- attr_accessor :transactions
17
+ class SaveTransactionWithIdAllOf
18
+ attr_accessor :id
20
19
 
21
20
  # Attribute mapping from ruby-style variable name to JSON key.
22
21
  def self.attribute_map
23
22
  {
24
- :'transaction' => :'transaction',
25
- :'transactions' => :'transactions'
23
+ :'id' => :'id'
26
24
  }
27
25
  end
28
26
 
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
29
32
  # Attribute type mapping.
30
- def self.swagger_types
33
+ def self.openapi_types
31
34
  {
32
- :'transaction' => :'SaveTransaction',
33
- :'transactions' => :'Array<SaveTransaction>'
35
+ :'id' => :'String'
34
36
  }
35
37
  end
36
38
 
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
37
45
  # Initializes the object
38
46
  # @param [Hash] attributes Model attributes in the form of hash
39
47
  def initialize(attributes = {})
40
- return unless attributes.is_a?(Hash)
41
-
42
- # convert string to symbol for hash key
43
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
-
45
- if attributes.has_key?(:'transaction')
46
- self.transaction = attributes[:'transaction']
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransactionWithIdAllOf` initialize method"
47
50
  end
48
51
 
49
- if attributes.has_key?(:'transactions')
50
- if (value = attributes[:'transactions']).is_a?(Array)
51
- self.transactions = value
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransactionWithIdAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
56
  end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'id')
61
+ self.id = attributes[:'id']
53
62
  end
54
63
  end
55
64
 
@@ -71,8 +80,7 @@ module YNAB
71
80
  def ==(o)
72
81
  return true if self.equal?(o)
73
82
  self.class == o.class &&
74
- transaction == o.transaction &&
75
- transactions == o.transactions
83
+ id == o.id
76
84
  end
77
85
 
78
86
  # @see the `==` method
@@ -82,17 +90,28 @@ module YNAB
82
90
  end
83
91
 
84
92
  # Calculates hash code according to all attributes.
85
- # @return [Fixnum] Hash code
93
+ # @return [Integer] Hash code
86
94
  def hash
87
- [transaction, transactions].hash
95
+ [id].hash
88
96
  end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
89
105
  # Builds the object from hash
90
106
  # @param [Hash] attributes Model attributes in the form of hash
91
107
  # @return [Object] Returns the model itself
92
108
  def build_from_hash(attributes)
93
109
  return nil unless attributes.is_a?(Hash)
94
- self.class.swagger_types.each_pair do |key, type|
95
- if type =~ /\AArray<(.*)>/i
110
+ attributes = attributes.transform_keys(&:to_sym)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
+ self.send("#{key}=", nil)
114
+ elsif type =~ /\AArray<(.*)>/i
96
115
  # check to ensure the input is an array given that the attribute
97
116
  # is documented as an array but the input is not
98
117
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -100,7 +119,7 @@ module YNAB
100
119
  end
101
120
  elsif !attributes[self.class.attribute_map[key]].nil?
102
121
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
103
- end # or else data not found in attributes(hash), not an issue as the data can be optional
122
+ end
104
123
  end
105
124
 
106
125
  self
@@ -112,8 +131,8 @@ module YNAB
112
131
  # @return [Object] Deserialized data
113
132
  def _deserialize(type, value)
114
133
  case type.to_sym
115
- when :DateTime
116
- DateTime.parse(value)
134
+ when :Time
135
+ Time.parse(value)
117
136
  when :Date
118
137
  Date.parse(value)
119
138
  when :String
@@ -122,7 +141,7 @@ module YNAB
122
141
  value.to_i
123
142
  when :Float
124
143
  value.to_f
125
- when :BOOLEAN
144
+ when :Boolean
126
145
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
127
146
  true
128
147
  else
@@ -143,8 +162,9 @@ module YNAB
143
162
  end
144
163
  end
145
164
  else # model
146
- temp_model = YNAB.const_get(type).new
147
- temp_model.build_from_hash(value)
165
+ # models (e.g. Pet) or oneOf
166
+ klass = YNAB.const_get(type)
167
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
148
168
  end
149
169
  end
150
170
 
@@ -166,7 +186,11 @@ module YNAB
166
186
  hash = {}
167
187
  self.class.attribute_map.each_pair do |attr, param|
168
188
  value = self.send(attr)
169
- next if value.nil?
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
170
194
  hash[param] = _to_hash(value)
171
195
  end
172
196
  hash