ynab 3.2.0 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/Rakefile +6 -5
- data/config.yaml +11 -0
- data/docs/ExistingTransaction.md +1 -1
- data/docs/NewTransaction.md +1 -1
- data/docs/PostScheduledTransactionWrapper.md +8 -0
- data/docs/SaveScheduledTransaction.md +16 -0
- data/docs/SaveTransactionWithIdOrImportId.md +1 -1
- data/docs/SaveTransactionWithOptionalFields.md +1 -1
- data/docs/{SaveTransactionWithIdAllOf.md → ScheduledTransactionFrequency.md} +1 -2
- data/docs/ScheduledTransactionsApi.md +21 -0
- data/docs/TransactionsApi.md +25 -1
- data/lib/ynab/api/accounts_api.rb +1 -4
- data/lib/ynab/api/budgets_api.rb +1 -4
- data/lib/ynab/api/categories_api.rb +1 -4
- data/lib/ynab/api/months_api.rb +1 -4
- data/lib/ynab/api/payee_locations_api.rb +1 -4
- data/lib/ynab/api/payees_api.rb +1 -4
- data/lib/ynab/api/scheduled_transactions_api.rb +75 -4
- data/lib/ynab/api/transactions_api.rb +81 -6
- data/lib/ynab/api/user_api.rb +1 -4
- data/lib/ynab/api_client.rb +1 -4
- data/lib/ynab/api_error.rb +0 -12
- data/lib/ynab/configuration.rb +11 -4
- data/lib/ynab/models/account.rb +1 -4
- data/lib/ynab/models/account_response.rb +1 -4
- data/lib/ynab/models/account_response_data.rb +1 -4
- data/lib/ynab/models/account_type.rb +1 -4
- data/lib/ynab/models/accounts_response.rb +1 -4
- data/lib/ynab/models/accounts_response_data.rb +1 -4
- data/lib/ynab/models/budget_detail.rb +1 -4
- data/lib/ynab/models/budget_detail_response.rb +1 -4
- data/lib/ynab/models/budget_detail_response_data.rb +1 -4
- data/lib/ynab/models/budget_settings.rb +1 -4
- data/lib/ynab/models/budget_settings_response.rb +1 -4
- data/lib/ynab/models/budget_settings_response_data.rb +1 -4
- data/lib/ynab/models/budget_summary.rb +1 -4
- data/lib/ynab/models/budget_summary_response.rb +1 -4
- data/lib/ynab/models/budget_summary_response_data.rb +1 -4
- data/lib/ynab/models/bulk_response.rb +1 -4
- data/lib/ynab/models/bulk_response_data.rb +1 -4
- data/lib/ynab/models/bulk_response_data_bulk.rb +1 -4
- data/lib/ynab/models/bulk_transactions.rb +1 -4
- data/lib/ynab/models/categories_response.rb +1 -4
- data/lib/ynab/models/categories_response_data.rb +1 -4
- data/lib/ynab/models/category.rb +1 -4
- data/lib/ynab/models/category_group.rb +1 -4
- data/lib/ynab/models/category_group_with_categories.rb +1 -4
- data/lib/ynab/models/category_response.rb +1 -4
- data/lib/ynab/models/category_response_data.rb +1 -4
- data/lib/ynab/models/currency_format.rb +1 -4
- data/lib/ynab/models/date_format.rb +1 -4
- data/lib/ynab/models/error_detail.rb +1 -4
- data/lib/ynab/models/error_response.rb +1 -4
- data/lib/ynab/models/existing_transaction.rb +4 -7
- data/lib/ynab/models/hybrid_transaction.rb +1 -4
- data/lib/ynab/models/hybrid_transactions_response.rb +1 -4
- data/lib/ynab/models/hybrid_transactions_response_data.rb +1 -4
- data/lib/ynab/models/month_detail.rb +1 -4
- data/lib/ynab/models/month_detail_response.rb +1 -4
- data/lib/ynab/models/month_detail_response_data.rb +1 -4
- data/lib/ynab/models/month_summaries_response.rb +1 -4
- data/lib/ynab/models/month_summaries_response_data.rb +1 -4
- data/lib/ynab/models/month_summary.rb +1 -4
- data/lib/ynab/models/new_transaction.rb +4 -7
- data/lib/ynab/models/patch_category_wrapper.rb +1 -4
- data/lib/ynab/models/patch_month_category_wrapper.rb +1 -4
- data/lib/ynab/models/patch_payee_wrapper.rb +1 -4
- data/lib/ynab/models/patch_transactions_wrapper.rb +1 -4
- data/lib/ynab/models/payee.rb +1 -4
- data/lib/ynab/models/payee_location.rb +1 -4
- data/lib/ynab/models/payee_location_response.rb +1 -4
- data/lib/ynab/models/payee_location_response_data.rb +1 -4
- data/lib/ynab/models/payee_locations_response.rb +1 -4
- data/lib/ynab/models/payee_locations_response_data.rb +1 -4
- data/lib/ynab/models/payee_response.rb +1 -4
- data/lib/ynab/models/payee_response_data.rb +1 -4
- data/lib/ynab/models/payees_response.rb +1 -4
- data/lib/ynab/models/payees_response_data.rb +1 -4
- data/lib/ynab/models/post_account_wrapper.rb +1 -4
- data/lib/ynab/models/{save_transaction_with_id_all_of.rb → post_scheduled_transaction_wrapper.rb} +23 -32
- data/lib/ynab/models/post_transactions_wrapper.rb +1 -4
- data/lib/ynab/models/put_transaction_wrapper.rb +1 -4
- data/lib/ynab/models/save_account.rb +1 -4
- data/lib/ynab/models/save_category.rb +1 -4
- data/lib/ynab/models/save_category_response.rb +1 -4
- data/lib/ynab/models/save_category_response_data.rb +1 -4
- data/lib/ynab/models/save_month_category.rb +1 -4
- data/lib/ynab/models/save_payee.rb +1 -4
- data/lib/ynab/models/save_payee_response.rb +1 -4
- data/lib/ynab/models/save_payee_response_data.rb +1 -4
- data/lib/ynab/models/{hybrid_transaction_all_of.rb → save_scheduled_transaction.rb} +99 -62
- data/lib/ynab/models/save_sub_transaction.rb +3 -6
- data/lib/ynab/models/save_transaction_with_id_or_import_id.rb +4 -7
- data/lib/ynab/models/save_transaction_with_optional_fields.rb +4 -7
- data/lib/ynab/models/save_transactions_response.rb +1 -4
- data/lib/ynab/models/save_transactions_response_data.rb +1 -4
- data/lib/ynab/models/scheduled_sub_transaction.rb +1 -4
- data/lib/ynab/models/scheduled_transaction_detail.rb +1 -4
- data/lib/ynab/models/scheduled_transaction_frequency.rb +48 -0
- data/lib/ynab/models/scheduled_transaction_response.rb +1 -4
- data/lib/ynab/models/scheduled_transaction_response_data.rb +1 -4
- data/lib/ynab/models/scheduled_transaction_summary.rb +1 -4
- data/lib/ynab/models/scheduled_transactions_response.rb +1 -4
- data/lib/ynab/models/scheduled_transactions_response_data.rb +1 -4
- data/lib/ynab/models/sub_transaction.rb +1 -4
- data/lib/ynab/models/transaction_cleared_status.rb +1 -4
- data/lib/ynab/models/transaction_detail.rb +1 -4
- data/lib/ynab/models/transaction_flag_color.rb +1 -4
- data/lib/ynab/models/transaction_response.rb +1 -4
- data/lib/ynab/models/transaction_response_data.rb +1 -4
- data/lib/ynab/models/transaction_summary.rb +1 -4
- data/lib/ynab/models/transactions_import_response.rb +1 -4
- data/lib/ynab/models/transactions_import_response_data.rb +1 -4
- data/lib/ynab/models/transactions_response.rb +1 -4
- data/lib/ynab/models/transactions_response_data.rb +1 -4
- data/lib/ynab/models/user.rb +1 -4
- data/lib/ynab/models/user_response.rb +1 -4
- data/lib/ynab/models/user_response_data.rb +1 -4
- data/lib/ynab/overrides/transactions_api.rb +0 -12
- data/lib/ynab/version.rb +1 -13
- data/lib/ynab.rb +4 -4
- data/open_api_spec.yaml +194 -8
- data/spec/api/scheduled_transactions_spec.rb +20 -2
- data/spec/api/transactions_spec.rb +10 -0
- data/spec/fixtures/vcr_cassettes/create_scheduled_transaction.yml +63 -0
- data/spec/fixtures/vcr_cassettes/month_transactions.yml +46 -0
- data/templates/README.md +3 -0
- data/templates/api_info.mustache +9 -0
- data/templates/gemspec.mustache +41 -0
- data/ynab.gemspec +3 -6
- metadata +51 -84
- data/docs/AccountWrapper.md +0 -8
- data/docs/AccountsWrapper.md +0 -9
- data/docs/BudgetDetailAllOf.md +0 -17
- data/docs/BudgetDetailWrapper.md +0 -9
- data/docs/BudgetSettingsWrapper.md +0 -8
- data/docs/BudgetSummaryWrapper.md +0 -9
- data/docs/BulkIdWrapper.md +0 -8
- data/docs/BulkIds.md +0 -9
- data/docs/BulkTransactionCreateResponse.md +0 -8
- data/docs/BulkTransactionIds.md +0 -8
- data/docs/CategoryGroupWithCategoriesAllOf.md +0 -8
- data/docs/CategoryGroupsWrapper.md +0 -9
- data/docs/CategoryWrapper.md +0 -9
- data/docs/DeprecatedApi.md +0 -28
- data/docs/HybridTransactionAllOf.md +0 -12
- data/docs/HybridTransactionsWrapper.md +0 -8
- data/docs/LoanAccountPeriodicValue.md +0 -7
- data/docs/MonthDetailAllOf.md +0 -8
- data/docs/MonthDetailWrapper.md +0 -8
- data/docs/MonthSummariesWrapper.md +0 -9
- data/docs/PayeeLocationWrapper.md +0 -8
- data/docs/PayeeLocationsWrapper.md +0 -8
- data/docs/PayeeWrapper.md +0 -8
- data/docs/PayeesWrapper.md +0 -9
- data/docs/SaveAccountWrapper.md +0 -8
- data/docs/SaveMonthCategoryWrapper.md +0 -8
- data/docs/SaveTransaction.md +0 -19
- data/docs/SaveTransactionWithId.md +0 -20
- data/docs/SaveTransactionWrapper.md +0 -8
- data/docs/SaveTransactionsWrapper.md +0 -9
- data/docs/ScheduledTransactionDetailAllOf.md +0 -11
- data/docs/ScheduledTransactionWrapper.md +0 -8
- data/docs/ScheduledTransactionsWrapper.md +0 -8
- data/docs/TransactionDetailAllOf.md +0 -11
- data/docs/TransactionWrapper.md +0 -8
- data/docs/TransactionsWrapper.md +0 -9
- data/docs/UpdateTransaction.md +0 -20
- data/docs/UpdateTransactionsWrapper.md +0 -8
- data/docs/UserWrapper.md +0 -8
- data/lib/ynab/models/budget_detail_all_of.rb +0 -320
- data/lib/ynab/models/category_group_with_categories_all_of.rb +0 -223
- data/lib/ynab/models/month_detail_all_of.rb +0 -223
- data/lib/ynab/models/save_transaction.rb +0 -401
- data/lib/ynab/models/save_transaction_with_id.rb +0 -411
- data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +0 -254
- data/lib/ynab/models/transaction_detail_all_of.rb +0 -254
@@ -1,401 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#YNAB API Endpoints
|
3
|
-
|
4
|
-
#Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 6.6.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module YNAB
|
17
|
-
class SaveTransaction
|
18
|
-
attr_accessor :account_id
|
19
|
-
|
20
|
-
# 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.
|
21
|
-
attr_accessor :date
|
22
|
-
|
23
|
-
# The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored.
|
24
|
-
attr_accessor :amount
|
25
|
-
|
26
|
-
# The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `tranfer_payee_id` on the account resource.
|
27
|
-
attr_accessor :payee_id
|
28
|
-
|
29
|
-
# 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) or (2) a payee with the same name or (3) creation of a new payee.
|
30
|
-
attr_accessor :payee_name
|
31
|
-
|
32
|
-
# The category for the transaction. To configure a split transaction, you can specify null for `category_id` and provide a `subtransactions` array as part of the transaction object. If an existing transaction is a split, the `category_id` cannot be changed. Credit Card Payment categories are not permitted and will be ignored if supplied.
|
33
|
-
attr_accessor :category_id
|
34
|
-
|
35
|
-
attr_accessor :memo
|
36
|
-
|
37
|
-
# The cleared status of the transaction
|
38
|
-
attr_accessor :cleared
|
39
|
-
|
40
|
-
# Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default.
|
41
|
-
attr_accessor :approved
|
42
|
-
|
43
|
-
# The transaction flag
|
44
|
-
attr_accessor :flag_color
|
45
|
-
|
46
|
-
# 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).
|
47
|
-
attr_accessor :import_id
|
48
|
-
|
49
|
-
# An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
|
50
|
-
attr_accessor :subtransactions
|
51
|
-
|
52
|
-
class EnumAttributeValidator
|
53
|
-
attr_reader :datatype
|
54
|
-
attr_reader :allowable_values
|
55
|
-
|
56
|
-
def initialize(datatype, allowable_values)
|
57
|
-
@allowable_values = allowable_values.map do |value|
|
58
|
-
case datatype.to_s
|
59
|
-
when /Integer/i
|
60
|
-
value.to_i
|
61
|
-
when /Float/i
|
62
|
-
value.to_f
|
63
|
-
else
|
64
|
-
value
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def valid?(value)
|
70
|
-
!value || allowable_values.include?(value)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
75
|
-
def self.attribute_map
|
76
|
-
{
|
77
|
-
:'account_id' => :'account_id',
|
78
|
-
:'date' => :'date',
|
79
|
-
:'amount' => :'amount',
|
80
|
-
:'payee_id' => :'payee_id',
|
81
|
-
:'payee_name' => :'payee_name',
|
82
|
-
:'category_id' => :'category_id',
|
83
|
-
:'memo' => :'memo',
|
84
|
-
:'cleared' => :'cleared',
|
85
|
-
:'approved' => :'approved',
|
86
|
-
:'flag_color' => :'flag_color',
|
87
|
-
:'import_id' => :'import_id',
|
88
|
-
:'subtransactions' => :'subtransactions'
|
89
|
-
}
|
90
|
-
end
|
91
|
-
|
92
|
-
# Returns all the JSON keys this model knows about
|
93
|
-
def self.acceptable_attributes
|
94
|
-
attribute_map.values
|
95
|
-
end
|
96
|
-
|
97
|
-
# Attribute type mapping.
|
98
|
-
def self.openapi_types
|
99
|
-
{
|
100
|
-
:'account_id' => :'String',
|
101
|
-
:'date' => :'Date',
|
102
|
-
:'amount' => :'Integer',
|
103
|
-
:'payee_id' => :'String',
|
104
|
-
:'payee_name' => :'String',
|
105
|
-
:'category_id' => :'String',
|
106
|
-
:'memo' => :'String',
|
107
|
-
:'cleared' => :'String',
|
108
|
-
:'approved' => :'Boolean',
|
109
|
-
:'flag_color' => :'String',
|
110
|
-
:'import_id' => :'String',
|
111
|
-
:'subtransactions' => :'Array<SaveSubTransaction>'
|
112
|
-
}
|
113
|
-
end
|
114
|
-
|
115
|
-
# List of attributes with nullable: true
|
116
|
-
def self.openapi_nullable
|
117
|
-
Set.new([
|
118
|
-
:'payee_id',
|
119
|
-
:'payee_name',
|
120
|
-
:'category_id',
|
121
|
-
:'memo',
|
122
|
-
:'import_id',
|
123
|
-
])
|
124
|
-
end
|
125
|
-
|
126
|
-
# List of class defined in allOf (OpenAPI v3)
|
127
|
-
def self.openapi_all_of
|
128
|
-
[
|
129
|
-
:'SaveTransactionWithOptionalFields'
|
130
|
-
]
|
131
|
-
end
|
132
|
-
|
133
|
-
# Initializes the object
|
134
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
135
|
-
def initialize(attributes = {})
|
136
|
-
if (!attributes.is_a?(Hash))
|
137
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransaction` initialize method"
|
138
|
-
end
|
139
|
-
|
140
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
141
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
142
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
143
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
144
|
-
end
|
145
|
-
h[k.to_sym] = v
|
146
|
-
}
|
147
|
-
|
148
|
-
if attributes.key?(:'account_id')
|
149
|
-
self.account_id = attributes[:'account_id']
|
150
|
-
end
|
151
|
-
|
152
|
-
if attributes.key?(:'date')
|
153
|
-
self.date = attributes[:'date']
|
154
|
-
end
|
155
|
-
|
156
|
-
if attributes.key?(:'amount')
|
157
|
-
self.amount = attributes[:'amount']
|
158
|
-
end
|
159
|
-
|
160
|
-
if attributes.key?(:'payee_id')
|
161
|
-
self.payee_id = attributes[:'payee_id']
|
162
|
-
end
|
163
|
-
|
164
|
-
if attributes.key?(:'payee_name')
|
165
|
-
self.payee_name = attributes[:'payee_name']
|
166
|
-
end
|
167
|
-
|
168
|
-
if attributes.key?(:'category_id')
|
169
|
-
self.category_id = attributes[:'category_id']
|
170
|
-
end
|
171
|
-
|
172
|
-
if attributes.key?(:'memo')
|
173
|
-
self.memo = attributes[:'memo']
|
174
|
-
end
|
175
|
-
|
176
|
-
if attributes.key?(:'cleared')
|
177
|
-
self.cleared = attributes[:'cleared']
|
178
|
-
end
|
179
|
-
|
180
|
-
if attributes.key?(:'approved')
|
181
|
-
self.approved = attributes[:'approved']
|
182
|
-
end
|
183
|
-
|
184
|
-
if attributes.key?(:'flag_color')
|
185
|
-
self.flag_color = attributes[:'flag_color']
|
186
|
-
end
|
187
|
-
|
188
|
-
if attributes.key?(:'import_id')
|
189
|
-
self.import_id = attributes[:'import_id']
|
190
|
-
end
|
191
|
-
|
192
|
-
if attributes.key?(:'subtransactions')
|
193
|
-
if (value = attributes[:'subtransactions']).is_a?(Array)
|
194
|
-
self.subtransactions = value
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
200
|
-
# @return Array for valid properties with the reasons
|
201
|
-
def list_invalid_properties
|
202
|
-
invalid_properties = Array.new
|
203
|
-
invalid_properties
|
204
|
-
end
|
205
|
-
|
206
|
-
# Check to see if the all the properties in the model are valid
|
207
|
-
# @return true if the model is valid
|
208
|
-
def valid?
|
209
|
-
return false if !@payee_name.nil? && @payee_name.to_s.length > 50
|
210
|
-
return false if !@memo.nil? && @memo.to_s.length > 200
|
211
|
-
cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
212
|
-
return false unless cleared_validator.valid?(@cleared)
|
213
|
-
flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
214
|
-
return false unless flag_color_validator.valid?(@flag_color)
|
215
|
-
return false if !@import_id.nil? && @import_id.to_s.length > 36
|
216
|
-
true
|
217
|
-
end
|
218
|
-
|
219
|
-
# Custom attribute writer method with validation
|
220
|
-
# @param [Object] payee_name Value to be assigned
|
221
|
-
def payee_name=(payee_name)
|
222
|
-
@payee_name = payee_name
|
223
|
-
end
|
224
|
-
|
225
|
-
# Custom attribute writer method with validation
|
226
|
-
# @param [Object] memo Value to be assigned
|
227
|
-
def memo=(memo)
|
228
|
-
@memo = memo
|
229
|
-
end
|
230
|
-
|
231
|
-
# Custom attribute writer method checking allowed values (enum).
|
232
|
-
# @param [Object] cleared Object to be assigned
|
233
|
-
def cleared=(cleared)
|
234
|
-
@cleared = cleared
|
235
|
-
end
|
236
|
-
|
237
|
-
# Custom attribute writer method checking allowed values (enum).
|
238
|
-
# @param [Object] flag_color Object to be assigned
|
239
|
-
def flag_color=(flag_color)
|
240
|
-
@flag_color = flag_color
|
241
|
-
end
|
242
|
-
|
243
|
-
# Custom attribute writer method with validation
|
244
|
-
# @param [Object] import_id Value to be assigned
|
245
|
-
def import_id=(import_id)
|
246
|
-
@import_id = import_id
|
247
|
-
end
|
248
|
-
|
249
|
-
# Checks equality by comparing each attribute.
|
250
|
-
# @param [Object] Object to be compared
|
251
|
-
def ==(o)
|
252
|
-
return true if self.equal?(o)
|
253
|
-
self.class == o.class &&
|
254
|
-
account_id == o.account_id &&
|
255
|
-
date == o.date &&
|
256
|
-
amount == o.amount &&
|
257
|
-
payee_id == o.payee_id &&
|
258
|
-
payee_name == o.payee_name &&
|
259
|
-
category_id == o.category_id &&
|
260
|
-
memo == o.memo &&
|
261
|
-
cleared == o.cleared &&
|
262
|
-
approved == o.approved &&
|
263
|
-
flag_color == o.flag_color &&
|
264
|
-
import_id == o.import_id &&
|
265
|
-
subtransactions == o.subtransactions
|
266
|
-
end
|
267
|
-
|
268
|
-
# @see the `==` method
|
269
|
-
# @param [Object] Object to be compared
|
270
|
-
def eql?(o)
|
271
|
-
self == o
|
272
|
-
end
|
273
|
-
|
274
|
-
# Calculates hash code according to all attributes.
|
275
|
-
# @return [Integer] Hash code
|
276
|
-
def hash
|
277
|
-
[account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions].hash
|
278
|
-
end
|
279
|
-
|
280
|
-
# Builds the object from hash
|
281
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
282
|
-
# @return [Object] Returns the model itself
|
283
|
-
def self.build_from_hash(attributes)
|
284
|
-
new.build_from_hash(attributes)
|
285
|
-
end
|
286
|
-
|
287
|
-
# Builds the object from hash
|
288
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
289
|
-
# @return [Object] Returns the model itself
|
290
|
-
def build_from_hash(attributes)
|
291
|
-
return nil unless attributes.is_a?(Hash)
|
292
|
-
attributes = attributes.transform_keys(&:to_sym)
|
293
|
-
self.class.openapi_types.each_pair do |key, type|
|
294
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
295
|
-
self.send("#{key}=", nil)
|
296
|
-
elsif type =~ /\AArray<(.*)>/i
|
297
|
-
# check to ensure the input is an array given that the attribute
|
298
|
-
# is documented as an array but the input is not
|
299
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
300
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
301
|
-
end
|
302
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
303
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
self
|
308
|
-
end
|
309
|
-
|
310
|
-
# Deserializes the data based on type
|
311
|
-
# @param string type Data type
|
312
|
-
# @param string value Value to be deserialized
|
313
|
-
# @return [Object] Deserialized data
|
314
|
-
def _deserialize(type, value)
|
315
|
-
case type.to_sym
|
316
|
-
when :Time
|
317
|
-
Time.parse(value)
|
318
|
-
when :Date
|
319
|
-
Date.parse(value)
|
320
|
-
when :String
|
321
|
-
value.to_s
|
322
|
-
when :Integer
|
323
|
-
value.to_i
|
324
|
-
when :Float
|
325
|
-
value.to_f
|
326
|
-
when :Boolean
|
327
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
328
|
-
true
|
329
|
-
else
|
330
|
-
false
|
331
|
-
end
|
332
|
-
when :Object
|
333
|
-
# generic object (usually a Hash), return directly
|
334
|
-
value
|
335
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
336
|
-
inner_type = Regexp.last_match[:inner_type]
|
337
|
-
value.map { |v| _deserialize(inner_type, v) }
|
338
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
339
|
-
k_type = Regexp.last_match[:k_type]
|
340
|
-
v_type = Regexp.last_match[:v_type]
|
341
|
-
{}.tap do |hash|
|
342
|
-
value.each do |k, v|
|
343
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
344
|
-
end
|
345
|
-
end
|
346
|
-
else # model
|
347
|
-
# models (e.g. Pet) or oneOf
|
348
|
-
klass = YNAB.const_get(type)
|
349
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
350
|
-
end
|
351
|
-
end
|
352
|
-
|
353
|
-
# Returns the string representation of the object
|
354
|
-
# @return [String] String presentation of the object
|
355
|
-
def to_s
|
356
|
-
to_hash.to_s
|
357
|
-
end
|
358
|
-
|
359
|
-
# to_body is an alias to to_hash (backward compatibility)
|
360
|
-
# @return [Hash] Returns the object in the form of hash
|
361
|
-
def to_body
|
362
|
-
to_hash
|
363
|
-
end
|
364
|
-
|
365
|
-
# Returns the object in the form of hash
|
366
|
-
# @return [Hash] Returns the object in the form of hash
|
367
|
-
def to_hash
|
368
|
-
hash = {}
|
369
|
-
self.class.attribute_map.each_pair do |attr, param|
|
370
|
-
value = self.send(attr)
|
371
|
-
if value.nil?
|
372
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
373
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
374
|
-
end
|
375
|
-
|
376
|
-
hash[param] = _to_hash(value)
|
377
|
-
end
|
378
|
-
hash
|
379
|
-
end
|
380
|
-
|
381
|
-
# Outputs non-array value in the form of hash
|
382
|
-
# For object, use to_hash. Otherwise, just return the value
|
383
|
-
# @param [Object] value Any valid value
|
384
|
-
# @return [Hash] Returns the value in the form of hash
|
385
|
-
def _to_hash(value)
|
386
|
-
if value.is_a?(Array)
|
387
|
-
value.compact.map { |v| _to_hash(v) }
|
388
|
-
elsif value.is_a?(Hash)
|
389
|
-
{}.tap do |hash|
|
390
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
391
|
-
end
|
392
|
-
elsif value.respond_to? :to_hash
|
393
|
-
value.to_hash
|
394
|
-
else
|
395
|
-
value
|
396
|
-
end
|
397
|
-
end
|
398
|
-
|
399
|
-
end
|
400
|
-
|
401
|
-
end
|