ynab 5.2.0 → 5.3.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.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/DEVELOPMENT.md +6 -3
  3. data/Gemfile.lock +21 -19
  4. data/Rakefile +9 -8
  5. data/docs/ExistingCategory.md +4 -3
  6. data/docs/ExistingTransaction.md +1 -1
  7. data/docs/NewCategory.md +4 -3
  8. data/docs/NewTransaction.md +1 -1
  9. data/docs/SaveCategory.md +4 -3
  10. data/docs/SaveTransactionWithIdOrImportId.md +1 -1
  11. data/docs/SaveTransactionWithOptionalFields.md +1 -1
  12. data/docs/TransactionsApi.md +1 -1
  13. data/lib/ynab/api/accounts_api.rb +1 -1
  14. data/lib/ynab/api/categories_api.rb +1 -1
  15. data/lib/ynab/api/money_movements_api.rb +1 -1
  16. data/lib/ynab/api/months_api.rb +1 -1
  17. data/lib/ynab/api/payee_locations_api.rb +1 -1
  18. data/lib/ynab/api/payees_api.rb +1 -1
  19. data/lib/ynab/api/plans_api.rb +1 -1
  20. data/lib/ynab/api/scheduled_transactions_api.rb +1 -1
  21. data/lib/ynab/api/transactions_api.rb +3 -3
  22. data/lib/ynab/api/user_api.rb +1 -1
  23. data/lib/ynab/api_client.rb +1 -1
  24. data/lib/ynab/api_model_base.rb +1 -1
  25. data/lib/ynab/configuration.rb +1 -1
  26. data/lib/ynab/models/account.rb +38 -13
  27. data/lib/ynab/models/account_base.rb +34 -12
  28. data/lib/ynab/models/account_response.rb +31 -12
  29. data/lib/ynab/models/account_response_data.rb +31 -12
  30. data/lib/ynab/models/account_type.rb +1 -1
  31. data/lib/ynab/models/accounts_response.rb +31 -12
  32. data/lib/ynab/models/accounts_response_data.rb +31 -12
  33. data/lib/ynab/models/bulk_response.rb +31 -12
  34. data/lib/ynab/models/bulk_response_data.rb +31 -12
  35. data/lib/ynab/models/bulk_response_data_bulk.rb +31 -12
  36. data/lib/ynab/models/bulk_transactions.rb +31 -12
  37. data/lib/ynab/models/categories_response.rb +31 -12
  38. data/lib/ynab/models/categories_response_data.rb +31 -12
  39. data/lib/ynab/models/category.rb +47 -12
  40. data/lib/ynab/models/category_base.rb +31 -12
  41. data/lib/ynab/models/category_group.rb +31 -12
  42. data/lib/ynab/models/category_group_with_categories.rb +31 -12
  43. data/lib/ynab/models/category_response.rb +31 -12
  44. data/lib/ynab/models/category_response_data.rb +31 -12
  45. data/lib/ynab/models/currency_format.rb +31 -12
  46. data/lib/ynab/models/date_format.rb +31 -12
  47. data/lib/ynab/models/error_detail.rb +31 -12
  48. data/lib/ynab/models/error_response.rb +31 -12
  49. data/lib/ynab/models/existing_category.rb +83 -19
  50. data/lib/ynab/models/existing_transaction.rb +36 -13
  51. data/lib/ynab/models/hybrid_transaction.rb +41 -12
  52. data/lib/ynab/models/hybrid_transactions_response.rb +31 -12
  53. data/lib/ynab/models/hybrid_transactions_response_data.rb +31 -12
  54. data/lib/ynab/models/money_movement.rb +38 -12
  55. data/lib/ynab/models/money_movement_base.rb +31 -12
  56. data/lib/ynab/models/money_movement_group.rb +31 -12
  57. data/lib/ynab/models/money_movement_groups_response.rb +31 -12
  58. data/lib/ynab/models/money_movement_groups_response_data.rb +31 -12
  59. data/lib/ynab/models/money_movements_response.rb +31 -12
  60. data/lib/ynab/models/money_movements_response_data.rb +31 -12
  61. data/lib/ynab/models/month_detail.rb +33 -12
  62. data/lib/ynab/models/month_detail_base.rb +33 -12
  63. data/lib/ynab/models/month_detail_response.rb +31 -12
  64. data/lib/ynab/models/month_detail_response_data.rb +31 -12
  65. data/lib/ynab/models/month_summaries_response.rb +31 -12
  66. data/lib/ynab/models/month_summaries_response_data.rb +31 -12
  67. data/lib/ynab/models/month_summary.rb +33 -12
  68. data/lib/ynab/models/month_summary_base.rb +31 -12
  69. data/lib/ynab/models/new_category.rb +83 -19
  70. data/lib/ynab/models/new_transaction.rb +36 -13
  71. data/lib/ynab/models/patch_category_group_wrapper.rb +31 -12
  72. data/lib/ynab/models/patch_category_wrapper.rb +31 -12
  73. data/lib/ynab/models/patch_month_category_wrapper.rb +31 -12
  74. data/lib/ynab/models/patch_payee_wrapper.rb +31 -12
  75. data/lib/ynab/models/patch_transactions_wrapper.rb +31 -12
  76. data/lib/ynab/models/payee.rb +31 -12
  77. data/lib/ynab/models/payee_location.rb +31 -12
  78. data/lib/ynab/models/payee_location_response.rb +31 -12
  79. data/lib/ynab/models/payee_location_response_data.rb +31 -12
  80. data/lib/ynab/models/payee_locations_response.rb +31 -12
  81. data/lib/ynab/models/payee_locations_response_data.rb +31 -12
  82. data/lib/ynab/models/payee_response.rb +31 -12
  83. data/lib/ynab/models/payee_response_data.rb +31 -12
  84. data/lib/ynab/models/payees_response.rb +31 -12
  85. data/lib/ynab/models/payees_response_data.rb +31 -12
  86. data/lib/ynab/models/plan_detail.rb +33 -12
  87. data/lib/ynab/models/plan_detail_response.rb +31 -12
  88. data/lib/ynab/models/plan_detail_response_data.rb +31 -12
  89. data/lib/ynab/models/plan_settings.rb +33 -14
  90. data/lib/ynab/models/plan_settings_response.rb +31 -12
  91. data/lib/ynab/models/plan_settings_response_data.rb +31 -12
  92. data/lib/ynab/models/plan_summary.rb +33 -12
  93. data/lib/ynab/models/plan_summary_response.rb +31 -12
  94. data/lib/ynab/models/plan_summary_response_data.rb +31 -12
  95. data/lib/ynab/models/post_account_wrapper.rb +31 -12
  96. data/lib/ynab/models/post_category_group_wrapper.rb +31 -12
  97. data/lib/ynab/models/post_category_wrapper.rb +31 -12
  98. data/lib/ynab/models/post_payee.rb +31 -12
  99. data/lib/ynab/models/post_payee_wrapper.rb +31 -12
  100. data/lib/ynab/models/post_scheduled_transaction_wrapper.rb +31 -12
  101. data/lib/ynab/models/post_transactions_wrapper.rb +31 -12
  102. data/lib/ynab/models/put_scheduled_transaction_wrapper.rb +31 -12
  103. data/lib/ynab/models/put_transaction_wrapper.rb +31 -12
  104. data/lib/ynab/models/save_account.rb +31 -12
  105. data/lib/ynab/models/save_account_type.rb +1 -1
  106. data/lib/ynab/models/save_category.rb +79 -20
  107. data/lib/ynab/models/save_category_group.rb +31 -12
  108. data/lib/ynab/models/save_category_group_response.rb +31 -12
  109. data/lib/ynab/models/save_category_group_response_data.rb +31 -12
  110. data/lib/ynab/models/save_category_response.rb +31 -12
  111. data/lib/ynab/models/save_category_response_data.rb +31 -12
  112. data/lib/ynab/models/save_month_category.rb +31 -12
  113. data/lib/ynab/models/save_payee.rb +31 -12
  114. data/lib/ynab/models/save_payee_response.rb +31 -12
  115. data/lib/ynab/models/save_payee_response_data.rb +31 -12
  116. data/lib/ynab/models/save_scheduled_transaction.rb +31 -12
  117. data/lib/ynab/models/save_sub_transaction.rb +31 -12
  118. data/lib/ynab/models/save_transaction_with_id_or_import_id.rb +36 -13
  119. data/lib/ynab/models/save_transaction_with_optional_fields.rb +32 -13
  120. data/lib/ynab/models/save_transactions_response.rb +31 -12
  121. data/lib/ynab/models/save_transactions_response_data.rb +31 -12
  122. data/lib/ynab/models/scheduled_sub_transaction.rb +37 -12
  123. data/lib/ynab/models/scheduled_sub_transaction_base.rb +31 -12
  124. data/lib/ynab/models/scheduled_transaction_detail.rb +36 -12
  125. data/lib/ynab/models/scheduled_transaction_frequency.rb +1 -1
  126. data/lib/ynab/models/scheduled_transaction_response.rb +31 -12
  127. data/lib/ynab/models/scheduled_transaction_response_data.rb +31 -12
  128. data/lib/ynab/models/scheduled_transaction_summary.rb +36 -12
  129. data/lib/ynab/models/scheduled_transaction_summary_base.rb +31 -12
  130. data/lib/ynab/models/scheduled_transactions_response.rb +31 -12
  131. data/lib/ynab/models/scheduled_transactions_response_data.rb +31 -12
  132. data/lib/ynab/models/sub_transaction.rb +38 -12
  133. data/lib/ynab/models/sub_transaction_base.rb +31 -12
  134. data/lib/ynab/models/transaction_cleared_status.rb +1 -1
  135. data/lib/ynab/models/transaction_detail.rb +41 -12
  136. data/lib/ynab/models/transaction_flag_color.rb +1 -1
  137. data/lib/ynab/models/transaction_response.rb +31 -12
  138. data/lib/ynab/models/transaction_response_data.rb +31 -12
  139. data/lib/ynab/models/transaction_summary.rb +41 -12
  140. data/lib/ynab/models/transaction_summary_base.rb +31 -12
  141. data/lib/ynab/models/transactions_import_response.rb +31 -12
  142. data/lib/ynab/models/transactions_import_response_data.rb +31 -12
  143. data/lib/ynab/models/transactions_response.rb +31 -12
  144. data/lib/ynab/models/transactions_response_data.rb +31 -12
  145. data/lib/ynab/models/user.rb +31 -12
  146. data/lib/ynab/models/user_response.rb +31 -12
  147. data/lib/ynab/models/user_response_data.rb +31 -12
  148. data/lib/ynab/version.rb +1 -1
  149. data/lib/ynab.rb +1 -1
  150. data/open_api_spec.yaml +61 -30
  151. data/templates/partial_model_generic.mustache +37 -11
  152. data/ynab.gemspec +2 -2
  153. metadata +3 -3
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #YNAB API Endpoints
3
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
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. Read the [API Documentation](https://api.ynab.com) for more information about the API, including how to obtain an access token and how to use it to make requests.
5
5
 
6
6
  Generated by: OpenAPI Generator (https://openapi-generator.tech)
7
7
 
@@ -21,9 +21,14 @@ module YNAB
21
21
  }
22
22
  end
23
23
 
24
+ # Returns attribute mapping this model knows about
25
+ def self.acceptable_attribute_map
26
+ attribute_map
27
+ end
28
+
24
29
  # Returns all the JSON keys this model knows about
25
30
  def self.acceptable_attributes
26
- attribute_map.values
31
+ acceptable_attribute_map.values
27
32
  end
28
33
 
29
34
  # Attribute type mapping.
@@ -39,6 +44,16 @@ module YNAB
39
44
  ])
