ynab 4.9.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.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/Rakefile +2 -2
  4. data/docs/Account.md +6 -0
  5. data/docs/AccountBase.md +25 -0
  6. data/docs/AccountsApi.md +3 -3
  7. data/docs/CategoriesApi.md +8 -8
  8. data/docs/Category.md +14 -0
  9. data/docs/CategoryBase.md +33 -0
  10. data/docs/ExistingCategory.md +2 -1
  11. data/docs/HybridTransaction.md +2 -0
  12. data/docs/MoneyMovement.md +2 -0
  13. data/docs/MoneyMovementBase.md +16 -0
  14. data/docs/MoneyMovementsApi.md +4 -4
  15. data/docs/MonthDetail.md +8 -0
  16. data/docs/MonthDetailBase.md +16 -0
  17. data/docs/MonthSummary.md +8 -0
  18. data/docs/MonthSummaryBase.md +15 -0
  19. data/docs/MonthsApi.md +2 -2
  20. data/docs/NewCategory.md +2 -1
  21. data/docs/PayeeLocationsApi.md +3 -3
  22. data/docs/PayeesApi.md +24 -3
  23. data/docs/PlanDetail.md +7 -7
  24. data/docs/PlanDetailResponseData.md +1 -1
  25. data/docs/PlanSummaryResponseData.md +2 -2
  26. data/docs/PlansApi.md +3 -3
  27. data/docs/PostPayee.md +8 -0
  28. data/docs/PostPayeeWrapper.md +8 -0
  29. data/docs/SaveAccount.md +1 -1
  30. data/docs/SaveAccountType.md +7 -0
  31. data/docs/SaveCategory.md +2 -1
  32. data/docs/SavePayee.md +1 -1
  33. data/docs/ScheduledSubTransaction.md +2 -0
  34. data/docs/ScheduledSubTransactionBase.md +17 -0
  35. data/docs/ScheduledTransactionDetail.md +2 -0
  36. data/docs/ScheduledTransactionSummary.md +2 -0
  37. data/docs/ScheduledTransactionSummaryBase.md +20 -0
  38. data/docs/ScheduledTransactionsApi.md +5 -5
  39. data/docs/SubTransaction.md +2 -0
  40. data/docs/SubTransactionBase.md +18 -0
  41. data/docs/TransactionDetail.md +2 -0
  42. data/docs/TransactionSummary.md +2 -0
  43. data/docs/TransactionSummaryBase.md +26 -0
  44. data/docs/TransactionsApi.md +11 -11
  45. data/lib/ynab/api/accounts_api.rb +3 -3
  46. data/lib/ynab/api/categories_api.rb +8 -8
  47. data/lib/ynab/api/deprecated_api.rb +3 -3
  48. data/lib/ynab/api/money_movements_api.rb +4 -4
  49. data/lib/ynab/api/months_api.rb +2 -2
  50. data/lib/ynab/api/payee_locations_api.rb +3 -3
  51. data/lib/ynab/api/payees_api.rb +77 -3
  52. data/lib/ynab/api/plans_api.rb +3 -3
  53. data/lib/ynab/api/scheduled_transactions_api.rb +5 -5
  54. data/lib/ynab/api/transactions_api.rb +11 -11
  55. data/lib/ynab/models/account.rb +72 -8
  56. data/lib/ynab/models/account_base.rb +340 -0
  57. data/lib/ynab/models/category.rb +159 -20
  58. data/lib/ynab/models/category_base.rb +436 -0
  59. data/lib/ynab/models/existing_category.rb +15 -5
  60. data/lib/ynab/models/hybrid_transaction.rb +21 -1
  61. data/lib/ynab/models/money_movement.rb +31 -11
  62. data/lib/ynab/models/money_movement_base.rb +223 -0
  63. data/lib/ynab/models/month_detail.rb +81 -1
  64. data/lib/ynab/models/month_detail_base.rb +230 -0
  65. data/lib/ynab/models/month_summary.rb +91 -6
  66. data/lib/ynab/models/month_summary_base.rb +212 -0
  67. data/lib/ynab/models/new_category.rb +15 -5
  68. data/lib/ynab/models/plan_detail.rb +7 -7
  69. data/lib/ynab/models/plan_detail_response_data.rb +8 -8
  70. data/lib/ynab/models/plan_summary_response_data.rb +15 -15
  71. data/lib/ynab/models/post_payee.rb +148 -0
  72. data/lib/ynab/models/post_payee_wrapper.rb +136 -0
  73. data/lib/ynab/models/save_account.rb +1 -1
  74. data/lib/ynab/models/save_account_type.rb +45 -0
  75. data/lib/ynab/models/save_category.rb +17 -6
  76. data/lib/ynab/models/save_payee.rb +1 -1
  77. data/lib/ynab/models/scheduled_sub_transaction.rb +31 -10
  78. data/lib/ynab/models/scheduled_sub_transaction_base.rb +229 -0
  79. data/lib/ynab/models/scheduled_transaction_detail.rb +21 -1
  80. data/lib/ynab/models/scheduled_transaction_summary.rb +31 -9
  81. data/lib/ynab/models/scheduled_transaction_summary_base.rb +292 -0
  82. data/lib/ynab/models/sub_transaction.rb +31 -11
  83. data/lib/ynab/models/sub_transaction_base.rb +240 -0
  84. data/lib/ynab/models/transaction_detail.rb +21 -1
  85. data/lib/ynab/models/transaction_summary.rb +31 -14
  86. data/lib/ynab/models/transaction_summary_base.rb +358 -0
  87. data/lib/ynab/version.rb +1 -1
  88. data/lib/ynab.rb +12 -0
  89. data/open_api_spec.yaml +330 -56
  90. data/spec/api/accounts_spec.rb +3 -3
  91. data/spec/api/categories_spec.rb +3 -3
  92. data/spec/api/months_spec.rb +2 -2
  93. data/spec/api/payee_locations_spec.rb +2 -2
  94. data/spec/api/payees_spec.rb +2 -2
  95. data/spec/api/plans_spec.rb +9 -9
  96. data/spec/api/scheduled_transactions_spec.rb +3 -3
  97. data/spec/api/transactions_spec.rb +11 -11
  98. data/spec/fixtures/vcr_cassettes/account.yml +2 -2
  99. data/spec/fixtures/vcr_cassettes/accounts.yml +2 -2
  100. data/spec/fixtures/vcr_cassettes/accounts_unauthorized.yml +2 -2
  101. data/spec/fixtures/vcr_cassettes/bulk_transactions.yml +2 -2
  102. data/spec/fixtures/vcr_cassettes/categories.yml +2 -2
  103. data/spec/fixtures/vcr_cassettes/categories_unauthorized.yml +2 -2
  104. data/spec/fixtures/vcr_cassettes/category.yml +2 -2
  105. data/spec/fixtures/vcr_cassettes/category_transactions.yml +2 -2
  106. data/spec/fixtures/vcr_cassettes/create_account.yml +2 -2
  107. data/spec/fixtures/vcr_cassettes/create_scheduled_transaction.yml +2 -2
  108. data/spec/fixtures/vcr_cassettes/create_transaction.yml +2 -2
  109. data/spec/fixtures/vcr_cassettes/create_transactions.yml +2 -2
  110. data/spec/fixtures/vcr_cassettes/import_transactions.yml +2 -2
  111. data/spec/fixtures/vcr_cassettes/month.yml +2 -2
  112. data/spec/fixtures/vcr_cassettes/month_transactions.yml +2 -2
  113. data/spec/fixtures/vcr_cassettes/months.yml +2 -2
  114. data/spec/fixtures/vcr_cassettes/months_unauthorized.yml +2 -2
  115. data/spec/fixtures/vcr_cassettes/multiple_transactions.yml +2 -2
  116. data/spec/fixtures/vcr_cassettes/patch_month_category.yml +2 -2
  117. data/spec/fixtures/vcr_cassettes/payee.yml +2 -2
  118. data/spec/fixtures/vcr_cassettes/payee_location.yml +2 -2
  119. data/spec/fixtures/vcr_cassettes/payee_locations.yml +2 -2
  120. data/spec/fixtures/vcr_cassettes/payee_locations_unauthorized.yml +2 -2
  121. data/spec/fixtures/vcr_cassettes/payee_transactions.yml +2 -2
  122. data/spec/fixtures/vcr_cassettes/payees.yml +2 -2
  123. data/spec/fixtures/vcr_cassettes/payees_unauthorized.yml +2 -2
  124. data/spec/fixtures/vcr_cassettes/{budget.yml → plan.yml} +3 -3
  125. data/spec/fixtures/vcr_cassettes/plans.yml +3 -3
  126. data/spec/fixtures/vcr_cassettes/plans_unauthorized.yml +2 -2
  127. data/spec/fixtures/vcr_cassettes/scheduled_transaction.yml +2 -2
  128. data/spec/fixtures/vcr_cassettes/scheduled_transactions.yml +2 -2
  129. data/spec/fixtures/vcr_cassettes/scheduled_transactions_unauthorized.yml +2 -2
  130. data/spec/fixtures/vcr_cassettes/transaction.yml +2 -2
  131. data/spec/fixtures/vcr_cassettes/transactions.yml +2 -2
  132. data/spec/fixtures/vcr_cassettes/transactions_invalid_flags.yml +2 -2
  133. data/spec/fixtures/vcr_cassettes/transactions_unauthorized.yml +2 -2
  134. data/spec/fixtures/vcr_cassettes/update_transaction.yml +2 -2
  135. data/spec/fixtures/vcr_cassettes/update_transactions.yml +2 -2
  136. data/ynab.gemspec +1 -1
  137. metadata +29 -9
  138. data/spec/fixtures/vcr_cassettes/budgets.yml +0 -49
  139. data/spec/fixtures/vcr_cassettes/budgets_unauthorized.yml +0 -49
