ynab 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/docs/Account.md +6 -0
- data/docs/AccountBase.md +25 -0
- data/docs/Category.md +14 -0
- data/docs/CategoryBase.md +33 -0
- data/docs/ExistingCategory.md +2 -1
- data/docs/HybridTransaction.md +2 -0
- data/docs/MoneyMovement.md +2 -0
- data/docs/MoneyMovementBase.md +16 -0
- data/docs/MonthDetail.md +8 -0
- data/docs/MonthDetailBase.md +16 -0
- data/docs/MonthSummary.md +8 -0
- data/docs/MonthSummaryBase.md +15 -0
- data/docs/NewCategory.md +2 -1
- data/docs/PayeesApi.md +21 -0
- data/docs/PlanDetail.md +7 -7
- data/docs/PostPayee.md +8 -0
- data/docs/PostPayeeWrapper.md +8 -0
- data/docs/SaveAccount.md +1 -1
- data/docs/SaveAccountType.md +7 -0
- data/docs/SaveCategory.md +2 -1
- data/docs/SavePayee.md +1 -1
- data/docs/ScheduledSubTransaction.md +2 -0
- data/docs/ScheduledSubTransactionBase.md +17 -0
- data/docs/ScheduledTransactionDetail.md +2 -0
- data/docs/ScheduledTransactionSummary.md +2 -0
- data/docs/ScheduledTransactionSummaryBase.md +20 -0
- data/docs/SubTransaction.md +2 -0
- data/docs/SubTransactionBase.md +18 -0
- data/docs/TransactionDetail.md +2 -0
- data/docs/TransactionSummary.md +2 -0
- data/docs/TransactionSummaryBase.md +26 -0
- data/lib/ynab/api/payees_api.rb +74 -0
- data/lib/ynab/models/account.rb +72 -8
- data/lib/ynab/models/account_base.rb +340 -0
- data/lib/ynab/models/category.rb +159 -20
- data/lib/ynab/models/category_base.rb +436 -0
- data/lib/ynab/models/existing_category.rb +15 -5
- data/lib/ynab/models/hybrid_transaction.rb +21 -1
- data/lib/ynab/models/money_movement.rb +31 -11
- data/lib/ynab/models/money_movement_base.rb +223 -0
- data/lib/ynab/models/month_detail.rb +81 -1
- data/lib/ynab/models/month_detail_base.rb +230 -0
- data/lib/ynab/models/month_summary.rb +91 -6
- data/lib/ynab/models/month_summary_base.rb +212 -0
- data/lib/ynab/models/new_category.rb +15 -5
- data/lib/ynab/models/plan_detail.rb +7 -7
- data/lib/ynab/models/post_payee.rb +148 -0
- data/lib/ynab/models/post_payee_wrapper.rb +136 -0
- data/lib/ynab/models/save_account.rb +1 -1
- data/lib/ynab/models/save_account_type.rb +45 -0
- data/lib/ynab/models/save_category.rb +17 -6
- data/lib/ynab/models/save_payee.rb +1 -1
- data/lib/ynab/models/scheduled_sub_transaction.rb +31 -10
- data/lib/ynab/models/scheduled_sub_transaction_base.rb +229 -0
- data/lib/ynab/models/scheduled_transaction_detail.rb +21 -1
- data/lib/ynab/models/scheduled_transaction_summary.rb +31 -9
- data/lib/ynab/models/scheduled_transaction_summary_base.rb +292 -0
- data/lib/ynab/models/sub_transaction.rb +31 -11
- data/lib/ynab/models/sub_transaction_base.rb +240 -0
- data/lib/ynab/models/transaction_detail.rb +21 -1
- data/lib/ynab/models/transaction_summary.rb +31 -14
- data/lib/ynab/models/transaction_summary_base.rb +358 -0
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +12 -0
- data/open_api_spec.yaml +295 -21
- data/ynab.gemspec +1 -1
- metadata +27 -3
|
@@ -0,0 +1,229 @@
|
|
|
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
|
+
Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'date'
|
|
11
|
+
require 'time'
|
|
12
|
+
|
|
13
|
+
module YNAB
|
|
14
|
+
class ScheduledSubTransactionBase < ApiModelBase
|
|
15
|
+
attr_accessor :id
|
|
16
|
+
|
|
17
|
+
attr_accessor :scheduled_transaction_id
|
|
18
|
+
|
|
19
|
+
# The scheduled subtransaction amount in milliunits format
|
|
20
|
+
attr_accessor :amount
|
|
21
|
+
|
|
22
|
+
attr_accessor :memo
|
|
23
|
+
|
|
24
|
+
attr_accessor :payee_id
|
|
25
|
+
|
|
26
|
+
attr_accessor :payee_name
|
|
27
|
+
|
|
28
|
+
attr_accessor :category_id
|
|
29
|
+
|
|
30
|
+
attr_accessor :category_name
|
|
31
|
+
|
|
32
|
+
# If a transfer, the account_id which the scheduled subtransaction transfers to
|
|
33
|
+
attr_accessor :transfer_account_id
|
|
34
|
+
|
|
35
|
+
# Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests.
|
|
36
|
+
attr_accessor :deleted
|
|
37
|
+
|
|
38
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
39
|
+
def self.attribute_map
|
|
40
|
+
{
|
|
41
|
+
:'id' => :'id',
|
|
42
|
+
:'scheduled_transaction_id' => :'scheduled_transaction_id',
|
|
43
|
+
:'amount' => :'amount',
|
|
44
|
+
:'memo' => :'memo',
|
|
45
|
+
:'payee_id' => :'payee_id',
|
|
46
|
+
:'payee_name' => :'payee_name',
|
|
47
|
+
:'category_id' => :'category_id',
|
|
48
|
+
:'category_name' => :'category_name',
|
|
49
|
+
:'transfer_account_id' => :'transfer_account_id',
|
|
50
|
+
:'deleted' => :'deleted'
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Returns all the JSON keys this model knows about
|
|
55
|
+
def self.acceptable_attributes
|
|
56
|
+
attribute_map.values
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Attribute type mapping.
|
|
60
|
+
def self.openapi_types
|
|
61
|
+
{
|
|
62
|
+
:'id' => :'String',
|
|
63
|
+
:'scheduled_transaction_id' => :'String',
|
|
64
|
+
:'amount' => :'Integer',
|
|
65
|
+
:'memo' => :'String',
|
|
66
|
+
:'payee_id' => :'String',
|
|
67
|
+
:'payee_name' => :'String',
|
|
68
|
+
:'category_id' => :'String',
|
|
69
|
+
:'category_name' => :'String',
|
|
70
|
+
:'transfer_account_id' => :'String',
|
|
71
|
+
:'deleted' => :'Boolean'
|
|
72
|
+
}
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# List of attributes with nullable: true
|
|
76
|
+
def self.openapi_nullable
|
|
77
|
+
Set.new([
|
|
78
|
+
:'memo',
|
|
79
|
+
:'payee_id',
|
|
80
|
+
:'payee_name',
|
|
81
|
+
:'category_id',
|
|
82
|
+
:'category_name',
|
|
83
|
+
:'transfer_account_id',
|
|
84
|
+
])
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Initializes the object
|
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
89
|
+
def initialize(attributes = {})
|
|
90
|
+
if (!attributes.is_a?(Hash))
|
|
91
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::ScheduledSubTransactionBase` initialize method"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
95
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
96
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
97
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ScheduledSubTransactionBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
98
|
+
end
|
|
99
|
+
h[k.to_sym] = v
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:'id')
|
|
103
|
+
self.id = attributes[:'id']
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'scheduled_transaction_id')
|
|
107
|
+
self.scheduled_transaction_id = attributes[:'scheduled_transaction_id']
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'amount')
|
|
111
|
+
self.amount = attributes[:'amount']
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'memo')
|
|
115
|
+
self.memo = attributes[:'memo']
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'payee_id')
|
|
119
|
+
self.payee_id = attributes[:'payee_id']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'payee_name')
|
|
123
|
+
self.payee_name = attributes[:'payee_name']
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'category_id')
|
|
127
|
+
self.category_id = attributes[:'category_id']
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'category_name')
|
|
131
|
+
self.category_name = attributes[:'category_name']
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'transfer_account_id')
|
|
135
|
+
self.transfer_account_id = attributes[:'transfer_account_id']
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if attributes.key?(:'deleted')
|
|
139
|
+
self.deleted = attributes[:'deleted']
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
144
|
+
# @return Array for valid properties with the reasons
|
|
145
|
+
def list_invalid_properties
|
|
146
|
+
invalid_properties = Array.new
|
|
147
|
+
invalid_properties
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Check to see if the all the properties in the model are valid
|
|
151
|
+
# @return true if the model is valid
|
|
152
|
+
def valid?
|
|
153
|
+
return false if @id.nil?
|
|
154
|
+
return false if @scheduled_transaction_id.nil?
|
|
155
|
+
return false if @amount.nil?
|
|
156
|
+
return false if @deleted.nil?
|
|
157
|
+
true
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Checks equality by comparing each attribute.
|
|
161
|
+
# @param [Object] Object to be compared
|
|
162
|
+
def ==(o)
|
|
163
|
+
return true if self.equal?(o)
|
|
164
|
+
self.class == o.class &&
|
|
165
|
+
id == o.id &&
|
|
166
|
+
scheduled_transaction_id == o.scheduled_transaction_id &&
|
|
167
|
+
amount == o.amount &&
|
|
168
|
+
memo == o.memo &&
|
|
169
|
+
payee_id == o.payee_id &&
|
|
170
|
+
payee_name == o.payee_name &&
|
|
171
|
+
category_id == o.category_id &&
|
|
172
|
+
category_name == o.category_name &&
|
|
173
|
+
transfer_account_id == o.transfer_account_id &&
|
|
174
|
+
deleted == o.deleted
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# @see the `==` method
|
|
178
|
+
# @param [Object] Object to be compared
|
|
179
|
+
def eql?(o)
|
|
180
|
+
self == o
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Calculates hash code according to all attributes.
|
|
184
|
+
# @return [Integer] Hash code
|
|
185
|
+
def hash
|
|
186
|
+
[id, scheduled_transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, deleted].hash
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Builds the object from hash
|
|
190
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
191
|
+
# @return [Object] Returns the model itself
|
|
192
|
+
def self.build_from_hash(attributes)
|
|
193
|
+
return nil unless attributes.is_a?(Hash)
|
|
194
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
195
|
+
transformed_hash = {}
|
|
196
|
+
openapi_types.each_pair do |key, type|
|
|
197
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
198
|
+
transformed_hash["#{key}"] = nil
|
|
199
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
200
|
+
# check to ensure the input is an array given that the attribute
|
|
201
|
+
# is documented as an array but the input is not
|
|
202
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
203
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
204
|
+
end
|
|
205
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
206
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
new(transformed_hash)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Returns the object in the form of hash
|
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
|
214
|
+
def to_hash
|
|
215
|
+
hash = {}
|
|
216
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
217
|
+
value = self.send(attr)
|
|
218
|
+
if value.nil?
|
|
219
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
220
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
hash[param] = _to_hash(value)
|
|
224
|
+
end
|
|
225
|
+
hash
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
end
|
|
@@ -44,6 +44,12 @@ module YNAB
|
|
|
44
44
|
# Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests.
|
|
45
45
|
attr_accessor :deleted
|
|
46
46
|
|
|
47
|
+
# The scheduled transaction amount formatted in the plan's currency format
|
|
48
|
+
attr_accessor :amount_formatted
|
|
49
|
+
|
|
50
|
+
# The scheduled transaction amount as a decimal currency amount
|
|
51
|
+
attr_accessor :amount_currency
|
|
52
|
+
|
|
47
53
|
attr_accessor :account_name
|
|
48
54
|
|
|
49
55
|
attr_accessor :payee_name
|
|
@@ -92,6 +98,8 @@ module YNAB
|
|
|
92
98
|
:'category_id' => :'category_id',
|
|
93
99
|
:'transfer_account_id' => :'transfer_account_id',
|
|
94
100
|
:'deleted' => :'deleted',
|
|
101
|
+
:'amount_formatted' => :'amount_formatted',
|
|
102
|
+
:'amount_currency' => :'amount_currency',
|
|
95
103
|
:'account_name' => :'account_name',
|
|
96
104
|
:'payee_name' => :'payee_name',
|
|
97
105
|
:'category_name' => :'category_name',
|
|
@@ -120,6 +128,8 @@ module YNAB
|
|
|
120
128
|
:'category_id' => :'String',
|
|
121
129
|
:'transfer_account_id' => :'String',
|
|
122
130
|
:'deleted' => :'Boolean',
|
|
131
|
+
:'amount_formatted' => :'String',
|
|
132
|
+
:'amount_currency' => :'Float',
|
|
123
133
|
:'account_name' => :'String',
|
|
124
134
|
:'payee_name' => :'String',
|
|
125
135
|
:'category_name' => :'String',
|
|
@@ -210,6 +220,14 @@ module YNAB
|
|
|
210
220
|
self.deleted = attributes[:'deleted']
|
|
211
221
|
end
|
|
212
222
|
|
|
223
|
+
if attributes.key?(:'amount_formatted')
|
|
224
|
+
self.amount_formatted = attributes[:'amount_formatted']
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
if attributes.key?(:'amount_currency')
|
|
228
|
+
self.amount_currency = attributes[:'amount_currency']
|
|
229
|
+
end
|
|
230
|
+
|
|
213
231
|
if attributes.key?(:'account_name')
|
|
214
232
|
self.account_name = attributes[:'account_name']
|
|
215
233
|
end
|
|
@@ -277,6 +295,8 @@ module YNAB
|
|
|
277
295
|
category_id == o.category_id &&
|
|
278
296
|
transfer_account_id == o.transfer_account_id &&
|
|
279
297
|
deleted == o.deleted &&
|
|
298
|
+
amount_formatted == o.amount_formatted &&
|
|
299
|
+
amount_currency == o.amount_currency &&
|
|
280
300
|
account_name == o.account_name &&
|
|
281
301
|
payee_name == o.payee_name &&
|
|
282
302
|
category_name == o.category_name &&
|
|
@@ -292,7 +312,7 @@ module YNAB
|
|
|
292
312
|
# Calculates hash code according to all attributes.
|
|
293
313
|
# @return [Integer] Hash code
|
|
294
314
|
def hash
|
|
295
|
-
[id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted, account_name, payee_name, category_name, subtransactions].hash
|
|
315
|
+
[id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted, amount_formatted, amount_currency, account_name, payee_name, category_name, subtransactions].hash
|
|
296
316
|
end
|
|
297
317
|
|
|
298
318
|
# Builds the object from hash
|
|
@@ -44,6 +44,12 @@ module YNAB
|
|
|
44
44
|
# Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests.
|
|
45
45
|
attr_accessor :deleted
|
|
46
46
|
|
|
47
|
+
# The scheduled transaction amount formatted in the plan's currency format
|
|
48
|
+
attr_accessor :amount_formatted
|
|
49
|
+
|
|
50
|
+
# The scheduled transaction amount as a decimal currency amount
|
|
51
|
+
attr_accessor :amount_currency
|
|
52
|
+
|
|
47
53
|
class EnumAttributeValidator
|
|
48
54
|
attr_reader :datatype
|
|
49
55
|
attr_reader :allowable_values
|
|
@@ -81,7 +87,9 @@ module YNAB
|
|
|
81
87
|
:'payee_id' => :'payee_id',
|
|
82
88
|
:'category_id' => :'category_id',
|
|
83
89
|
:'transfer_account_id' => :'transfer_account_id',
|
|
84
|
-
:'deleted' => :'deleted'
|
|
90
|
+
:'deleted' => :'deleted',
|
|
91
|
+
:'amount_formatted' => :'amount_formatted',
|
|
92
|
+
:'amount_currency' => :'amount_currency'
|
|
85
93
|
}
|
|
86
94
|
end
|
|
87
95
|
|
|
@@ -105,22 +113,26 @@ module YNAB
|
|
|
105
113
|
:'payee_id' => :'String',
|
|
106
114
|
:'category_id' => :'String',
|
|
107
115
|
:'transfer_account_id' => :'String',
|
|
108
|
-
:'deleted' => :'Boolean'
|
|
116
|
+
:'deleted' => :'Boolean',
|
|
117
|
+
:'amount_formatted' => :'String',
|
|
118
|
+
:'amount_currency' => :'Float'
|
|
109
119
|
}
|
|
110
120
|
end
|
|
111
121
|
|
|
112
122
|
# List of attributes with nullable: true
|
|
113
123
|
def self.openapi_nullable
|
|
114
124
|
Set.new([
|
|
115
|
-
:'memo',
|
|
116
125
|
:'flag_color',
|
|
117
|
-
:'flag_name',
|
|
118
|
-
:'payee_id',
|
|
119
|
-
:'category_id',
|
|
120
|
-
:'transfer_account_id',
|
|
121
126
|
])
|
|
122
127
|
end
|
|
123
128
|
|
|
129
|
+
# List of class defined in allOf (OpenAPI v3)
|
|
130
|
+
def self.openapi_all_of
|
|
131
|
+
[
|
|
132
|
+
:'ScheduledTransactionSummaryBase'
|
|
133
|
+
]
|
|
134
|
+
end
|
|
135
|
+
|
|
124
136
|
# Initializes the object
|
|
125
137
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
126
138
|
def initialize(attributes = {})
|
|
@@ -187,6 +199,14 @@ module YNAB
|
|
|
187
199
|
if attributes.key?(:'deleted')
|
|
188
200
|
self.deleted = attributes[:'deleted']
|
|
189
201
|
end
|
|
202
|
+
|
|
203
|
+
if attributes.key?(:'amount_formatted')
|
|
204
|
+
self.amount_formatted = attributes[:'amount_formatted']
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
if attributes.key?(:'amount_currency')
|
|
208
|
+
self.amount_currency = attributes[:'amount_currency']
|
|
209
|
+
end
|
|
190
210
|
end
|
|
191
211
|
|
|
192
212
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -234,7 +254,9 @@ module YNAB
|
|
|
234
254
|
payee_id == o.payee_id &&
|
|
235
255
|
category_id == o.category_id &&
|
|
236
256
|
transfer_account_id == o.transfer_account_id &&
|
|
237
|
-
deleted == o.deleted
|
|
257
|
+
deleted == o.deleted &&
|
|
258
|
+
amount_formatted == o.amount_formatted &&
|
|
259
|
+
amount_currency == o.amount_currency
|
|
238
260
|
end
|
|
239
261
|
|
|
240
262
|
# @see the `==` method
|
|
@@ -246,7 +268,7 @@ module YNAB
|
|
|
246
268
|
# Calculates hash code according to all attributes.
|
|
247
269
|
# @return [Integer] Hash code
|
|
248
270
|
def hash
|
|
249
|
-
[id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted].hash
|
|
271
|
+
[id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted, amount_formatted, amount_currency].hash
|
|
250
272
|
end
|
|
251
273
|
|
|
252
274
|
# Builds the object from hash
|
|
@@ -0,0 +1,292 @@
|
|
|
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
|
+
Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'date'
|
|
11
|
+
require 'time'
|
|
12
|
+
|
|
13
|
+
module YNAB
|
|
14
|
+
class ScheduledTransactionSummaryBase < ApiModelBase
|
|
15
|
+
attr_accessor :id
|
|
16
|
+
|
|
17
|
+
# The first date for which the Scheduled Transaction was scheduled.
|
|
18
|
+
attr_accessor :date_first
|
|
19
|
+
|
|
20
|
+
# The next date for which the Scheduled Transaction is scheduled.
|
|
21
|
+
attr_accessor :date_next
|
|
22
|
+
|
|
23
|
+
attr_accessor :frequency
|
|
24
|
+
|
|
25
|
+
# The scheduled transaction amount in milliunits format
|
|
26
|
+
attr_accessor :amount
|
|
27
|
+
|
|
28
|
+
attr_accessor :memo
|
|
29
|
+
|
|
30
|
+
attr_accessor :flag_color
|
|
31
|
+
|
|
32
|
+
# The customized name of a transaction flag
|
|
33
|
+
attr_accessor :flag_name
|
|
34
|
+
|
|
35
|
+
attr_accessor :account_id
|
|
36
|
+
|
|
37
|
+
attr_accessor :payee_id
|
|
38
|
+
|
|
39
|
+
attr_accessor :category_id
|
|
40
|
+
|
|
41
|
+
# If a transfer, the account_id which the scheduled transaction transfers to
|
|
42
|
+
attr_accessor :transfer_account_id
|
|
43
|
+
|
|
44
|
+
# Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests.
|
|
45
|
+
attr_accessor :deleted
|
|
46
|
+
|
|
47
|
+
class EnumAttributeValidator
|
|
48
|
+
attr_reader :datatype
|
|
49
|
+
attr_reader :allowable_values
|
|
50
|
+
|
|
51
|
+
def initialize(datatype, allowable_values)
|
|
52
|
+
@allowable_values = allowable_values.map do |value|
|
|
53
|
+
case datatype.to_s
|
|
54
|
+
when /Integer/i
|
|
55
|
+
value.to_i
|
|
56
|
+
when /Float/i
|
|
57
|
+
value.to_f
|
|
58
|
+
else
|
|
59
|
+
value
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def valid?(value)
|
|
65
|
+
!value || allowable_values.include?(value)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
70
|
+
def self.attribute_map
|
|
71
|
+
{
|
|
72
|
+
:'id' => :'id',
|
|
73
|
+
:'date_first' => :'date_first',
|
|
74
|
+
:'date_next' => :'date_next',
|
|
75
|
+
:'frequency' => :'frequency',
|
|
76
|
+
:'amount' => :'amount',
|
|
77
|
+
:'memo' => :'memo',
|
|
78
|
+
:'flag_color' => :'flag_color',
|
|
79
|
+
:'flag_name' => :'flag_name',
|
|
80
|
+
:'account_id' => :'account_id',
|
|
81
|
+
:'payee_id' => :'payee_id',
|
|
82
|
+
:'category_id' => :'category_id',
|
|
83
|
+
:'transfer_account_id' => :'transfer_account_id',
|
|
84
|
+
:'deleted' => :'deleted'
|
|
85
|
+
}
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Returns all the JSON keys this model knows about
|
|
89
|
+
def self.acceptable_attributes
|
|
90
|
+
attribute_map.values
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Attribute type mapping.
|
|
94
|
+
def self.openapi_types
|
|
95
|
+
{
|
|
96
|
+
:'id' => :'String',
|
|
97
|
+
:'date_first' => :'Date',
|
|
98
|
+
:'date_next' => :'Date',
|
|
99
|
+
:'frequency' => :'String',
|
|
100
|
+
:'amount' => :'Integer',
|
|
101
|
+
:'memo' => :'String',
|
|
102
|
+
:'flag_color' => :'TransactionFlagColor',
|
|
103
|
+
:'flag_name' => :'String',
|
|
104
|
+
:'account_id' => :'String',
|
|
105
|
+
:'payee_id' => :'String',
|
|
106
|
+
:'category_id' => :'String',
|
|
107
|
+
:'transfer_account_id' => :'String',
|
|
108
|
+
:'deleted' => :'Boolean'
|
|
109
|
+
}
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# List of attributes with nullable: true
|
|
113
|
+
def self.openapi_nullable
|
|
114
|
+
Set.new([
|
|
115
|
+
:'memo',
|
|
116
|
+
:'flag_color',
|
|
117
|
+
:'flag_name',
|
|
118
|
+
:'payee_id',
|
|
119
|
+
:'category_id',
|
|
120
|
+
:'transfer_account_id',
|
|
121
|
+
])
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Initializes the object
|
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
126
|
+
def initialize(attributes = {})
|
|
127
|
+
if (!attributes.is_a?(Hash))
|
|
128
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::ScheduledTransactionSummaryBase` initialize method"
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
132
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
133
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
134
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ScheduledTransactionSummaryBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
135
|
+
end
|
|
136
|
+
h[k.to_sym] = v
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'id')
|
|
140
|
+
self.id = attributes[:'id']
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'date_first')
|
|
144
|
+
self.date_first = attributes[:'date_first']
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if attributes.key?(:'date_next')
|
|
148
|
+
self.date_next = attributes[:'date_next']
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if attributes.key?(:'frequency')
|
|
152
|
+
self.frequency = attributes[:'frequency']
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if attributes.key?(:'amount')
|
|
156
|
+
self.amount = attributes[:'amount']
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if attributes.key?(:'memo')
|
|
160
|
+
self.memo = attributes[:'memo']
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if attributes.key?(:'flag_color')
|
|
164
|
+
self.flag_color = attributes[:'flag_color']
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if attributes.key?(:'flag_name')
|
|
168
|
+
self.flag_name = attributes[:'flag_name']
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
if attributes.key?(:'account_id')
|
|
172
|
+
self.account_id = attributes[:'account_id']
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
if attributes.key?(:'payee_id')
|
|
176
|
+
self.payee_id = attributes[:'payee_id']
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
if attributes.key?(:'category_id')
|
|
180
|
+
self.category_id = attributes[:'category_id']
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if attributes.key?(:'transfer_account_id')
|
|
184
|
+
self.transfer_account_id = attributes[:'transfer_account_id']
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if attributes.key?(:'deleted')
|
|
188
|
+
self.deleted = attributes[:'deleted']
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
193
|
+
# @return Array for valid properties with the reasons
|
|
194
|
+
def list_invalid_properties
|
|
195
|
+
invalid_properties = Array.new
|
|
196
|
+
invalid_properties
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Check to see if the all the properties in the model are valid
|
|
200
|
+
# @return true if the model is valid
|
|
201
|
+
def valid?
|
|
202
|
+
return false if @id.nil?
|
|
203
|
+
return false if @date_first.nil?
|
|
204
|
+
return false if @date_next.nil?
|
|
205
|
+
return false if @frequency.nil?
|
|
206
|
+
frequency_validator = EnumAttributeValidator.new('String', ["never", "daily", "weekly", "everyOtherWeek", "twiceAMonth", "every4Weeks", "monthly", "everyOtherMonth", "every3Months", "every4Months", "twiceAYear", "yearly", "everyOtherYear"])
|
|
207
|
+
return false unless frequency_validator.valid?(@frequency)
|
|
208
|
+
return false if @amount.nil?
|
|
209
|
+
return false if @account_id.nil?
|
|
210
|
+
return false if @deleted.nil?
|
|
211
|
+
true
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
215
|
+
# @param [Object] frequency Object to be assigned
|
|
216
|
+
def frequency=(frequency)
|
|
217
|
+
@frequency = frequency
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Checks equality by comparing each attribute.
|
|
221
|
+
# @param [Object] Object to be compared
|
|
222
|
+
def ==(o)
|
|
223
|
+
return true if self.equal?(o)
|
|
224
|
+
self.class == o.class &&
|
|
225
|
+
id == o.id &&
|
|
226
|
+
date_first == o.date_first &&
|
|
227
|
+
date_next == o.date_next &&
|
|
228
|
+
frequency == o.frequency &&
|
|
229
|
+
amount == o.amount &&
|
|
230
|
+
memo == o.memo &&
|
|
231
|
+
flag_color == o.flag_color &&
|
|
232
|
+
flag_name == o.flag_name &&
|
|
233
|
+
account_id == o.account_id &&
|
|
234
|
+
payee_id == o.payee_id &&
|
|
235
|
+
category_id == o.category_id &&
|
|
236
|
+
transfer_account_id == o.transfer_account_id &&
|
|
237
|
+
deleted == o.deleted
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# @see the `==` method
|
|
241
|
+
# @param [Object] Object to be compared
|
|
242
|
+
def eql?(o)
|
|
243
|
+
self == o
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Calculates hash code according to all attributes.
|
|
247
|
+
# @return [Integer] Hash code
|
|
248
|
+
def hash
|
|
249
|
+
[id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted].hash
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Builds the object from hash
|
|
253
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
254
|
+
# @return [Object] Returns the model itself
|
|
255
|
+
def self.build_from_hash(attributes)
|
|
256
|
+
return nil unless attributes.is_a?(Hash)
|
|
257
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
258
|
+
transformed_hash = {}
|
|
259
|
+
openapi_types.each_pair do |key, type|
|
|
260
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
261
|
+
transformed_hash["#{key}"] = nil
|
|
262
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
263
|
+
# check to ensure the input is an array given that the attribute
|
|
264
|
+
# is documented as an array but the input is not
|
|
265
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
266
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
267
|
+
end
|
|
268
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
269
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
new(transformed_hash)
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# Returns the object in the form of hash
|
|
276
|
+
# @return [Hash] Returns the object in the form of hash
|
|
277
|
+
def to_hash
|
|
278
|
+
hash = {}
|
|
279
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
280
|
+
value = self.send(attr)
|
|
281
|
+
if value.nil?
|
|
282
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
283
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
hash[param] = _to_hash(value)
|
|
287
|
+
end
|
|
288
|
+
hash
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
end
|