ynab 1.13.0 → 1.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/ynab.rb +6 -1
- data/lib/ynab/api/accounts_api.rb +3 -3
- data/lib/ynab/api/budgets_api.rb +6 -3
- data/lib/ynab/api/categories_api.rb +7 -7
- data/lib/ynab/api/deprecated_api.rb +1 -1
- data/lib/ynab/api/months_api.rb +3 -3
- data/lib/ynab/api/payee_locations_api.rb +1 -1
- data/lib/ynab/api/payees_api.rb +3 -3
- data/lib/ynab/api/scheduled_transactions_api.rb +3 -3
- data/lib/ynab/api/transactions_api.rb +77 -25
- data/lib/ynab/api/user_api.rb +1 -1
- data/lib/ynab/api_client.rb +3 -2
- data/lib/ynab/configuration.rb +2 -3
- data/lib/ynab/models/account.rb +3 -7
- data/lib/ynab/models/account_response.rb +3 -2
- data/lib/ynab/models/account_response_data.rb +3 -2
- data/lib/ynab/models/accounts_response.rb +3 -2
- data/lib/ynab/models/accounts_response_data.rb +3 -2
- data/lib/ynab/models/budget_detail.rb +3 -2
- data/lib/ynab/models/budget_detail_response.rb +3 -2
- data/lib/ynab/models/budget_detail_response_data.rb +3 -2
- data/lib/ynab/models/budget_settings.rb +3 -2
- data/lib/ynab/models/budget_settings_response.rb +3 -2
- data/lib/ynab/models/budget_settings_response_data.rb +3 -2
- data/lib/ynab/models/budget_summary.rb +19 -6
- data/lib/ynab/models/budget_summary_response.rb +3 -2
- data/lib/ynab/models/budget_summary_response_data.rb +3 -7
- data/lib/ynab/models/bulk_response.rb +3 -2
- data/lib/ynab/models/bulk_response_data.rb +3 -2
- data/lib/ynab/models/bulk_response_data_bulk.rb +4 -3
- data/lib/ynab/models/bulk_transactions.rb +3 -2
- data/lib/ynab/models/categories_response.rb +3 -2
- data/lib/ynab/models/categories_response_data.rb +3 -2
- data/lib/ynab/models/category.rb +7 -36
- data/lib/ynab/models/category_group.rb +3 -2
- data/lib/ynab/models/category_group_with_categories.rb +3 -2
- data/lib/ynab/models/category_response.rb +3 -2
- data/lib/ynab/models/category_response_data.rb +3 -2
- data/lib/ynab/models/currency_format.rb +3 -2
- data/lib/ynab/models/date_format.rb +3 -2
- data/lib/ynab/models/error_detail.rb +3 -2
- data/lib/ynab/models/error_response.rb +3 -2
- data/lib/ynab/models/hybrid_transaction.rb +4 -58
- data/lib/ynab/models/hybrid_transactions_response.rb +3 -2
- data/lib/ynab/models/hybrid_transactions_response_data.rb +3 -2
- data/lib/ynab/models/month_detail.rb +5 -14
- data/lib/ynab/models/month_detail_response.rb +3 -2
- data/lib/ynab/models/month_detail_response_data.rb +3 -2
- data/lib/ynab/models/month_summaries_response.rb +3 -2
- data/lib/ynab/models/month_summaries_response_data.rb +3 -2
- data/lib/ynab/models/month_summary.rb +5 -14
- data/lib/ynab/models/payee.rb +4 -8
- data/lib/ynab/models/payee_location.rb +3 -2
- data/lib/ynab/models/payee_location_response.rb +3 -2
- data/lib/ynab/models/payee_location_response_data.rb +3 -2
- data/lib/ynab/models/payee_locations_response.rb +3 -2
- data/lib/ynab/models/payee_locations_response_data.rb +3 -2
- data/lib/ynab/models/payee_response.rb +3 -2
- data/lib/ynab/models/payee_response_data.rb +3 -2
- data/lib/ynab/models/payees_response.rb +3 -2
- data/lib/ynab/models/payees_response_data.rb +3 -2
- data/lib/ynab/models/save_category_response.rb +3 -2
- data/lib/ynab/models/save_category_response_data.rb +3 -2
- data/lib/ynab/models/save_month_category.rb +3 -2
- data/lib/ynab/models/save_month_category_wrapper.rb +3 -2
- data/lib/ynab/models/save_sub_transaction.rb +259 -0
- data/lib/ynab/models/save_transaction.rb +23 -10
- data/lib/ynab/models/save_transaction_wrapper.rb +3 -2
- data/lib/ynab/models/save_transactions_response.rb +3 -2
- data/lib/ynab/models/save_transactions_response_data.rb +4 -3
- data/lib/ynab/models/save_transactions_wrapper.rb +3 -2
- data/lib/ynab/models/scheduled_sub_transaction.rb +3 -22
- data/lib/ynab/models/scheduled_transaction_detail.rb +3 -37
- data/lib/ynab/models/scheduled_transaction_response.rb +3 -2
- data/lib/ynab/models/scheduled_transaction_response_data.rb +3 -2
- data/lib/ynab/models/scheduled_transaction_summary.rb +3 -27
- data/lib/ynab/models/scheduled_transactions_response.rb +3 -2
- data/lib/ynab/models/scheduled_transactions_response_data.rb +3 -2
- data/lib/ynab/models/sub_transaction.rb +22 -23
- data/lib/ynab/models/transaction_detail.rb +3 -52
- data/lib/ynab/models/transaction_response.rb +3 -2
- data/lib/ynab/models/transaction_response_data.rb +3 -2
- data/lib/ynab/models/transaction_summary.rb +3 -42
- data/lib/ynab/models/transactions_import_response.rb +189 -0
- data/lib/ynab/models/transactions_import_response_data.rb +192 -0
- data/lib/ynab/models/transactions_response.rb +3 -2
- data/lib/ynab/models/transactions_response_data.rb +3 -2
- data/lib/ynab/models/update_transaction.rb +415 -0
- data/lib/ynab/models/update_transactions_wrapper.rb +191 -0
- data/lib/ynab/models/user.rb +3 -2
- data/lib/ynab/models/user_response.rb +3 -2
- data/lib/ynab/models/user_response_data.rb +3 -2
- data/lib/ynab/version.rb +1 -1
- data/spec/api/transactions_spec.rb +11 -0
- data/spec/fixtures/vcr_cassettes/import_transactions.yml +50 -0
- metadata +10 -3
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -145,7 +145,7 @@ module YNAB
|
|
145
145
|
return nil unless attributes.is_a?(Hash)
|
146
146
|
self.class.swagger_types.each_pair do |key, type|
|
147
147
|
if type =~ /\AArray<(.*)>/i
|
148
|
-
# check to ensure the input is an array given that the
|
148
|
+
# check to ensure the input is an array given that the attribute
|
149
149
|
# is documented as an array but the input is not
|
150
150
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
151
151
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -241,5 +241,6 @@ module YNAB
|
|
241
241
|
value
|
242
242
|
end
|
243
243
|
end
|
244
|
+
|
244
245
|
end
|
245
246
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -88,7 +88,7 @@ module YNAB
|
|
88
88
|
return nil unless attributes.is_a?(Hash)
|
89
89
|
self.class.swagger_types.each_pair do |key, type|
|
90
90
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
91
|
+
# check to ensure the input is an array given that the attribute
|
92
92
|
# is documented as an array but the input is not
|
93
93
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
94
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +184,6 @@ module YNAB
|
|
184
184
|
value
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
187
188
|
end
|
188
189
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -88,7 +88,7 @@ module YNAB
|
|
88
88
|
return nil unless attributes.is_a?(Hash)
|
89
89
|
self.class.swagger_types.each_pair do |key, type|
|
90
90
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
91
|
+
# check to ensure the input is an array given that the attribute
|
92
92
|
# is documented as an array but the input is not
|
93
93
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
94
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +184,6 @@ module YNAB
|
|
184
184
|
value
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
187
188
|
end
|
188
189
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -88,7 +88,7 @@ module YNAB
|
|
88
88
|
return nil unless attributes.is_a?(Hash)
|
89
89
|
self.class.swagger_types.each_pair do |key, type|
|
90
90
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
91
|
+
# check to ensure the input is an array given that the attribute
|
92
92
|
# is documented as an array but the input is not
|
93
93
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
94
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +184,6 @@ module YNAB
|
|
184
184
|
value
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
187
188
|
end
|
188
189
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -90,7 +90,7 @@ module YNAB
|
|
90
90
|
return nil unless attributes.is_a?(Hash)
|
91
91
|
self.class.swagger_types.each_pair do |key, type|
|
92
92
|
if type =~ /\AArray<(.*)>/i
|
93
|
-
# check to ensure the input is an array given that the
|
93
|
+
# check to ensure the input is an array given that the attribute
|
94
94
|
# is documented as an array but the input is not
|
95
95
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
96
96
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -186,5 +186,6 @@ module YNAB
|
|
186
186
|
value
|
187
187
|
end
|
188
188
|
end
|
189
|
+
|
189
190
|
end
|
190
191
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -88,7 +88,7 @@ module YNAB
|
|
88
88
|
return nil unless attributes.is_a?(Hash)
|
89
89
|
self.class.swagger_types.each_pair do |key, type|
|
90
90
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
91
|
+
# check to ensure the input is an array given that the attribute
|
92
92
|
# is documented as an array but the input is not
|
93
93
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
94
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +184,6 @@ module YNAB
|
|
184
184
|
value
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
187
188
|
end
|
188
189
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -88,7 +88,7 @@ module YNAB
|
|
88
88
|
return nil unless attributes.is_a?(Hash)
|
89
89
|
self.class.swagger_types.each_pair do |key, type|
|
90
90
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
91
|
+
# check to ensure the input is an array given that the attribute
|
92
92
|
# is documented as an array but the input is not
|
93
93
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
94
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +184,6 @@ module YNAB
|
|
184
184
|
value
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
187
188
|
end
|
188
189
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -88,7 +88,7 @@ module YNAB
|
|
88
88
|
return nil unless attributes.is_a?(Hash)
|
89
89
|
self.class.swagger_types.each_pair do |key, type|
|
90
90
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
91
|
+
# check to ensure the input is an array given that the attribute
|
92
92
|
# is documented as an array but the input is not
|
93
93
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
94
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +184,6 @@ module YNAB
|
|
184
184
|
value
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
187
188
|
end
|
188
189
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -105,7 +105,7 @@ module YNAB
|
|
105
105
|
return nil unless attributes.is_a?(Hash)
|
106
106
|
self.class.swagger_types.each_pair do |key, type|
|
107
107
|
if type =~ /\AArray<(.*)>/i
|
108
|
-
# check to ensure the input is an array given that the
|
108
|
+
# check to ensure the input is an array given that the attribute
|
109
109
|
# is documented as an array but the input is not
|
110
110
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
111
111
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -201,5 +201,6 @@ module YNAB
|
|
201
201
|
value
|
202
202
|
end
|
203
203
|
end
|
204
|
+
|
204
205
|
end
|
205
206
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -88,7 +88,7 @@ module YNAB
|
|
88
88
|
return nil unless attributes.is_a?(Hash)
|
89
89
|
self.class.swagger_types.each_pair do |key, type|
|
90
90
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
91
|
+
# check to ensure the input is an array given that the attribute
|
92
92
|
# is documented as an array but the input is not
|
93
93
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
94
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +184,6 @@ module YNAB
|
|
184
184
|
value
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
187
188
|
end
|
188
189
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -103,7 +103,7 @@ module YNAB
|
|
103
103
|
return nil unless attributes.is_a?(Hash)
|
104
104
|
self.class.swagger_types.each_pair do |key, type|
|
105
105
|
if type =~ /\AArray<(.*)>/i
|
106
|
-
# check to ensure the input is an array given that the
|
106
|
+
# check to ensure the input is an array given that the attribute
|
107
107
|
# is documented as an array but the input is not
|
108
108
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
109
109
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -199,5 +199,6 @@ module YNAB
|
|
199
199
|
value
|
200
200
|
end
|
201
201
|
end
|
202
|
+
|
202
203
|
end
|
203
204
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -89,7 +89,7 @@ module YNAB
|
|
89
89
|
return nil unless attributes.is_a?(Hash)
|
90
90
|
self.class.swagger_types.each_pair do |key, type|
|
91
91
|
if type =~ /\AArray<(.*)>/i
|
92
|
-
# check to ensure the input is an array given that the
|
92
|
+
# check to ensure the input is an array given that the attribute
|
93
93
|
# is documented as an array but the input is not
|
94
94
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
95
95
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -185,5 +185,6 @@ module YNAB
|
|
185
185
|
value
|
186
186
|
end
|
187
187
|
end
|
188
|
+
|
188
189
|
end
|
189
190
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -88,7 +88,7 @@ module YNAB
|
|
88
88
|
return nil unless attributes.is_a?(Hash)
|
89
89
|
self.class.swagger_types.each_pair do |key, type|
|
90
90
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
91
|
+
# check to ensure the input is an array given that the attribute
|
92
92
|
# is documented as an array but the input is not
|
93
93
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
94
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +184,6 @@ module YNAB
|
|
184
184
|
value
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
187
188
|
end
|
188
189
|
end
|
@@ -0,0 +1,259 @@
|
|
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.youneedabudget.com
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module YNAB
|
16
|
+
class SaveSubTransaction
|
17
|
+
# The subtransaction amount in milliunits format.
|
18
|
+
attr_accessor :amount
|
19
|
+
|
20
|
+
# The payee for the subtransaction.
|
21
|
+
attr_accessor :payee_id
|
22
|
+
|
23
|
+
# The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if import_id is also specified on parent transaction) or (2) a payee with the same name or (3) creation of a new payee.
|
24
|
+
attr_accessor :payee_name
|
25
|
+
|
26
|
+
# The category for the subtransaction. Credit Card Payment categories are not permitted and will be ignored if supplied.
|
27
|
+
attr_accessor :category_id
|
28
|
+
|
29
|
+
attr_accessor :memo
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'amount' => :'amount',
|
35
|
+
:'payee_id' => :'payee_id',
|
36
|
+
:'payee_name' => :'payee_name',
|
37
|
+
:'category_id' => :'category_id',
|
38
|
+
:'memo' => :'memo'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.swagger_types
|
44
|
+
{
|
45
|
+
:'amount' => :'Integer',
|
46
|
+
:'payee_id' => :'String',
|
47
|
+
:'payee_name' => :'String',
|
48
|
+
:'category_id' => :'String',
|
49
|
+
:'memo' => :'String'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
return unless attributes.is_a?(Hash)
|
57
|
+
|
58
|
+
# convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
60
|
+
|
61
|
+
if attributes.has_key?(:'amount')
|
62
|
+
self.amount = attributes[:'amount']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.has_key?(:'payee_id')
|
66
|
+
self.payee_id = attributes[:'payee_id']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.has_key?(:'payee_name')
|
70
|
+
self.payee_name = attributes[:'payee_name']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.has_key?(:'category_id')
|
74
|
+
self.category_id = attributes[:'category_id']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.has_key?(:'memo')
|
78
|
+
self.memo = attributes[:'memo']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
+
# @return Array for valid properties with the reasons
|
84
|
+
def list_invalid_properties
|
85
|
+
invalid_properties = Array.new
|
86
|
+
if @amount.nil?
|
87
|
+
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
88
|
+
end
|
89
|
+
|
90
|
+
if !@payee_name.nil? && @payee_name.to_s.length > 50
|
91
|
+
invalid_properties.push('invalid value for "payee_name", the character length must be smaller than or equal to 50.')
|
92
|
+
end
|
93
|
+
|
94
|
+
if !@memo.nil? && @memo.to_s.length > 200
|
95
|
+
invalid_properties.push('invalid value for "memo", the character length must be smaller than or equal to 200.')
|
96
|
+
end
|
97
|
+
|
98
|
+
invalid_properties
|
99
|
+
end
|
100
|
+
|
101
|
+
# Check to see if the all the properties in the model are valid
|
102
|
+
# @return true if the model is valid
|
103
|
+
def valid?
|
104
|
+
return false if @amount.nil?
|
105
|
+
return false if !@payee_name.nil? && @payee_name.to_s.length > 50
|
106
|
+
return false if !@memo.nil? && @memo.to_s.length > 200
|
107
|
+
true
|
108
|
+
end
|
109
|
+
|
110
|
+
# Custom attribute writer method with validation
|
111
|
+
# @param [Object] payee_name Value to be assigned
|
112
|
+
def payee_name=(payee_name)
|
113
|
+
if !payee_name.nil? && payee_name.to_s.length > 50
|
114
|
+
fail ArgumentError, 'invalid value for "payee_name", the character length must be smaller than or equal to 50.'
|
115
|
+
end
|
116
|
+
|
117
|
+
@payee_name = payee_name
|
118
|
+
end
|
119
|
+
|
120
|
+
# Custom attribute writer method with validation
|
121
|
+
# @param [Object] memo Value to be assigned
|
122
|
+
def memo=(memo)
|
123
|
+
if !memo.nil? && memo.to_s.length > 200
|
124
|
+
fail ArgumentError, 'invalid value for "memo", the character length must be smaller than or equal to 200.'
|
125
|
+
end
|
126
|
+
|
127
|
+
@memo = memo
|
128
|
+
end
|
129
|
+
|
130
|
+
# Checks equality by comparing each attribute.
|
131
|
+
# @param [Object] Object to be compared
|
132
|
+
def ==(o)
|
133
|
+
return true if self.equal?(o)
|
134
|
+
self.class == o.class &&
|
135
|
+
amount == o.amount &&
|
136
|
+
payee_id == o.payee_id &&
|
137
|
+
payee_name == o.payee_name &&
|
138
|
+
category_id == o.category_id &&
|
139
|
+
memo == o.memo
|
140
|
+
end
|
141
|
+
|
142
|
+
# @see the `==` method
|
143
|
+
# @param [Object] Object to be compared
|
144
|
+
def eql?(o)
|
145
|
+
self == o
|
146
|
+
end
|
147
|
+
|
148
|
+
# Calculates hash code according to all attributes.
|
149
|
+
# @return [Fixnum] Hash code
|
150
|
+
def hash
|
151
|
+
[amount, payee_id, payee_name, category_id, memo].hash
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def build_from_hash(attributes)
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
159
|
+
self.class.swagger_types.each_pair do |key, type|
|
160
|
+
if type =~ /\AArray<(.*)>/i
|
161
|
+
# check to ensure the input is an array given that the attribute
|
162
|
+
# is documented as an array but the input is not
|
163
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
164
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
165
|
+
end
|
166
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
167
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
168
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
169
|
+
end
|
170
|
+
|
171
|
+
self
|
172
|
+
end
|
173
|
+
|
174
|
+
# Deserializes the data based on type
|
175
|
+
# @param string type Data type
|
176
|
+
# @param string value Value to be deserialized
|
177
|
+
# @return [Object] Deserialized data
|
178
|
+
def _deserialize(type, value)
|
179
|
+
case type.to_sym
|
180
|
+
when :DateTime
|
181
|
+
DateTime.parse(value)
|
182
|
+
when :Date
|
183
|
+
Date.parse(value)
|
184
|
+
when :String
|
185
|
+
value.to_s
|
186
|
+
when :Integer
|
187
|
+
value.to_i
|
188
|
+
when :Float
|
189
|
+
value.to_f
|
190
|
+
when :BOOLEAN
|
191
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
192
|
+
true
|
193
|
+
else
|
194
|
+
false
|
195
|
+
end
|
196
|
+
when :Object
|
197
|
+
# generic object (usually a Hash), return directly
|
198
|
+
value
|
199
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
200
|
+
inner_type = Regexp.last_match[:inner_type]
|
201
|
+
value.map { |v| _deserialize(inner_type, v) }
|
202
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
203
|
+
k_type = Regexp.last_match[:k_type]
|
204
|
+
v_type = Regexp.last_match[:v_type]
|
205
|
+
{}.tap do |hash|
|
206
|
+
value.each do |k, v|
|
207
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
else # model
|
211
|
+
temp_model = YNAB.const_get(type).new
|
212
|
+
temp_model.build_from_hash(value)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the string representation of the object
|
217
|
+
# @return [String] String presentation of the object
|
218
|
+
def to_s
|
219
|
+
to_hash.to_s
|
220
|
+
end
|
221
|
+
|
222
|
+
# to_body is an alias to to_hash (backward compatibility)
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
224
|
+
def to_body
|
225
|
+
to_hash
|
226
|
+
end
|
227
|
+
|
228
|
+
# Returns the object in the form of hash
|
229
|
+
# @return [Hash] Returns the object in the form of hash
|
230
|
+
def to_hash
|
231
|
+
hash = {}
|
232
|
+
self.class.attribute_map.each_pair do |attr, param|
|
233
|
+
value = self.send(attr)
|
234
|
+
next if value.nil?
|
235
|
+
hash[param] = _to_hash(value)
|
236
|
+
end
|
237
|
+
hash
|
238
|
+
end
|
239
|
+
|
240
|
+
# Outputs non-array value in the form of hash
|
241
|
+
# For object, use to_hash. Otherwise, just return the value
|
242
|
+
# @param [Object] value Any valid value
|
243
|
+
# @return [Hash] Returns the value in the form of hash
|
244
|
+
def _to_hash(value)
|
245
|
+
if value.is_a?(Array)
|
246
|
+
value.compact.map { |v| _to_hash(v) }
|
247
|
+
elsif value.is_a?(Hash)
|
248
|
+
{}.tap do |hash|
|
249
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
250
|
+
end
|
251
|
+
elsif value.respond_to? :to_hash
|
252
|
+
value.to_hash
|
253
|
+
else
|
254
|
+
value
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
end
|