@@ -12,7 +12,7 @@ require 'time'
12
12
 
13
13
  module YNAB
14
14
  class PlanDetailResponseData < ApiModelBase
15
- attr_accessor :budget
15
+ attr_accessor :plan
16
16
 
17
17
  # The knowledge of the server
18
18
  attr_accessor :server_knowledge
@@ -20,7 +20,7 @@ module YNAB
20
20
  # Attribute mapping from ruby-style variable name to JSON key.
21
21
  def self.attribute_map
22
22
  {
23
- :'budget' => :'budget',
23
+ :'plan' => :'plan',
24
24
  :'server_knowledge' => :'server_knowledge'
25
25
  }
26
26
  end
@@ -33,7 +33,7 @@ module YNAB
33
33
  # Attribute type mapping.
34
34
  def self.openapi_types
35
35
  {
36
- :'budget' => :'PlanDetail',
36
+ :'plan' => :'PlanDetail',
37
37
  :'server_knowledge' => :'Integer'
38
38
  }
39
39
  end
@@ -59,8 +59,8 @@ module YNAB
59
59
  h[k.to_sym] = v
60
60
  }
61
61
 
62
- if attributes.key?(:'budget')
63
- self.budget = attributes[:'budget']
62
+ if attributes.key?(:'plan')
63
+ self.plan = attributes[:'plan']
64
64
  end
