ynab 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/DEVELOPMENT.md +6 -2
  3. data/Gemfile.lock +1 -1
  4. data/README.md +4 -2
  5. data/docs/BulkTransactions.md +1 -1
  6. data/docs/CategoriesApi.md +22 -0
  7. data/docs/ExistingTransaction.md +18 -0
  8. data/docs/HybridTransaction.md +3 -2
  9. data/docs/NewTransaction.md +19 -0
  10. data/docs/PatchCategoryWrapper.md +8 -0
  11. data/docs/PatchPayeeWrapper.md +8 -0
  12. data/docs/PatchTransactionsWrapper.md +1 -1
  13. data/docs/PayeesApi.md +22 -0
  14. data/docs/PostTransactionsWrapper.md +2 -2
  15. data/docs/PutTransactionWrapper.md +1 -1
  16. data/docs/SaveCategory.md +10 -0
  17. data/docs/SavePayee.md +8 -0
  18. data/docs/SavePayeeResponse.md +8 -0
  19. data/docs/SavePayeeResponseData.md +9 -0
  20. data/docs/SaveTransactionWithIdOrImportId.md +20 -0
  21. data/docs/SaveTransactionWithOptionalFields.md +2 -3
  22. data/docs/ScheduledTransactionDetail.md +2 -1
  23. data/docs/ScheduledTransactionSummary.md +2 -1
  24. data/docs/TransactionClearedStatus.md +7 -0
  25. data/docs/TransactionDetail.md +3 -2
  26. data/docs/TransactionFlagColor.md +7 -0
  27. data/docs/TransactionSummary.md +3 -2
  28. data/docs/TransactionsApi.md +7 -7
  29. data/lib/ynab/api/accounts_api.rb +2 -2
  30. data/lib/ynab/api/budgets_api.rb +2 -2
  31. data/lib/ynab/api/categories_api.rb +82 -2
  32. data/lib/ynab/api/months_api.rb +2 -2
  33. data/lib/ynab/api/payee_locations_api.rb +2 -2
  34. data/lib/ynab/api/payees_api.rb +82 -2
  35. data/lib/ynab/api/scheduled_transactions_api.rb +2 -2
  36. data/lib/ynab/api/transactions_api.rb +12 -28
  37. data/lib/ynab/api/user_api.rb +2 -2
  38. data/lib/ynab/api_client.rb +2 -2
  39. data/lib/ynab/configuration.rb +14 -11
  40. data/lib/ynab/models/account.rb +13 -56
  41. data/lib/ynab/models/account_response.rb +13 -24
  42. data/lib/ynab/models/account_response_data.rb +13 -24
  43. data/lib/ynab/models/account_type.rb +2 -2
  44. data/lib/ynab/models/accounts_response.rb +13 -24
  45. data/lib/ynab/models/accounts_response_data.rb +13 -28
  46. data/lib/ynab/models/budget_detail.rb +13 -29
  47. data/lib/ynab/models/budget_detail_response.rb +13 -24
  48. data/lib/ynab/models/budget_detail_response_data.rb +13 -28
  49. data/lib/ynab/models/budget_settings.rb +13 -20
  50. data/lib/ynab/models/budget_settings_response.rb +13 -24
  51. data/lib/ynab/models/budget_settings_response_data.rb +13 -24
  52. data/lib/ynab/models/budget_summary.rb +13 -28
  53. data/lib/ynab/models/budget_summary_response.rb +13 -24
  54. data/lib/ynab/models/budget_summary_response_data.rb +13 -24
  55. data/lib/ynab/models/bulk_response.rb +13 -24
  56. data/lib/ynab/models/bulk_response_data.rb +13 -24
  57. data/lib/ynab/models/bulk_response_data_bulk.rb +13 -28
  58. data/lib/ynab/models/bulk_transactions.rb +14 -25
  59. data/lib/ynab/models/categories_response.rb +13 -24
  60. data/lib/ynab/models/categories_response_data.rb +13 -28
  61. data/lib/ynab/models/category.rb +13 -56
  62. data/lib/ynab/models/category_group.rb +13 -36
  63. data/lib/ynab/models/category_group_with_categories.rb +14 -42
  64. data/lib/ynab/models/category_group_with_categories_all_of.rb +0 -4
  65. data/lib/ynab/models/category_response.rb +13 -24
  66. data/lib/ynab/models/category_response_data.rb +13 -24
  67. data/lib/ynab/models/currency_format.rb +13 -52
  68. data/lib/ynab/models/date_format.rb +13 -24
  69. data/lib/ynab/models/error_detail.rb +13 -32
  70. data/lib/ynab/models/error_response.rb +13 -24
  71. data/lib/ynab/models/existing_transaction.rb +359 -0
  72. data/lib/ynab/models/hybrid_transaction.rb +28 -95
  73. data/lib/ynab/models/hybrid_transaction_all_of.rb +0 -12
  74. data/lib/ynab/models/hybrid_transactions_response.rb +13 -24
  75. data/lib/ynab/models/hybrid_transactions_response_data.rb +13 -24
  76. data/lib/ynab/models/month_detail.rb +13 -49
  77. data/lib/ynab/models/month_detail_all_of.rb +0 -4
  78. data/lib/ynab/models/month_detail_response.rb +13 -24
  79. data/lib/ynab/models/month_detail_response_data.rb +13 -24
  80. data/lib/ynab/models/month_summaries_response.rb +13 -24
  81. data/lib/ynab/models/month_summaries_response_data.rb +13 -28
  82. data/lib/ynab/models/month_summary.rb +13 -44
  83. data/lib/ynab/models/new_transaction.rb +377 -0
  84. data/lib/ynab/models/patch_category_wrapper.rb +213 -0
  85. data/lib/ynab/models/patch_month_category_wrapper.rb +13 -24
  86. data/lib/ynab/models/patch_payee_wrapper.rb +213 -0
  87. data/lib/ynab/models/patch_transactions_wrapper.rb +14 -25
  88. data/lib/ynab/models/payee.rb +13 -32
  89. data/lib/ynab/models/payee_location.rb +13 -40
  90. data/lib/ynab/models/payee_location_response.rb +13 -24
  91. data/lib/ynab/models/payee_location_response_data.rb +13 -24
  92. data/lib/ynab/models/payee_locations_response.rb +13 -24
  93. data/lib/ynab/models/payee_locations_response_data.rb +13 -24
  94. data/lib/ynab/models/payee_response.rb +13 -24
  95. data/lib/ynab/models/payee_response_data.rb +13 -24
  96. data/lib/ynab/models/payees_response.rb +13 -24
  97. data/lib/ynab/models/payees_response_data.rb +13 -28
  98. data/lib/ynab/models/post_account_wrapper.rb +13 -24
  99. data/lib/ynab/models/post_transactions_wrapper.rb +15 -22
  100. data/lib/ynab/models/put_transaction_wrapper.rb +14 -25
  101. data/lib/ynab/models/save_account.rb +13 -32
  102. data/lib/ynab/models/save_category.rb +232 -0
  103. data/lib/ynab/models/save_category_response.rb +13 -24
  104. data/lib/ynab/models/save_category_response_data.rb +13 -28
  105. data/lib/ynab/models/save_month_category.rb +13 -24
  106. data/lib/ynab/models/save_payee.rb +220 -0
  107. data/lib/ynab/models/save_payee_response.rb +213 -0
  108. data/lib/ynab/models/save_payee_response_data.rb +224 -0
  109. data/lib/ynab/models/save_sub_transaction.rb +13 -40
  110. data/lib/ynab/models/save_transaction.rb +0 -32
  111. data/lib/ynab/models/save_transaction_with_id.rb +0 -32
  112. data/lib/ynab/models/save_transaction_with_id_or_import_id.rb +388 -0
  113. data/lib/ynab/models/save_transaction_with_optional_fields.rb +17 -91
  114. data/lib/ynab/models/save_transactions_response.rb +13 -24
  115. data/lib/ynab/models/save_transactions_response_data.rb +13 -28
  116. data/lib/ynab/models/scheduled_sub_transaction.rb +13 -36
  117. data/lib/ynab/models/scheduled_transaction_detail.rb +26 -76
  118. data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +0 -8
  119. data/lib/ynab/models/scheduled_transaction_response.rb +13 -24
  120. data/lib/ynab/models/scheduled_transaction_response_data.rb +13 -24
  121. data/lib/ynab/models/scheduled_transaction_summary.rb +26 -67
  122. data/lib/ynab/models/scheduled_transactions_response.rb +13 -24
  123. data/lib/ynab/models/scheduled_transactions_response_data.rb +13 -28
  124. data/lib/ynab/models/sub_transaction.rb +13 -36
  125. data/lib/ynab/models/transaction_cleared_status.rb +41 -0
  126. data/lib/ynab/models/transaction_detail.rb +28 -91
  127. data/lib/ynab/models/transaction_detail_all_of.rb +0 -8
  128. data/lib/ynab/models/transaction_flag_color.rb +45 -0
  129. data/lib/ynab/models/transaction_response.rb +13 -24
  130. data/lib/ynab/models/transaction_response_data.rb +13 -24
  131. data/lib/ynab/models/transaction_summary.rb +28 -82
  132. data/lib/ynab/models/transactions_import_response.rb +13 -24
  133. data/lib/ynab/models/transactions_import_response_data.rb +13 -24
  134. data/lib/ynab/models/transactions_response.rb +13 -24
  135. data/lib/ynab/models/transactions_response_data.rb +13 -28
  136. data/lib/ynab/models/user.rb +13 -24
  137. data/lib/ynab/models/user_response.rb +13 -24
  138. data/lib/ynab/models/user_response_data.rb +13 -24
  139. data/lib/ynab/version.rb +1 -1
  140. data/lib/ynab.rb +13 -12
  141. data/open_api_spec.yaml +455 -343
  142. data/templates/api.mustache +213 -0
  143. data/templates/partial_model_generic.mustache +305 -0
  144. data/ynab.gemspec +4 -3
  145. metadata +31 -7