40
45
  end
41
46
 
47
+ # Returns attribute type mapping
48
+ def self.acceptable_openapi_types
49
+ openapi_types
50
+ end
51
+
52
+ # Returns the nullable attributes
53
+ def self.acceptable_openapi_nullable
54
+ openapi_nullable
55
+ end
56
+
42
57
  # Initializes the object
43
58
  # @param [Hash] attributes Model attributes in the form of hash
44
59
  def initialize(attributes = {})
@@ -47,9 +62,10 @@ module YNAB
47
62
  end
48
63
 
49
64
  # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
50
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
51
- if (!self.class.attribute_map.key?(k.to_sym))
52
- fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
53
69
  end
54
70
  h[k.to_sym] = v
55
71
  }
@@ -99,18 +115,20 @@ module YNAB
99
115
  def self.build_from_hash(attributes)
100
116
  return nil unless attributes.is_a?(Hash)
101
117
  attributes = attributes.transform_keys(&:to_sym)
118
+ # include attributes inherited from allOf parents (the nearest declaration wins)
119
+ map = acceptable_attribute_map
102
120
  transformed_hash = {}
103
- openapi_types.each_pair do |key, type|
104
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
121
+ acceptable_openapi_types.each_pair do |key, type|
122
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
105
123
  transformed_hash["#{key}"] = nil