65
65
 
66
66
  if attributes.key?(:'server_knowledge')
@@ -78,7 +78,7 @@ module YNAB
78
78
  # Check to see if the all the properties in the model are valid
79
79
  # @return true if the model is valid
80
80
  def valid?
81
- return false if @budget.nil?
81
+ return false if @plan.nil?
82
82
  return false if @server_knowledge.nil?
83
83
  true
84
84
  end
@@ -88,7 +88,7 @@ module YNAB
88
88
  def ==(o)
89
89
  return true if self.equal?(o)
90
90
  self.class == o.class &&
91
- budget == o.budget &&
91
+ plan == o.plan &&
92
92
  server_knowledge == o.server_knowledge
93
93
  end
94
94
 
@@ -101,7 +101,7 @@ module YNAB
101
101
  # Calculates hash code according to all attributes.
102
102
  # @return [Integer] Hash code
103
103
  def hash
104
- [budget, server_knowledge].hash
104
+ [plan, server_knowledge].hash
105
105
  end
106
106
 
107
107
  # Builds the object from hash
@@ -12,15 +12,15 @@ require 'time'
12
12
 
13
13
  module YNAB
14
14
  class PlanSummaryResponseData < ApiModelBase
15
- attr_accessor :budgets
15
+ attr_accessor :plans
16
16
 
17
- attr_accessor :default_budget
17
+ attr_accessor :default_plan
18
18
 
19
19
  # Attribute mapping from ruby-style variable name to JSON key.
20
20
  def self.attribute_map
21
21
  {
22
- :'budgets' => :'budgets',
23
- :'default_budget' => :'default_budget'
22
+ :'plans' => :'plans',
23
+ :'default_plan' => :'default_plan'
24
24
  }
25
25
  end
26
26
 
@@ -32,8 +32,8 @@ module YNAB
32
32
  # Attribute type mapping.
33
33
  def self.openapi_types
34
34
  {
35
- :'budgets' => :'Array<PlanSummary>',
36
- :'default_budget' => :'PlanSummary'
35
+ :'plans' => :'Array<PlanSummary>',
36
+ :'default_plan' => :'PlanSummary'
37
37
  }
38
38
  end
39
39
 
@@ -58,14 +58,14 @@ module YNAB
58
58
  h[k.to_sym] = v
59
59
  }
60
60
 
61
- if attributes.key?(:'budgets')
62
- if (value = attributes[:'budgets']).is_a?(Array)
63
- self.budgets = value
61
+ if attributes.key?(:'plans')
62
+ if (value = attributes[:'plans']).is_a?(Array)
63
+ self.plans = value
64
64
  end
65
65
  end
66
66
 
67
- if attributes.key?(:'default_budget')
68
- self.default_budget = attributes[:'default_budget']
67
+ if attributes.key?(:'default_plan')
68
+ self.default_plan = attributes[:'default_plan']
69
69
  end
70
70
  end
71
71
 
@@ -79,7 +79,7 @@ module YNAB
79
79
  # Check to see if the all the properties in the model are valid
80
80
  # @return true if the model is valid
81
81
  def valid?
82
- return false if @budgets.nil?
82
+ return false if @plans.nil?
83
83
  true
84
84
  end
85
85
 
@@ -88,8 +88,8 @@ module YNAB
88
88
  def ==(o)
89
89
  return true if self.equal?(o)
90
90
  self.class == o.class &&
91
- budgets == o.budgets &&
92
- default_budget == o.default_budget
91
+ plans == o.plans &&
92
+ default_plan == o.default_plan
93
93
  end
94
94
 
95
95
  # @see the `==` method
@@ -101,7 +101,7 @@ module YNAB
101
101
  # Calculates hash code according to all attributes.
102
102
  # @return [Integer] Hash code
103
103
  def hash
104
- [budgets, default_budget].hash
104
+ [plans, default_plan].hash
105
105
  end
106
106
 
107
107
  # Builds the object from hash
@@ -0,0 +1,148 @@
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 PostPayee < ApiModelBase
15
+ # The name of the payee.
16
+ attr_accessor :name
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'name' => :'name'
22
+ }
23
+ end
24
+
25
+ # Returns all the JSON keys this model knows about
26
+ def self.acceptable_attributes
27
+ attribute_map.values
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'name' => :'String'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PostPayee` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::PostPayee`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'name')
59
+ self.name = attributes[:'name']
60
+ end
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return false if @name.nil?
74
+ return false if @name.to_s.length > 500
75
+ true
76
+ end
77
+
78
+ # Custom attribute writer method with validation
79
+ # @param [Object] name Value to be assigned
80
+ def name=(name)
81
+ if name.nil?
82
+ fail ArgumentError, 'name cannot be nil'
83
+ end
84
+
85
+ @name = name
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ name == o.name
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [name].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ attributes = attributes.transform_keys(&:to_sym)
114
+ transformed_hash = {}
115
+ openapi_types.each_pair do |key, type|
116
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = nil
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[attribute_map[key]].is_a?(Array)
122
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
123
+ end
124
+ elsif !attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
126
+ end
127
+ end
128
+ new(transformed_hash)
129
+ end
130
+
131
+ # Returns the object in the form of hash
132
+ # @return [Hash] Returns the object in the form of hash
133
+ def to_hash
134
+ hash = {}
135
+ self.class.attribute_map.each_pair do |attr, param|
136
+ value = self.send(attr)
137
+ if value.nil?
138
+ is_nullable = self.class.openapi_nullable.include?(attr)
139
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
140
+ end
141
+
142
+ hash[param] = _to_hash(value)
143
+ end
144
+ hash
145
+ end
146
+ end
147
+
148
+ end
@@ -0,0 +1,136 @@
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 PostPayeeWrapper < ApiModelBase
15
+ attr_accessor :payee
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'payee' => :'payee'
21
+ }
22
+ end
23
+
24
+ # Returns all the JSON keys this model knows about
25
+ def self.acceptable_attributes
26
+ attribute_map.values
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'payee' => :'PostPayee'
33
+ }
34
+ end
35
+
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new([
39
+ ])
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ if (!attributes.is_a?(Hash))
46
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PostPayeeWrapper` initialize method"
47
+ end
48
+
49
+ # check to see if the attribute exists and convert string to symbol for hash key
50
+ 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::PostPayeeWrapper`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ end
54
+ h[k.to_sym] = v
55
+ }
56
+
57
+ if attributes.key?(:'payee')
58
+ self.payee = attributes[:'payee']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ return false if @payee.nil?
73
+ true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ payee == o.payee
82
+ end
83
+
84
+ # @see the `==` method
85
+ # @param [Object] Object to be compared
86
+ def eql?(o)
87
+ self == o
88
+ end
89
+
90
+ # Calculates hash code according to all attributes.
91
+ # @return [Integer] Hash code
92
+ def hash
93
+ [payee].hash
94
+ end
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def self.build_from_hash(attributes)
100
+ return nil unless attributes.is_a?(Hash)
101
+ attributes = attributes.transform_keys(&:to_sym)
102
+ transformed_hash = {}
103
+ openapi_types.each_pair do |key, type|
104
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
105
+ transformed_hash["#{key}"] = nil
106
+ elsif type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the attribute
108
+ # 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) }
111
+ end
112
+ elsif !attributes[attribute_map[key]].nil?
113
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
114
+ end
115
+ end
116
+ new(transformed_hash)
117
+ end
118
+
119
+ # Returns the object in the form of hash
120
+ # @return [Hash] Returns the object in the form of hash
121
+ def to_hash
122
+ hash = {}
123
+ self.class.attribute_map.each_pair do |attr, param|
124
+ value = self.send(attr)
125
+ if value.nil?
126
+ is_nullable = self.class.openapi_nullable.include?(attr)
127
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
128
+ end
129
+
130
+ hash[param] = _to_hash(value)
131
+ end
132
+ hash
133
+ end
134
+ end
135
+
136
+ end
@@ -60,7 +60,7 @@ module YNAB
60
60
  def self.openapi_types