@@ -0,0 +1,213 @@
1
+ =begin
2
+ {{> api_info}}
3
+ =end
4
+
5
+ require 'cgi'
6
+
7
+ module {{moduleName}}
8
+ {{#operations}}
9
+ class {{classname}}
10
+ attr_accessor :api_client
11
+
12
+ def initialize(api_client = ApiClient.default)
13
+ @api_client = api_client
14
+ end
15
+ {{#operation}}
16
+ {{#summary}}
17
+ # {{{.}}}
18
+ {{/summary}}
19
+ {{#notes}}
20
+ # {{{.}}}
21
+ {{/notes}}
22
+ {{#vendorExtensions.x-group-parameters}}
23
+ # @param [Hash] opts the parameters
24
+ {{#allParams}}
25
+ {{#required}}
26
+ # @option opts [{{{dataType}}}] :{{paramName}} {{description}} (required)
27
+ {{/required}}
28
+ {{/allParams}}
29
+ {{/vendorExtensions.x-group-parameters}}
30
+ {{^vendorExtensions.x-group-parameters}}
31
+ {{#allParams}}
32
+ {{#required}}
33
+ # @param {{paramName}} [{{{dataType}}}] {{description}}
34
+ {{/required}}
35
+ {{/allParams}}
36
+ # @param [Hash] opts the optional parameters
37
+ {{/vendorExtensions.x-group-parameters}}
38
+ {{#allParams}}
39
+ {{^required}}
40
+ # @option opts [{{{dataType}}}] :{{paramName}} {{description}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
41
+ {{/required}}
42
+ {{/allParams}}
43
+ # @return [{{{returnType}}}{{^returnType}}nil{{/returnType}}]
44
+ def {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}opts = {})
45
+ {{#returnType}}data, _status_code, _headers = {{/returnType}}{{operationId}}_with_http_info({{^vendorExtensions.x-group-parameters}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}opts)
46
+ {{#returnType}}data{{/returnType}}{{^returnType}}nil{{/returnType}}
47
+ end
48
+
49
+ {{#summary}}
50
+ # {{.}}
51
+ {{/summary}}
52
+ {{#notes}}
53
+ # {{.}}
54
+ {{/notes}}
55
+ {{#vendorExtensions.x-group-parameters}}
56
+ # @param [Hash] opts the parameters
57
+ {{#allParams}}
58
+ {{#required}}
59
+ # @option opts [{{{dataType}}}] :{{paramName}} {{description}} (required)
60
+ {{/required}}
61
+ {{/allParams}}
62
+ {{/vendorExtensions.x-group-parameters}}
63
+ {{^vendorExtensions.x-group-parameters}}
64
+ {{#allParams}}
65
+ {{#required}}
66
+ # @param {{paramName}} [{{{dataType}}}] {{description}}
67
+ {{/required}}
68
+ {{/allParams}}
69
+ # @param [Hash] opts the optional parameters
70
+ {{/vendorExtensions.x-group-parameters}}
71
+ {{#allParams}}
72
+ {{^required}}
73
+ # @option opts [{{{dataType}}}] :{{paramName}} {{description}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
74
+ {{/required}}
75
+ {{/allParams}}
76
+ # @return [Array<({{{returnType}}}{{^returnType}}nil{{/returnType}}, Integer, Hash)>] {{#returnType}}{{{.}}} data{{/returnType}}{{^returnType}}nil{{/returnType}}, response status code and response headers
77
+ def {{operationId}}_with_http_info({{^vendorExtensions.x-group-parameters}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}opts = {})
78
+ if @api_client.config.debugging
79
+ @api_client.config.logger.debug 'Calling API: {{classname}}.{{operationId}} ...'
80
+ end
81
+ {{#vendorExtensions.x-group-parameters}}
82
+ # unbox the parameters from the hash
83
+ {{#allParams}}
84
+ {{^isNullable}}
85
+ {{#required}}
86
+ {{{paramName}}} = opts[:'{{{paramName}}}']
87
+ {{/required}}
88
+ {{/isNullable}}
89
+ {{/allParams}}
90
+ {{/vendorExtensions.x-group-parameters}}
91
+ {{#allParams}}
92
+ {{^isNullable}}
93
+ {{#required}}
94
+ # verify the required parameter '{{paramName}}' is set
95
+ if @api_client.config.client_side_validation && {{{paramName}}}.nil?
96
+ fail ArgumentError, "Missing the required parameter '{{paramName}}' when calling {{classname}}.{{operationId}}"
97
+ end
98
+ {{#isEnum}}
99
+ {{^isContainer}}
100
+ {{/isContainer}}
101
+ {{/isEnum}}
102
+ {{/required}}
103
+ {{/isNullable}}
104
+ {{^required}}
105
+ {{#isEnum}}
106
+ {{#collectionFormat}}
107
+ {{/collectionFormat}}
108
+ {{^collectionFormat}}
109
+ {{/collectionFormat}}
110
+ {{/isEnum}}
111
+ {{/required}}
112
+ {{#hasValidation}}
113
+ {{#maxLength}}
114
+ {{/maxLength}}
115
+ {{#minLength}}
116
+ {{/minLength}}
117
+ {{#maximum}}
118
+ {{/maximum}}
119
+ {{#minimum}}
120
+ {{/minimum}}
121
+ {{#pattern}}
122
+ {{/pattern}}
123
+ {{#maxItems}}
124
+ {{/maxItems}}
125
+ {{#minItems}}
126
+ {{/minItems}}
127
+ {{/hasValidation}}
128
+ {{/allParams}}
129
+ # resource path
130
+ local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', CGI.escape({{paramName}}.to_s){{^strictSpecBehavior}}.gsub('%2F', '/'){{/strictSpecBehavior}}){{/pathParams}}
131
+
132
+ # query parameters
133
+ query_params = opts[:query_params] || {}
134
+ {{#queryParams}}
135
+ {{#required}}
136
+ query_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
137
+ {{/required}}
138
+ {{/queryParams}}
139
+ {{#queryParams}}
140
+ {{^required}}
141
+ query_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{{paramName}}}'].nil?
142
+ {{/required}}
143
+ {{/queryParams}}
144
+
145
+ # header parameters
146
+ header_params = opts[:header_params] || {}
147
+ {{#hasProduces}}
148
+ # HTTP header 'Accept' (if needed)
149
+ header_params['Accept'] = @api_client.select_header_accept([{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}])
150
+ {{/hasProduces}}
151
+ {{#hasConsumes}}
152
+ # HTTP header 'Content-Type'
153
+ content_type = @api_client.select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}])
154
+ if !content_type.nil?
155
+ header_params['Content-Type'] = content_type
156
+ end
157
+ {{/hasConsumes}}
158
+ {{#headerParams}}
159
+ {{#required}}
160
+ header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
161
+ {{/required}}
162
+ {{/headerParams}}
163
+ {{#headerParams}}
164
+ {{^required}}
165
+ header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{{paramName}}}'].nil?
166
+ {{/required}}
167
+ {{/headerParams}}
168
+
169
+ # form parameters
170
+ form_params = opts[:form_params] || {}
171
+ {{#formParams}}
172
+ {{#required}}
173
+ form_params['{{baseName}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
174
+ {{/required}}
175
+ {{/formParams}}
176
+ {{#formParams}}
177
+ {{^required}}
178
+ form_params['{{baseName}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{paramName}}'].nil?
179
+ {{/required}}
180
+ {{/formParams}}
181
+
182
+ # http body (model)
183
+ post_body = opts[:debug_body]{{#bodyParam}} || @api_client.object_to_http_body({{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}){{/bodyParam}}
184
+
185
+ # return_type
186
+ return_type = opts[:debug_return_type]{{#returnType}} || '{{{.}}}'{{/returnType}}
187
+
188
+ # auth_names
189
+ auth_names = opts[:debug_auth_names] || [{{#authMethods}}'{{name}}'{{^-last}}, {{/-last}}{{/authMethods}}]
190
+
191
+ new_options = opts.merge(
192
+ :operation => :"{{classname}}.{{operationId}}",
193
+ :header_params => header_params,
194
+ :query_params => query_params,
195
+ :form_params => form_params,
196
+ :body => post_body,
197
+ :auth_names => auth_names,
198
+ :return_type => return_type
199
+ )
200
+
201
+ data, status_code, headers = @api_client.call_api(:{{httpMethod}}, local_var_path, new_options)
202
+ if @api_client.config.debugging
203
+ @api_client.config.logger.debug "API called: {{classname}}#{{operationId}}\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
204
+ end
205
+ return data, status_code, headers
206
+ end
207
+ {{^-last}}
208
+
209
+ {{/-last}}
210
+ {{/operation}}
211
+ end
212
+ {{/operations}}
213
+ end
@@ -0,0 +1,305 @@
1
+ {{#description}}
2
+ # {{{.}}}
3
+ {{/description}}
4
+ class {{classname}}{{#parent}} < {{{.}}}{{/parent}}
5
+ {{#vars}}
6
+ {{#description}}
7
+ # {{{.}}}
8
+ {{/description}}
9
+ attr_accessor :{{{name}}}
10
+
11
+ {{/vars}}
12
+ {{#hasEnums}}
13
+ class EnumAttributeValidator
14
+ attr_reader :datatype
15
+ attr_reader :allowable_values
16
+
17
+ def initialize(datatype, allowable_values)
18
+ @allowable_values = allowable_values.map do |value|
19
+ case datatype.to_s
20
+ when /Integer/i
21
+ value.to_i
22
+ when /Float/i
23
+ value.to_f
24
+ else
25
+ value
26
+ end
27
+ end
28
+ end
29
+
30
+ def valid?(value)
31
+ !value || allowable_values.include?(value)
32
+ end
33
+ end
34
+
35
+ {{/hasEnums}}
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ {{#vars}}
40
+ :'{{{name}}}' => :'{{{baseName}}}'{{^-last}},{{/-last}}
41
+ {{/vars}}
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about{{#parent}}, including the ones defined in its parent(s){{/parent}}
46
+ def self.acceptable_attributes
47
+ {{^parent}}
48
+ attribute_map.values
49
+ {{/parent}}
50
+ {{#parent}}
51
+ attribute_map.values.concat(superclass.acceptable_attributes)
52
+ {{/parent}}
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.openapi_types
57
+ {
58
+ {{#vars}}
59
+ :'{{{name}}}' => :'{{{dataType}}}'{{^-last}},{{/-last}}
60
+ {{/vars}}
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ {{#vars}}
68
+ {{#isNullable}}
69
+ :'{{{name}}}'{{^-last}},{{/-last}}
70
+ {{/isNullable}}
71
+ {{/vars}}
72
+ ])
73
+ end
74
+
75
+ {{#anyOf}}
76
+ {{#-first}}
77
+ # List of class defined in anyOf (OpenAPI v3)
78
+ def self.openapi_any_of
79
+ [
80
+ {{/-first}}
81
+ :'{{{.}}}'{{^-last}},{{/-last}}
82
+ {{#-last}}
83
+ ]
84
+ end
85
+
86
+ {{/-last}}
87
+ {{/anyOf}}
88
+ {{#allOf}}
89
+ {{#-first}}
90
+ # List of class defined in allOf (OpenAPI v3)
91
+ def self.openapi_all_of
92
+ [
93
+ {{/-first}}
94
+ :'{{{.}}}'{{^-last}},{{/-last}}
95
+ {{#-last}}
96
+ ]
97
+ end
98
+
99
+ {{/-last}}
100
+ {{/allOf}}
101
+ {{#discriminator}}
102
+ {{#propertyName}}
103
+ # discriminator's property name in OpenAPI v3
104
+ def self.openapi_discriminator_name
105
+ :'{{{.}}}'
106
+ end
107
+
108
+ {{/propertyName}}
109
+ {{/discriminator}}
110
+ # Initializes the object
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ def initialize(attributes = {})
113
+ if (!attributes.is_a?(Hash))
114
+ fail ArgumentError, "The input argument (attributes) must be a hash in `{{{moduleName}}}::{{{classname}}}` initialize method"
115
+ end
116
+
117
+ # check to see if the attribute exists and convert string to symbol for hash key
118
+ attributes = attributes.each_with_object({}) { |(k, v), h|
119
+ if (!self.class.attribute_map.key?(k.to_sym))
120
+ fail ArgumentError, "`#{k}` is not a valid attribute in `{{{moduleName}}}::{{{classname}}}`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
121
+ end
122
+ h[k.to_sym] = v
123
+ }
124
+ {{#parent}}
125
+
126
+ # call parent's initialize
127
+ super(attributes)
128
+ {{/parent}}
129
+ {{#vars}}
130
+
131
+ if attributes.key?(:'{{{name}}}')
132
+ {{#isArray}}
133
+ if (value = attributes[:'{{{name}}}']).is_a?(Array)
134
+ self.{{{name}}} = value
135
+ end
136
+ {{/isArray}}
137
+ {{#isMap}}
138
+ if (value = attributes[:'{{{name}}}']).is_a?(Hash)
139
+ self.{{{name}}} = value
140
+ end
141
+ {{/isMap}}
142
+ {{^isContainer}}
143
+ self.{{{name}}} = attributes[:'{{{name}}}']
144
+ {{/isContainer}}
145
+ {{#defaultValue}}
146
+ else
147
+ self.{{{name}}} = {{{defaultValue}}}
148
+ {{/defaultValue}}
149
+ end
150
+ {{/vars}}
151
+ end
152
+
153
+ # Show invalid properties with the reasons. Usually used together with valid?
154
+ # @return Array for valid properties with the reasons
155
+ def list_invalid_properties
156
+ invalid_properties = {{^parent}}Array.new{{/parent}}{{#parent}}super{{/parent}}
157
+ {{#vars}}
158
+ {{^isNullable}}
159
+ {{#required}}
160
+ {{/required}}
161
+ {{/isNullable}}
162
+ {{#hasValidation}}
163
+ {{#maxLength}}
164
+ {{/maxLength}}
165
+ {{#minLength}}
166
+ {{/minLength}}
167
+ {{#maximum}}
168
+ {{/maximum}}
169
+ {{#minimum}}
170
+ {{/minimum}}
171
+ {{#pattern}}
172
+ {{/pattern}}
173
+ {{#maxItems}}
174
+ {{/maxItems}}
175
+ {{#minItems}}
176
+ {{/minItems}}
177
+ {{/hasValidation}}
178
+ {{/vars}}
179
+ invalid_properties
180
+ end
181
+
182
+ # Check to see if the all the properties in the model are valid
183
+ # @return true if the model is valid
184
+ def valid?
185
+ {{#vars}}
186
+ {{^isNullable}}
187
+ {{#required}}
188
+ return false if @{{{name}}}.nil?
189
+ {{/required}}
190
+ {{/isNullable}}
191
+ {{#isEnum}}
192
+ {{^isContainer}}
193
+ {{{name}}}_validator = EnumAttributeValidator.new('{{{dataType}}}', [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}])
194
+ return false unless {{{name}}}_validator.valid?(@{{{name}}})
195
+ {{/isContainer}}
196
+ {{/isEnum}}
197
+ {{#hasValidation}}
198
+ {{#maxLength}}
199
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}}
200
+ {{/maxLength}}
201
+ {{#minLength}}
202
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length < {{{minLength}}}
203
+ {{/minLength}}
204
+ {{#maximum}}
205
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
206
+ {{/maximum}}
207
+ {{#minimum}}
208
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
209
+ {{/minimum}}
210
+ {{#pattern}}
211
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} !~ Regexp.new({{{pattern}}})
212
+ {{/pattern}}
213
+ {{#maxItems}}
214
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length > {{{maxItems}}}
215
+ {{/maxItems}}
216
+ {{#minItems}}
217
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length < {{{minItems}}}
218
+ {{/minItems}}
219
+ {{/hasValidation}}
220
+ {{/vars}}
221
+ {{#anyOf}}
222
+ {{#-first}}
223
+ _any_of_found = false
224
+ self.class.openapi_any_of.each do |_class|
225
+ _any_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_hash)
226
+ if _any_of.valid?
227
+ _any_of_found = true
228
+ end
229
+ end
230
+
231
+ if !_any_of_found
232
+ return false
233
+ end
234
+
235
+ {{/-first}}
236
+ {{/anyOf}}
237
+ true{{#parent}} && super{{/parent}}
238
+ end
239
+
240
+ {{#vars}}
241
+ {{#isEnum}}
242
+ {{^isContainer}}
243
+ # Custom attribute writer method checking allowed values (enum).
244
+ # @param [Object] {{{name}}} Object to be assigned
245
+ def {{{name}}}=({{{name}}})
246
+ @{{{name}}} = {{{name}}}
247
+ end
248
+
249
+ {{/isContainer}}
250
+ {{/isEnum}}
251
+ {{^isEnum}}
252
+ {{#hasValidation}}
253
+ # Custom attribute writer method with validation
254
+ # @param [Object] {{{name}}} Value to be assigned
255
+ def {{{name}}}=({{{name}}})
256
+ {{^isNullable}}
257
+ {{#required}}
258
+ if {{{name}}}.nil?
259
+ fail ArgumentError, '{{{name}}} cannot be nil'
260
+ end
261
+
262
+ {{/required}}
263
+ {{/isNullable}}
264
+ {{#maxLength}}
265
+ {{/maxLength}}
266
+ {{#minLength}}
267
+ {{/minLength}}
268
+ {{#maximum}}
269
+ {{/maximum}}
270
+ {{#minimum}}
271
+ {{/minimum}}
272
+ {{#pattern}}
273
+ {{/pattern}}
274
+ {{#maxItems}}
275
+ {{/maxItems}}
276
+ {{#minItems}}
277
+ {{/minItems}}
278
+ @{{{name}}} = {{{name}}}
279
+ end
280
+
281
+ {{/hasValidation}}
282
+ {{/isEnum}}
283
+ {{/vars}}
284
+ # Checks equality by comparing each attribute.
285
+ # @param [Object] Object to be compared
286
+ def ==(o)
287
+ return true if self.equal?(o)
288
+ self.class == o.class{{#vars}} &&
289
+ {{name}} == o.{{name}}{{/vars}}{{#parent}} && super(o){{/parent}}
290
+ end
291
+
292
+ # @see the `==` method
293
+ # @param [Object] Object to be compared
294
+ def eql?(o)
295
+ self == o
296
+ end
297
+
298
+ # Calculates hash code according to all attributes.
299
+ # @return [Integer] Hash code
300
+ def hash
301
+ [{{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}].hash
302
+ end
303
+
304
+ {{> base_object}}
305
+ end
data/ynab.gemspec CHANGED
@@ -5,10 +5,10 @@
5
5
 
6
6
  #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
7
7
 
8
- The version of the OpenAPI document: 1.0.0
8
+ The version of the OpenAPI document: 1.69.0
9
9
 
10
10
  Generated by: https://openapi-generator.tech
11
- OpenAPI Generator version: 6.6.0
11
+ Generator version: 7.6.0
12
12
 
13
13
  =end
14
14
 
@@ -25,7 +25,8 @@ Gem::Specification.new do |s|
25
25
  s.summary = "YNAB API Endpoints Ruby Gem"
26
26
  s.description = "Ruby gem wrapper for the YNAB API. Read the documentation at https://api.ynab.com"
27
27
  s.license = "Apache-2.0"
28
- s.required_ruby_version = ">= 2.7"
28
+ s.required_ruby_version = ">= 3.3"
29
+ s.metadata = {}
29
30
 
30
31
  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
32
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ynab
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YNAB
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-31 00:00:00.000000000 Z
11
+ date: 2024-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -111,6 +111,7 @@ files:
111
111
  - docs/DeprecatedApi.md
112
112
  - docs/ErrorDetail.md
113
113
  - docs/ErrorResponse.md
114
+ - docs/ExistingTransaction.md
114
115
  - docs/HybridTransaction.md
115
116
  - docs/HybridTransactionAllOf.md
116
117
  - docs/HybridTransactionsResponse.md
@@ -127,7 +128,10 @@ files:
127
128
  - docs/MonthSummariesWrapper.md
128
129
  - docs/MonthSummary.md
129
130
  - docs/MonthsApi.md
131
+ - docs/NewTransaction.md
132
+ - docs/PatchCategoryWrapper.md
130
133
  - docs/PatchMonthCategoryWrapper.md
134
+ - docs/PatchPayeeWrapper.md
131
135
  - docs/PatchTransactionsWrapper.md
132
136
  - docs/Payee.md
133
137
  - docs/PayeeLocation.md
@@ -150,14 +154,19 @@ files:
150
154
  - docs/PutTransactionWrapper.md
151
155
  - docs/SaveAccount.md
152
156
  - docs/SaveAccountWrapper.md
157
+ - docs/SaveCategory.md
153
158
  - docs/SaveCategoryResponse.md
154
159
  - docs/SaveCategoryResponseData.md
155
160
  - docs/SaveMonthCategory.md
156
161
  - docs/SaveMonthCategoryWrapper.md
162
+ - docs/SavePayee.md
163
+ - docs/SavePayeeResponse.md
164
+ - docs/SavePayeeResponseData.md
157
165
  - docs/SaveSubTransaction.md
158
166
  - docs/SaveTransaction.md
159
167
  - docs/SaveTransactionWithId.md
160
168
  - docs/SaveTransactionWithIdAllOf.md
169
+ - docs/SaveTransactionWithIdOrImportId.md
161
170
  - docs/SaveTransactionWithOptionalFields.md
162
171
  - docs/SaveTransactionWrapper.md
163
172
  - docs/SaveTransactionsResponse.md
@@ -175,8 +184,10 @@ files:
175
184
  - docs/ScheduledTransactionsResponseData.md
176
185
  - docs/ScheduledTransactionsWrapper.md
177
186
  - docs/SubTransaction.md
187
+ - docs/TransactionClearedStatus.md
178
188
  - docs/TransactionDetail.md
179
189
  - docs/TransactionDetailAllOf.md
190
+ - docs/TransactionFlagColor.md
180
191
  - docs/TransactionResponse.md
181
192
  - docs/TransactionResponseData.md
182
193
  - docs/TransactionSummary.md
@@ -247,6 +258,7 @@ files:
247
258
  - lib/ynab/models/date_format.rb
248
259
  - lib/ynab/models/error_detail.rb
249
260
  - lib/ynab/models/error_response.rb
261
+ - lib/ynab/models/existing_transaction.rb
250
262
  - lib/ynab/models/hybrid_transaction.rb
251
263
  - lib/ynab/models/hybrid_transaction_all_of.rb
252
264
  - lib/ynab/models/hybrid_transactions_response.rb
@@ -258,7 +270,10 @@ files:
258
270
  - lib/ynab/models/month_summaries_response.rb
259
271
  - lib/ynab/models/month_summaries_response_data.rb
260
272
  - lib/ynab/models/month_summary.rb
273
+ - lib/ynab/models/new_transaction.rb
274
+ - lib/ynab/models/patch_category_wrapper.rb
261
275
  - lib/ynab/models/patch_month_category_wrapper.rb
276
+ - lib/ynab/models/patch_payee_wrapper.rb
262
277
  - lib/ynab/models/patch_transactions_wrapper.rb
263
278
  - lib/ynab/models/payee.rb
264
279
  - lib/ynab/models/payee_location.rb
@@ -274,13 +289,18 @@ files:
274
289
  - lib/ynab/models/post_transactions_wrapper.rb
275
290
  - lib/ynab/models/put_transaction_wrapper.rb
276
291
  - lib/ynab/models/save_account.rb
292
+ - lib/ynab/models/save_category.rb
277
293
  - lib/ynab/models/save_category_response.rb
278
294
  - lib/ynab/models/save_category_response_data.rb
279
295
  - lib/ynab/models/save_month_category.rb
296
+ - lib/ynab/models/save_payee.rb
297
+ - lib/ynab/models/save_payee_response.rb
298
+ - lib/ynab/models/save_payee_response_data.rb
280
299
  - lib/ynab/models/save_sub_transaction.rb
281
300
  - lib/ynab/models/save_transaction.rb
282
301
  - lib/ynab/models/save_transaction_with_id.rb
283
302
  - lib/ynab/models/save_transaction_with_id_all_of.rb
303
+ - lib/ynab/models/save_transaction_with_id_or_import_id.rb
284
304
  - lib/ynab/models/save_transaction_with_optional_fields.rb
285
305
  - lib/ynab/models/save_transactions_response.rb
286
306
  - lib/ynab/models/save_transactions_response_data.rb
@@ -293,8 +313,10 @@ files:
293
313
  - lib/ynab/models/scheduled_transactions_response.rb
294
314
  - lib/ynab/models/scheduled_transactions_response_data.rb
295
315
  - lib/ynab/models/sub_transaction.rb
316
+ - lib/ynab/models/transaction_cleared_status.rb
296
317
  - lib/ynab/models/transaction_detail.rb
297
318
  - lib/ynab/models/transaction_detail_all_of.rb
319
+ - lib/ynab/models/transaction_flag_color.rb
298
320
  - lib/ynab/models/transaction_response.rb
299
321
  - lib/ynab/models/transaction_response_data.rb
300
322
  - lib/ynab/models/transaction_summary.rb
@@ -353,17 +375,19 @@ files:
353
375
  - spec/fixtures/vcr_cassettes/update_transaction.yml
354
376
  - spec/fixtures/vcr_cassettes/update_transactions.yml
355
377
  - spec/spec_helper.rb
378
+ - templates/api.mustache
356
379
  - templates/api_client.mustache
357
380
  - templates/api_client_typhoeus_partial.mustache
358
381
  - templates/api_doc.mustache
359
382
  - templates/gem.mustache
383
+ - templates/partial_model_generic.mustache
360
384
  - templates/partial_model_generic_doc.mustache
361
385
  - ynab.gemspec
362
386
  homepage: https://github.com/ynab/ynab-sdk-ruby
363
387
  licenses:
364
388
  - Apache-2.0
365
389
  metadata: {}
366
- post_install_message:
390
+ post_install_message:
367
391
  rdoc_options: []
368
392
  require_paths:
369
393
  - lib
@@ -371,15 +395,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
371
395
  requirements:
372
396
  - - ">="
373
397
  - !ruby/object:Gem::Version
374
- version: '2.7'
398
+ version: '3.3'
375
399
  required_rubygems_version: !ruby/object:Gem::Requirement
376
400
  requirements:
377
401
  - - ">="
378
402
  - !ruby/object:Gem::Version
379
403
  version: '0'
380
404
  requirements: []
381
- rubygems_version: 3.1.6
382
- signing_key:
405
+ rubygems_version: 3.5.9
406
+ signing_key:
383
407
  specification_version: 4
384
408
  summary: YNAB API Endpoints Ruby Gem
385
409
  test_files: