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