61
61
  {
62
62
  :'name' => :'String',
63
- :'type' => :'AccountType',
63
+ :'type' => :'SaveAccountType',
64
64
  :'balance' => :'Integer'
65
65
  }
66
66
  end
@@ -0,0 +1,45 @@
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 SaveAccountType
15
+ CHECKING = "checking".freeze
16
+ SAVINGS = "savings".freeze
17
+ CASH = "cash".freeze
18
+ CREDIT_CARD = "creditCard".freeze
19
+ OTHER_ASSET = "otherAsset".freeze
20
+ OTHER_LIABILITY = "otherLiability".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [CHECKING, SAVINGS, CASH, CREDIT_CARD, OTHER_ASSET, OTHER_LIABILITY].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ if SaveAccountType.all_vars.include?(value)
38
+ return value
39
+ else
40
+ return nil
41
+ end
42
+ end
43
+ end
44
+
45
+ end
@@ -18,12 +18,15 @@ module YNAB
18
18
 
19
19
  attr_accessor :category_group_id
20
20
 
21
- # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount.
21
+ # 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
22
  attr_accessor :goal_target
23
23
 
24
24
  # The goal target date in ISO format (e.g. 2016-12-01).
25
25
  attr_accessor :goal_target_date
26
26
 
27
+ # 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
+ attr_accessor :goal_needs_whole_amount
29
+
27
30
  # Attribute mapping from ruby-style variable name to JSON key.
28
31
  def self.attribute_map
29
32
  {
@@ -31,7 +34,8 @@ module YNAB
31
34
  :'note' => :'note',
32
35
  :'category_group_id' => :'category_group_id',
33
36
  :'goal_target' => :'goal_target',
34
- :'goal_target_date' => :'goal_target_date'
37
+ :'goal_target_date' => :'goal_target_date',
38
+ :'goal_needs_whole_amount' => :'goal_needs_whole_amount'
35
39
  }
36
40
  end
37
41
 
@@ -47,7 +51,8 @@ module YNAB
47
51
  :'note' => :'String',
48
52
  :'category_group_id' => :'String',
49
53
  :'goal_target' => :'Integer',
50
- :'goal_target_date' => :'Date'
54
+ :'goal_target_date' => :'Date',
55
+ :'goal_needs_whole_amount' => :'Boolean'
51
56
  }
52
57
  end
53
58
 
@@ -57,7 +62,8 @@ module YNAB
57
62
  :'name',
58
63
  :'note',
59
64
  :'goal_target',
60
- :'goal_target_date'
65
+ :'goal_target_date',
66
+ :'goal_needs_whole_amount'
61
67
  ])
62
68
  end
63
69
 
@@ -95,6 +101,10 @@ module YNAB
95
101
  if attributes.key?(:'goal_target_date')
96
102
  self.goal_target_date = attributes[:'goal_target_date']
97
103
  end
104
+
105
+ if attributes.key?(:'goal_needs_whole_amount')
106
+ self.goal_needs_whole_amount = attributes[:'goal_needs_whole_amount']
107
+ end
98
108
  end
99
109
 
100
110
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -119,7 +129,8 @@ module YNAB
119
129
  note == o.note &&
120
130
  category_group_id == o.category_group_id &&
121
131
  goal_target == o.goal_target &&
122
- goal_target_date == o.goal_target_date
132
+ goal_target_date == o.goal_target_date &&
133
+ goal_needs_whole_amount == o.goal_needs_whole_amount
123
134
  end
124
135
 
125
136
  # @see the `==` method
@@ -131,7 +142,7 @@ module YNAB
131
142
  # Calculates hash code according to all attributes.
132
143
  # @return [Integer] Hash code
133
144
  def hash
134
- [name, note, category_group_id, goal_target, goal_target_date].hash
145
+ [name, note, category_group_id, goal_target, goal_target_date, goal_needs_whole_amount].hash
135
146
  end