106
124
  elsif type =~ /\AArray<(.*)>/i
107
125
  # check to ensure the input is an array given that the attribute
108
126
  # is documented as an array but the input is not
109
- if attributes[attribute_map[key]].is_a?(Array)
110
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
127
+ if attributes[map[key]].is_a?(Array)
128
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
111
129
  end
112
- elsif !attributes[attribute_map[key]].nil?
113
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
130
+ elsif !attributes[map[key]].nil?
131
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
114
132
  end
115
133
  end
116
134
  new(transformed_hash)
@@ -120,10 +138,11 @@ module YNAB
120
138
  # @return [Hash] Returns the object in the form of hash
121
139
  def to_hash
122
140
  hash = {}
123
- self.class.attribute_map.each_pair do |attr, param|
141
+ # include attributes inherited from allOf parents (the nearest declaration wins)
142
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
124
143
  value = self.send(attr)
125
144
  if value.nil?
126
- is_nullable = self.class.openapi_nullable.include?(attr)
145
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
127
146
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
128
147
  end
129
148
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #YNAB API Endpoints
3
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
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. Read the [API Documentation](https://api.ynab.com) for more information about the API, including how to obtain an access token and how to use it to make requests.
5
5
 
6
6
  Generated by: OpenAPI Generator (https://openapi-generator.tech)
7
7
 
@@ -19,15 +19,40 @@ module YNAB
19
19
  # The id of the category group to which this category belongs. An internal category group may not be specified.
20
20
  attr_accessor :category_group_id
21
21
 
22
- # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories.
22
+ # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED', or to 'MF' for Credit Card Payment categories and 'DEBT' for categories paired to a loan account. When updating a category, passing null removes any existing target.
23
23
  attr_accessor :goal_target
24
24
 
25
- # The goal target date in ISO format (e.g. 2016-12-01).
25
+ # The goal target date in ISO format (e.g. 2016-12-01). Not supported for categories paired to a loan account.
26
26
  attr_accessor :goal_target_date
27
27
 
28
- # Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'.
28
+ # Whether the goal requires the full target amount each period. Only supported for 'NEED' goals, and not supported for Credit Card Payment categories or categories paired to a loan account. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'.
29
29
  attr_accessor :goal_needs_whole_amount
30
30
 
31
+ # When specified, configures a recurring 'NEED' target of goal_target that repeats at this frequency, replacing any existing target. Requires goal_target. Cannot be combined with goal_target_date and is not supported for Credit Card Payment categories or categories paired to a loan account. Omit to leave an existing target's cadence unchanged.
32
+ attr_accessor :goal_frequency
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
31
56
  # Attribute mapping from ruby-style variable name to JSON key.
32
57
  def self.attribute_map
33
58
  {
@@ -36,13 +61,19 @@ module YNAB
36
61
  :'category_group_id' => :'category_group_id',
37
62
  :'goal_target' => :'goal_target',
38
63
  :'goal_target_date' => :'goal_target_date',
39
- :'goal_needs_whole_amount' => :'goal_needs_whole_amount'
64
+ :'goal_needs_whole_amount' => :'goal_needs_whole_amount',
65
+ :'goal_frequency' => :'goal_frequency'
40
66
  }
41
67
  end
42
68
 
69
+ # Returns attribute mapping this model knows about
70
+ def self.acceptable_attribute_map
71
+ attribute_map
72
+ end
73
+
43
74
  # Returns all the JSON keys this model knows about
44
75
  def self.acceptable_attributes
45
- attribute_map.values
76
+ acceptable_attribute_map.values
46
77
  end
47
78
 
48
79
  # Attribute type mapping.
@@ -53,16 +84,32 @@ module YNAB
53
84
  :'category_group_id' => :'String',
54
85
  :'goal_target' => :'Integer',
55
86
  :'goal_target_date' => :'Date',
56
- :'goal_needs_whole_amount' => :'Boolean'
87
+ :'goal_needs_whole_amount' => :'Boolean',
88
+ :'goal_frequency' => :'String'
57
89
  }
58
90
  end
59
91
 
60
92
  # List of attributes with nullable: true
61
93
  def self.openapi_nullable
62
94
  Set.new([
95
+ :'name',
96
+ :'note',
97
+ :'goal_target',
98
+ :'goal_target_date',
99
+ :'goal_needs_whole_amount',
63
100
  ])
64
101
  end
65
102
 
103
+ # Returns attribute type mapping
104
+ def self.acceptable_openapi_types
105
+ openapi_types
106
+ end
107
+
108
+ # Returns the nullable attributes
109
+ def self.acceptable_openapi_nullable
110
+ openapi_nullable
111
+ end
112
+
66
113
  # List of class defined in allOf (OpenAPI v3)
67
114
  def self.openapi_all_of
68
115
  [
@@ -78,9 +125,10 @@ module YNAB
78
125
  end
79
126
 
80
127
  # check to see if the attribute exists and convert string to symbol for hash key
128
+ acceptable_attribute_map = self.class.acceptable_attribute_map
81
129
  attributes = attributes.each_with_object({}) { |(k, v), h|
82
- if (!self.class.attribute_map.key?(k.to_sym))
83
- fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ExistingCategory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
130
+ if (!acceptable_attribute_map.key?(k.to_sym))
131
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ExistingCategory`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
84
132
  end
85
133
  h[k.to_sym] = v
86
134
  }
@@ -108,6 +156,10 @@ module YNAB
108
156
  if attributes.key?(:'goal_needs_whole_amount')
109
157
  self.goal_needs_whole_amount = attributes[:'goal_needs_whole_amount']
110
158
  end
159
+
160
+ if attributes.key?(:'goal_frequency')
161
+ self.goal_frequency = attributes[:'goal_frequency']
162
+ end
111
163
  end
112
164
 
113
165
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -120,9 +172,17 @@ module YNAB
120
172
  # Check to see if the all the properties in the model are valid
121
173
  # @return true if the model is valid
122
174
  def valid?
175
+ goal_frequency_validator = EnumAttributeValidator.new('String', ["monthly", "weekly", "yearly"])
176
+ return false unless goal_frequency_validator.valid?(@goal_frequency)
123
177
  true
124
178
  end
125
179
 
180
+ # Custom attribute writer method checking allowed values (enum).
181
+ # @param [Object] goal_frequency Object to be assigned
182
+ def goal_frequency=(goal_frequency)
183
+ @goal_frequency = goal_frequency
184
+ end
185
+
126
186
  # Checks equality by comparing each attribute.
127
187
  # @param [Object] Object to be compared
128
188
  def ==(o)
@@ -133,7 +193,8 @@ module YNAB
133
193
  category_group_id == o.category_group_id &&
134
194
  goal_target == o.goal_target &&
135
195
  goal_target_date == o.goal_target_date &&
136
- goal_needs_whole_amount == o.goal_needs_whole_amount
196
+ goal_needs_whole_amount == o.goal_needs_whole_amount &&
197
+ goal_frequency == o.goal_frequency
137
198
  end
138
199
 
139
200
  # @see the `==` method
@@ -145,7 +206,7 @@ module YNAB
145
206
  # Calculates hash code according to all attributes.
146
207
  # @return [Integer] Hash code
147
208
  def hash
148
- [name, note, category_group_id, goal_target, goal_target_date, goal_needs_whole_amount].hash
209
+ [name, note, category_group_id, goal_target, goal_target_date, goal_needs_whole_amount, goal_frequency].hash
149
210
  end
150
211
 
151
212
  # Builds the object from hash
@@ -154,18 +215,20 @@ module YNAB
154
215
  def self.build_from_hash(attributes)
155
216
  return nil unless attributes.is_a?(Hash)
156
217
  attributes = attributes.transform_keys(&:to_sym)
218
+ # include attributes inherited from allOf parents (the nearest declaration wins)
219
+ map = acceptable_attribute_map
157
220
  transformed_hash = {}
158
- openapi_types.each_pair do |key, type|
159
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
221
+ acceptable_openapi_types.each_pair do |key, type|
222
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
160
223
  transformed_hash["#{key}"] = nil
161
224
  elsif type =~ /\AArray<(.*)>/i
162
225
  # check to ensure the input is an array given that the attribute
163
226
  # is documented as an array but the input is not
164
- if attributes[attribute_map[key]].is_a?(Array)
165
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
227
+ if attributes[map[key]].is_a?(Array)
228
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
166
229
  end
167
- elsif !attributes[attribute_map[key]].nil?
168
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
230
+ elsif !attributes[map[key]].nil?
231
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
169
232
  end
170
233
  end
171
234
  new(transformed_hash)
@@ -175,10 +238,11 @@ module YNAB
175
238
  # @return [Hash] Returns the object in the form of hash
176
239
  def to_hash
177
240
  hash = {}
178
- self.class.attribute_map.each_pair do |attr, param|
241
+ # include attributes inherited from allOf parents (the nearest declaration wins)
242
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
179
243
  value = self.send(attr)
180
244
  if value.nil?
181
- is_nullable = self.class.openapi_nullable.include?(attr)
245
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
182
246
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
247
  end
184
248
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #YNAB API Endpoints
3
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
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. Read the [API Documentation](https://api.ynab.com) for more information about the API, including how to obtain an access token and how to use it to make requests.
5
5
 
6
6
  Generated by: OpenAPI Generator (https://openapi-generator.tech)
7
7
 
@@ -38,7 +38,7 @@ module YNAB
38
38
 
39
39
  attr_accessor :flag_color
40
40
 
41
- # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
41
+ # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported and will return an error. Splits are not allowed on tracking accounts or on transfers between on-budget accounts; a transfer to a tracking account can be a split.
42
42
  attr_accessor :subtransactions
43
43
 
44
44
  class EnumAttributeValidator
@@ -80,9 +80,14 @@ module YNAB
80
80
  }
81
81
  end
82
82
 
83
+ # Returns attribute mapping this model knows about
84
+ def self.acceptable_attribute_map
85
+ attribute_map
86
+ end
87
+
83
88
  # Returns all the JSON keys this model knows about
84
89
  def self.acceptable_attributes
85
- attribute_map.values
90
+ acceptable_attribute_map.values
86
91
  end
87
92
 
88
93
  # Attribute type mapping.
@@ -105,10 +110,24 @@ module YNAB
105
110
  # List of attributes with nullable: true
106
111
  def self.openapi_nullable
107
112
  Set.new([
113
+ :'payee_id',
114
+ :'payee_name',
115
+ :'category_id',
116
+ :'memo',
108
117
  :'flag_color',
109
118
  ])
110
119
  end
111
120
 
121
+ # Returns attribute type mapping
122
+ def self.acceptable_openapi_types
123
+ openapi_types
124
+ end
125
+
126
+ # Returns the nullable attributes
127
+ def self.acceptable_openapi_nullable
128
+ openapi_nullable
129
+ end
130
+
112
131
  # List of class defined in allOf (OpenAPI v3)
113
132
  def self.openapi_all_of
114
133
  [
@@ -124,9 +143,10 @@ module YNAB
124
143
  end
125
144
 
126
145
  # check to see if the attribute exists and convert string to symbol for hash key
146
+ acceptable_attribute_map = self.class.acceptable_attribute_map
127
147
  attributes = attributes.each_with_object({}) { |(k, v), h|
128
- if (!self.class.attribute_map.key?(k.to_sym))
129
- fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ExistingTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
148
+ if (!acceptable_attribute_map.key?(k.to_sym))
149
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ExistingTransaction`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
130
150
  end
131
151
  h[k.to_sym] = v
132
152
  }
@@ -241,18 +261,20 @@ module YNAB
241
261
  def self.build_from_hash(attributes)
242
262
  return nil unless attributes.is_a?(Hash)
243
263
  attributes = attributes.transform_keys(&:to_sym)
264
+ # include attributes inherited from allOf parents (the nearest declaration wins)
265
+ map = acceptable_attribute_map
244
266
  transformed_hash = {}
245
- openapi_types.each_pair do |key, type|
246
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
267
+ acceptable_openapi_types.each_pair do |key, type|
268
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
247
269
  transformed_hash["#{key}"] = nil
248
270
  elsif type =~ /\AArray<(.*)>/i
249
271
  # check to ensure the input is an array given that the attribute
250
272
  # is documented as an array but the input is not
251
- if attributes[attribute_map[key]].is_a?(Array)
252
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
273
+ if attributes[map[key]].is_a?(Array)
274
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
253
275
  end
254
- elsif !attributes[attribute_map[key]].nil?
255
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
276
+ elsif !attributes[map[key]].nil?
277
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
256
278
  end
257
279
  end
258
280
  new(transformed_hash)
@@ -262,10 +284,11 @@ module YNAB
262
284
  # @return [Hash] Returns the object in the form of hash
263
285
  def to_hash
264
286
  hash = {}
265
- self.class.attribute_map.each_pair do |attr, param|
287
+ # include attributes inherited from allOf parents (the nearest declaration wins)
288
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
266
289
  value = self.send(attr)
267
290
  if value.nil?
268
- is_nullable = self.class.openapi_nullable.include?(attr)
291
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
269
292
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
270
293
  end
271
294
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #YNAB API Endpoints
3
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
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. Read the [API Documentation](https://api.ynab.com) for more information about the API, including how to obtain an access token and how to use it to make requests.
5
5
 
6
6
  Generated by: OpenAPI Generator (https://openapi-generator.tech)
7
7
 
@@ -135,9 +135,14 @@ module YNAB
135
135
  }
136
136
  end
137
137
 
138
+ # Returns attribute mapping this model knows about
139
+ def self.acceptable_attribute_map
140
+ attribute_map
141
+ end
142
+
138
143
  # Returns all the JSON keys this model knows about
139
144
  def self.acceptable_attributes
140
- attribute_map.values
145
+ acceptable_attribute_map.values
141
146
  end
142
147
 
143
148
  # Attribute type mapping.
@@ -175,13 +180,33 @@ module YNAB
175
180
  # List of attributes with nullable: true
176
181
  def self.openapi_nullable
177
182
  Set.new([
183
+ :'memo',
178
184
  :'flag_color',
185
+ :'flag_name',
186
+ :'payee_id',
187
+ :'category_id',
188
+ :'transfer_account_id',
189
+ :'transfer_transaction_id',
190
+ :'matched_transaction_id',
191
+ :'import_id',
192
+ :'import_payee_name',
193
+ :'import_payee_name_original',
179
194
  :'debt_transaction_type',
180
195
  :'parent_transaction_id',
181
196
  :'payee_name',
182
197
  ])
183
198
  end
184
199
 
200
+ # Returns attribute type mapping
201
+ def self.acceptable_openapi_types
202
+ openapi_types
203
+ end
204
+
205
+ # Returns the nullable attributes
206
+ def self.acceptable_openapi_nullable
207
+ openapi_nullable
208
+ end
209
+
185
210
  # List of class defined in allOf (OpenAPI v3)
186
211
  def self.openapi_all_of
187
212
  [
@@ -197,9 +222,10 @@ module YNAB
197
222
  end
198
223
 
199
224
  # check to see if the attribute exists and convert string to symbol for hash key
225
+ acceptable_attribute_map = self.class.acceptable_attribute_map
200
226
  attributes = attributes.each_with_object({}) { |(k, v), h|
201
- if (!self.class.attribute_map.key?(k.to_sym))
202
- fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::HybridTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
227
+ if (!acceptable_attribute_map.key?(k.to_sym))
228
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::HybridTransaction`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
203
229
  end
204
230
  h[k.to_sym] = v
205
231
  }
@@ -398,18 +424,20 @@ module YNAB
398
424
  def self.build_from_hash(attributes)
399
425
  return nil unless attributes.is_a?(Hash)
400
426
  attributes = attributes.transform_keys(&:to_sym)
427
+ # include attributes inherited from allOf parents (the nearest declaration wins)
428
+ map = acceptable_attribute_map
401
429
  transformed_hash = {}
402
- openapi_types.each_pair do |key, type|
403
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
430
+ acceptable_openapi_types.each_pair do |key, type|
431
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
404
432
  transformed_hash["#{key}"] = nil
405
433
  elsif type =~ /\AArray<(.*)>/i
406
434
  # check to ensure the input is an array given that the attribute
407
435
  # is documented as an array but the input is not
408
- if attributes[attribute_map[key]].is_a?(Array)
409
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
436
+ if attributes[map[key]].is_a?(Array)
437
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
410
438
  end
411
- elsif !attributes[attribute_map[key]].nil?
412
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
439
+ elsif !attributes[map[key]].nil?
440
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
413
441
  end
414
442
  end
415
443
  new(transformed_hash)
@@ -419,10 +447,11 @@ module YNAB
419
447
  # @return [Hash] Returns the object in the form of hash
420
448
  def to_hash
421
449
  hash = {}
422
- self.class.attribute_map.each_pair do |attr, param|
450
+ # include attributes inherited from allOf parents (the nearest declaration wins)
451
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
423
452
  value = self.send(attr)
424
453
  if value.nil?
425
- is_nullable = self.class.openapi_nullable.include?(attr)
454
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
426
455
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
427
456
  end
428
457
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #YNAB API Endpoints
3
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
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. Read the [API Documentation](https://api.ynab.com) for more information about the API, including how to obtain an access token and how to use it to make requests.
5
5
 
6
6
  Generated by: OpenAPI Generator (https://openapi-generator.tech)
7
7
 
@@ -21,9 +21,14 @@ module YNAB
21
21
  }
22
22
  end
23
23
 
24
+ # Returns attribute mapping this model knows about
25
+ def self.acceptable_attribute_map
26
+ attribute_map
27
+ end
28
+
24
29
  # Returns all the JSON keys this model knows about
25
30
  def self.acceptable_attributes
26
- attribute_map.values
31
+ acceptable_attribute_map.values
27
32
  end
28
33
 
29
34
  # Attribute type mapping.
@@ -39,6 +44,16 @@ module YNAB
39
44
  ])
40
45
  end
41
46
 
47
+ # Returns attribute type mapping
48
+ def self.acceptable_openapi_types
49
+ openapi_types
50
+ end
51
+
52
+ # Returns the nullable attributes
53
+ def self.acceptable_openapi_nullable
54
+ openapi_nullable
55
+ end
56
+
42
57
  # Initializes the object
43
58
  # @param [Hash] attributes Model attributes in the form of hash
44
59
  def initialize(attributes = {})
@@ -47,9 +62,10 @@ module YNAB
47
62
  end
48
63
 
49
64
  # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
50
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
51
- if (!self.class.attribute_map.key?(k.to_sym))
52
- fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::HybridTransactionsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::HybridTransactionsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
53
69
  end
54
70
  h[k.to_sym] = v
55
71
  }
@@ -99,18 +115,20 @@ module YNAB
99
115
  def self.build_from_hash(attributes)
100
116
  return nil unless attributes.is_a?(Hash)
101
117
  attributes = attributes.transform_keys(&:to_sym)
118
+ # include attributes inherited from allOf parents (the nearest declaration wins)
119
+ map = acceptable_attribute_map
102
120
  transformed_hash = {}
103
- openapi_types.each_pair do |key, type|
104
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
121
+ acceptable_openapi_types.each_pair do |key, type|
122
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
105
123
  transformed_hash["#{key}"] = nil
106
124
  elsif type =~ /\AArray<(.*)>/i
107
125
  # check to ensure the input is an array given that the attribute
108
126
  # is documented as an array but the input is not
109
- if attributes[attribute_map[key]].is_a?(Array)
110
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
127
+ if attributes[map[key]].is_a?(Array)
128
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
111
129
  end
112
- elsif !attributes[attribute_map[key]].nil?
113
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
130
+ elsif !attributes[map[key]].nil?
131
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
114
132
  end
115
133
  end
116
134
  new(transformed_hash)
@@ -120,10 +138,11 @@ module YNAB
120
138
  # @return [Hash] Returns the object in the form of hash
121
139
  def to_hash
122
140
  hash = {}
123
- self.class.attribute_map.each_pair do |attr, param|
141
+ # include attributes inherited from allOf parents (the nearest declaration wins)
142
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
124
143
  value = self.send(attr)
125
144
  if value.nil?
126
- is_nullable = self.class.openapi_nullable.include?(attr)
145
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
127
146
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
128
147
  end
129
148