ynab 2.0.0 → 2.1.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 -1
- data/lib/ynab/api/transactions_api.rb +0 -16
- data/lib/ynab/models/account.rb +0 -36
- data/lib/ynab/models/account_response.rb +0 -4
- data/lib/ynab/models/account_response_data.rb +0 -4
- data/lib/ynab/models/accounts_response.rb +0 -4
- data/lib/ynab/models/accounts_response_data.rb +0 -8
- data/lib/ynab/models/budget_detail.rb +0 -8
- data/lib/ynab/models/budget_detail_response.rb +0 -4
- data/lib/ynab/models/budget_detail_response_data.rb +0 -8
- data/lib/ynab/models/budget_settings_response.rb +0 -4
- data/lib/ynab/models/budget_settings_response_data.rb +0 -4
- data/lib/ynab/models/budget_summary.rb +0 -8
- data/lib/ynab/models/budget_summary_response.rb +0 -4
- data/lib/ynab/models/budget_summary_response_data.rb +0 -4
- data/lib/ynab/models/bulk_response.rb +0 -4
- data/lib/ynab/models/bulk_response_data.rb +0 -4
- data/lib/ynab/models/bulk_response_data_bulk.rb +0 -8
- data/lib/ynab/models/bulk_transactions.rb +0 -4
- data/lib/ynab/models/categories_response.rb +0 -4
- data/lib/ynab/models/categories_response_data.rb +0 -8
- data/lib/ynab/models/category.rb +0 -36
- data/lib/ynab/models/category_group.rb +0 -16
- data/lib/ynab/models/category_group_with_categories.rb +0 -20
- data/lib/ynab/models/category_group_with_categories_all_of.rb +0 -4
- data/lib/ynab/models/category_response.rb +0 -4
- data/lib/ynab/models/category_response_data.rb +0 -4
- data/lib/ynab/models/currency_format.rb +0 -32
- data/lib/ynab/models/date_format.rb +0 -4
- data/lib/ynab/models/error_detail.rb +0 -12
- data/lib/ynab/models/error_response.rb +0 -4
- data/lib/ynab/models/hybrid_transaction.rb +0 -52
- data/lib/ynab/models/hybrid_transaction_all_of.rb +0 -12
- data/lib/ynab/models/hybrid_transactions_response.rb +0 -4
- data/lib/ynab/models/hybrid_transactions_response_data.rb +0 -4
- data/lib/ynab/models/month_detail.rb +0 -28
- data/lib/ynab/models/month_detail_all_of.rb +0 -4
- data/lib/ynab/models/month_detail_response.rb +0 -4
- data/lib/ynab/models/month_detail_response_data.rb +0 -4
- data/lib/ynab/models/month_summaries_response.rb +0 -4
- data/lib/ynab/models/month_summaries_response_data.rb +0 -8
- data/lib/ynab/models/month_summary.rb +0 -24
- data/lib/ynab/models/patch_month_category_wrapper.rb +0 -4
- data/lib/ynab/models/patch_transactions_wrapper.rb +0 -4
- data/lib/ynab/models/payee.rb +0 -12
- data/lib/ynab/models/payee_location.rb +0 -20
- data/lib/ynab/models/payee_location_response.rb +0 -4
- data/lib/ynab/models/payee_location_response_data.rb +0 -4
- data/lib/ynab/models/payee_locations_response.rb +0 -4
- data/lib/ynab/models/payee_locations_response_data.rb +0 -4
- data/lib/ynab/models/payee_response.rb +0 -4
- data/lib/ynab/models/payee_response_data.rb +0 -4
- data/lib/ynab/models/payees_response.rb +0 -4
- data/lib/ynab/models/payees_response_data.rb +0 -8
- data/lib/ynab/models/post_account_wrapper.rb +0 -4
- data/lib/ynab/models/put_transaction_wrapper.rb +0 -4
- data/lib/ynab/models/save_account.rb +0 -12
- data/lib/ynab/models/save_category_response.rb +0 -4
- data/lib/ynab/models/save_category_response_data.rb +0 -8
- data/lib/ynab/models/save_month_category.rb +0 -4
- data/lib/ynab/models/save_sub_transaction.rb +0 -20
- data/lib/ynab/models/save_transaction.rb +0 -32
- data/lib/ynab/models/save_transaction_with_id.rb +0 -32
- data/lib/ynab/models/save_transaction_with_optional_fields.rb +0 -32
- data/lib/ynab/models/save_transactions_response.rb +0 -4
- data/lib/ynab/models/save_transactions_response_data.rb +0 -8
- data/lib/ynab/models/scheduled_sub_transaction.rb +0 -16
- data/lib/ynab/models/scheduled_transaction_detail.rb +0 -44
- data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +0 -8
- data/lib/ynab/models/scheduled_transaction_response.rb +0 -4
- data/lib/ynab/models/scheduled_transaction_response_data.rb +0 -4
- data/lib/ynab/models/scheduled_transaction_summary.rb +0 -36
- data/lib/ynab/models/scheduled_transactions_response.rb +0 -4
- data/lib/ynab/models/scheduled_transactions_response_data.rb +0 -8
- data/lib/ynab/models/sub_transaction.rb +0 -16
- data/lib/ynab/models/transaction_detail.rb +0 -48
- data/lib/ynab/models/transaction_detail_all_of.rb +0 -8
- data/lib/ynab/models/transaction_response.rb +0 -4
- data/lib/ynab/models/transaction_response_data.rb +0 -4
- data/lib/ynab/models/transaction_summary.rb +0 -40
- data/lib/ynab/models/transactions_import_response.rb +0 -4
- data/lib/ynab/models/transactions_import_response_data.rb +0 -4
- data/lib/ynab/models/transactions_response.rb +0 -4
- data/lib/ynab/models/transactions_response_data.rb +0 -8
- data/lib/ynab/models/user.rb +0 -4
- data/lib/ynab/models/user_response.rb +0 -4
- data/lib/ynab/models/user_response_data.rb +0 -4
- data/lib/ynab/version.rb +1 -1
- data/templates/api.mustache +213 -0
- data/templates/partial_model_generic.mustache +305 -0
- metadata +4 -2
@@ -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
|
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.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YNAB
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -353,10 +353,12 @@ files:
|
|
353
353
|
- spec/fixtures/vcr_cassettes/update_transaction.yml
|
354
354
|
- spec/fixtures/vcr_cassettes/update_transactions.yml
|
355
355
|
- spec/spec_helper.rb
|
356
|
+
- templates/api.mustache
|
356
357
|
- templates/api_client.mustache
|
357
358
|
- templates/api_client_typhoeus_partial.mustache
|
358
359
|
- templates/api_doc.mustache
|
359
360
|
- templates/gem.mustache
|
361
|
+
- templates/partial_model_generic.mustache
|
360
362
|
- templates/partial_model_generic_doc.mustache
|
361
363
|
- ynab.gemspec
|
362
364
|
homepage: https://github.com/ynab/ynab-sdk-ruby
|