136
147
 
137
148
  # Builds the object from hash
@@ -12,7 +12,7 @@ require 'time'
12
12
 
13
13
  module YNAB
14
14
  class SavePayee < ApiModelBase
15
- # The name of the payee. The name must be a maximum of 500 characters.
15
+ # The name of the payee.
16
16
  attr_accessor :name
17
17
 
18
18
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -35,6 +35,12 @@ module YNAB
35
35
  # Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests.
36
36
  attr_accessor :deleted
37
37
 
38
+ # The scheduled subtransaction amount formatted in the plan's currency format
39
+ attr_accessor :amount_formatted
40
+
41
+ # The scheduled subtransaction amount as a decimal currency amount
42
+ attr_accessor :amount_currency
43
+
38
44
  # Attribute mapping from ruby-style variable name to JSON key.
39
45
  def self.attribute_map
40
46
  {
@@ -47,7 +53,9 @@ module YNAB
47
53
  :'category_id' => :'category_id',
48
54
  :'category_name' => :'category_name',
49
55
  :'transfer_account_id' => :'transfer_account_id',
50
- :'deleted' => :'deleted'
56
+ :'deleted' => :'deleted',
57
+ :'amount_formatted' => :'amount_formatted',
58
+ :'amount_currency' => :'amount_currency'
51
59
  }
52
60
  end
53
61
 
@@ -68,22 +76,25 @@ module YNAB
68
76
  :'category_id' => :'String',
69
77
  :'category_name' => :'String',
70
78
  :'transfer_account_id' => :'String',
71
- :'deleted' => :'Boolean'
79
+ :'deleted' => :'Boolean',
80
+ :'amount_formatted' => :'String',
81
+ :'amount_currency' => :'Float'
72
82
  }
73
83
  end
74
84
 
75
85
  # List of attributes with nullable: true
76
86
  def self.openapi_nullable
77
87
  Set.new([
78
- :'memo',
79
- :'payee_id',
80
- :'payee_name',
81
- :'category_id',
82
- :'category_name',
83
- :'transfer_account_id',
84
88
  ])
85
89
  end
86
90
 
91
+ # List of class defined in allOf (OpenAPI v3)
92
+ def self.openapi_all_of
93
+ [
94
+ :'ScheduledSubTransactionBase'
95
+ ]
96
+ end
97
+
87
98
  # Initializes the object
88
99
  # @param [Hash] attributes Model attributes in the form of hash
89
100
  def initialize(attributes = {})
@@ -138,6 +149,14 @@ module YNAB
138
149
  if attributes.key?(:'deleted')
139
150
  self.deleted = attributes[:'deleted']
140
151
  end
152
+
153
+ if attributes.key?(:'amount_formatted')
154
+ self.amount_formatted = attributes[:'amount_formatted']
155
+ end
156
+
157
+ if attributes.key?(:'amount_currency')
158
+ self.amount_currency = attributes[:'amount_currency']
159
+ end
141
160
  end
142
161
 
143
162
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -171,7 +190,9 @@ module YNAB
171
190
  category_id == o.category_id &&
172
191
  category_name == o.category_name &&
173
192
  transfer_account_id == o.transfer_account_id &&
174
- deleted == o.deleted
193
+ deleted == o.deleted &&
194
+ amount_formatted == o.amount_formatted &&
195
+ amount_currency == o.amount_currency
175
196
  end
176
197
 
177
198
  # @see the `==` method
@@ -183,7 +204,7 @@ module YNAB
183
204
  # Calculates hash code according to all attributes.
184
205
  # @return [Integer] Hash code
185
206
  def hash
186
- [id, scheduled_transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, deleted].hash
207
+ [id, scheduled_transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, deleted, amount_formatted, amount_currency].hash
187
208
  end
188
209
 
189
210
  # Builds the object from hash