ynab 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +44 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +57 -0
  6. data/Rakefile +31 -0
  7. data/config.json +10 -0
  8. data/docs/Account.md +16 -0
  9. data/docs/AccountResponse.md +8 -0
  10. data/docs/AccountWrapper.md +8 -0
  11. data/docs/AccountsApi.md +121 -0
  12. data/docs/AccountsResponse.md +8 -0
  13. data/docs/AccountsWrapper.md +8 -0
  14. data/docs/BudgetDetail.md +22 -0
  15. data/docs/BudgetDetailResponse.md +8 -0
  16. data/docs/BudgetDetailWrapper.md +9 -0
  17. data/docs/BudgetSummary.md +12 -0
  18. data/docs/BudgetSummaryResponse.md +8 -0
  19. data/docs/BudgetSummaryWrapper.md +8 -0
  20. data/docs/BudgetsApi.md +116 -0
  21. data/docs/BulkIdWrapper.md +8 -0
  22. data/docs/BulkIds.md +9 -0
  23. data/docs/BulkResponse.md +8 -0
  24. data/docs/BulkTransactionCreateResponse.md +8 -0
  25. data/docs/BulkTransactionIds.md +8 -0
  26. data/docs/BulkTransactions.md +8 -0
  27. data/docs/CategoriesApi.md +121 -0
  28. data/docs/CategoriesResponse.md +8 -0
  29. data/docs/Category.md +15 -0
  30. data/docs/CategoryGroup.md +10 -0
  31. data/docs/CategoryGroupWithCategories.md +11 -0
  32. data/docs/CategoryGroupsWrapper.md +8 -0
  33. data/docs/CategoryResponse.md +8 -0
  34. data/docs/CategoryWrapper.md +8 -0
  35. data/docs/CurrencyFormat.md +8 -0
  36. data/docs/DateFormat.md +8 -0
  37. data/docs/ErrorDetail.md +10 -0
  38. data/docs/ErrorResponse.md +8 -0
  39. data/docs/MonthDetail.md +12 -0
  40. data/docs/MonthDetailResponse.md +8 -0
  41. data/docs/MonthDetailWrapper.md +8 -0
  42. data/docs/MonthSummariesResponse.md +8 -0
  43. data/docs/MonthSummariesWrapper.md +8 -0
  44. data/docs/MonthSummary.md +11 -0
  45. data/docs/MonthsApi.md +121 -0
  46. data/docs/Payee.md +10 -0
  47. data/docs/PayeeLocation.md +11 -0
  48. data/docs/PayeeLocationResponse.md +8 -0
  49. data/docs/PayeeLocationWrapper.md +8 -0
  50. data/docs/PayeeLocationsApi.md +179 -0
  51. data/docs/PayeeLocationsResponse.md +8 -0
  52. data/docs/PayeeLocationsWrapper.md +8 -0
  53. data/docs/PayeeResponse.md +8 -0
  54. data/docs/PayeeWrapper.md +8 -0
  55. data/docs/PayeesApi.md +121 -0
  56. data/docs/PayeesResponse.md +8 -0
  57. data/docs/PayeesWrapper.md +8 -0
  58. data/docs/SaveTransaction.md +18 -0
  59. data/docs/SaveTransactionWrapper.md +8 -0
  60. data/docs/ScheduledSubTransaction.md +14 -0
  61. data/docs/ScheduledTransactionDetail.md +19 -0
  62. data/docs/ScheduledTransactionResponse.md +8 -0
  63. data/docs/ScheduledTransactionSummary.md +18 -0
  64. data/docs/ScheduledTransactionWrapper.md +8 -0
  65. data/docs/ScheduledTransactionsApi.md +121 -0
  66. data/docs/ScheduledTransactionsResponse.md +8 -0
  67. data/docs/ScheduledTransactionsWrapper.md +8 -0
  68. data/docs/SubTransaction.md +14 -0
  69. data/docs/TransactionDetail.md +20 -0
  70. data/docs/TransactionResponse.md +8 -0
  71. data/docs/TransactionSummary.md +19 -0
  72. data/docs/TransactionWrapper.md +8 -0
  73. data/docs/TransactionsApi.md +428 -0
  74. data/docs/TransactionsResponse.md +8 -0
  75. data/docs/TransactionsWrapper.md +8 -0
  76. data/examples/budget-list.rb +25 -0
  77. data/examples/budget-month.rb +36 -0
  78. data/examples/category-balance.rb +27 -0
  79. data/lib/ynab.rb +136 -0
  80. data/lib/ynab/api/accounts_api.rb +135 -0
  81. data/lib/ynab/api/budgets_api.rb +126 -0
  82. data/lib/ynab/api/categories_api.rb +135 -0
  83. data/lib/ynab/api/months_api.rb +135 -0
  84. data/lib/ynab/api/payee_locations_api.rb +194 -0
  85. data/lib/ynab/api/payees_api.rb +135 -0
  86. data/lib/ynab/api/scheduled_transactions_api.rb +135 -0
  87. data/lib/ynab/api/transactions_api.rb +451 -0
  88. data/lib/ynab/api_client.rb +392 -0
  89. data/lib/ynab/api_error.rb +38 -0
  90. data/lib/ynab/configuration.rb +209 -0
  91. data/lib/ynab/models/account.rb +343 -0
  92. data/lib/ynab/models/account_response.rb +193 -0
  93. data/lib/ynab/models/account_wrapper.rb +193 -0
  94. data/lib/ynab/models/accounts_response.rb +193 -0
  95. data/lib/ynab/models/accounts_wrapper.rb +195 -0
  96. data/lib/ynab/models/budget_detail.rb +345 -0
  97. data/lib/ynab/models/budget_detail_response.rb +193 -0
  98. data/lib/ynab/models/budget_detail_wrapper.rb +208 -0
  99. data/lib/ynab/models/budget_summary.rb +235 -0
  100. data/lib/ynab/models/budget_summary_response.rb +193 -0
  101. data/lib/ynab/models/budget_summary_wrapper.rb +195 -0
  102. data/lib/ynab/models/bulk_id_wrapper.rb +193 -0
  103. data/lib/ynab/models/bulk_ids.rb +213 -0
  104. data/lib/ynab/models/bulk_response.rb +193 -0
  105. data/lib/ynab/models/bulk_transaction_create_response.rb +193 -0
  106. data/lib/ynab/models/bulk_transaction_ids.rb +195 -0
  107. data/lib/ynab/models/bulk_transactions.rb +195 -0
  108. data/lib/ynab/models/categories_response.rb +193 -0
  109. data/lib/ynab/models/category.rb +295 -0
  110. data/lib/ynab/models/category_group.rb +222 -0
  111. data/lib/ynab/models/category_group_with_categories.rb +239 -0
  112. data/lib/ynab/models/category_groups_wrapper.rb +195 -0
  113. data/lib/ynab/models/category_response.rb +193 -0
  114. data/lib/ynab/models/category_wrapper.rb +193 -0
  115. data/lib/ynab/models/currency_format.rb +193 -0
  116. data/lib/ynab/models/date_format.rb +193 -0
  117. data/lib/ynab/models/error_detail.rb +221 -0
  118. data/lib/ynab/models/error_response.rb +193 -0
  119. data/lib/ynab/models/month_detail.rb +253 -0
  120. data/lib/ynab/models/month_detail_response.rb +193 -0
  121. data/lib/ynab/models/month_detail_wrapper.rb +193 -0
  122. data/lib/ynab/models/month_summaries_response.rb +193 -0
  123. data/lib/ynab/models/month_summaries_wrapper.rb +195 -0
  124. data/lib/ynab/models/month_summary.rb +236 -0
  125. data/lib/ynab/models/payee.rb +222 -0
  126. data/lib/ynab/models/payee_location.rb +235 -0
  127. data/lib/ynab/models/payee_location_response.rb +193 -0
  128. data/lib/ynab/models/payee_location_wrapper.rb +193 -0
  129. data/lib/ynab/models/payee_locations_response.rb +193 -0
  130. data/lib/ynab/models/payee_locations_wrapper.rb +195 -0
  131. data/lib/ynab/models/payee_response.rb +193 -0
  132. data/lib/ynab/models/payee_wrapper.rb +193 -0
  133. data/lib/ynab/models/payees_response.rb +193 -0
  134. data/lib/ynab/models/payees_wrapper.rb +195 -0
  135. data/lib/ynab/models/save_transaction.rb +346 -0
  136. data/lib/ynab/models/save_transaction_wrapper.rb +193 -0
  137. data/lib/ynab/models/scheduled_sub_transaction.rb +279 -0
  138. data/lib/ynab/models/scheduled_transaction_detail.rb +387 -0
  139. data/lib/ynab/models/scheduled_transaction_response.rb +193 -0
  140. data/lib/ynab/models/scheduled_transaction_summary.rb +370 -0
  141. data/lib/ynab/models/scheduled_transaction_wrapper.rb +193 -0
  142. data/lib/ynab/models/scheduled_transactions_response.rb +193 -0
  143. data/lib/ynab/models/scheduled_transactions_wrapper.rb +195 -0
  144. data/lib/ynab/models/sub_transaction.rb +279 -0
  145. data/lib/ynab/models/transaction_detail.rb +401 -0
  146. data/lib/ynab/models/transaction_response.rb +193 -0
  147. data/lib/ynab/models/transaction_summary.rb +384 -0
  148. data/lib/ynab/models/transaction_wrapper.rb +193 -0
  149. data/lib/ynab/models/transactions_response.rb +193 -0
  150. data/lib/ynab/models/transactions_wrapper.rb +195 -0
  151. data/lib/ynab/version.rb +15 -0
  152. data/pkg/ynab-0.1.0.gem +0 -0
  153. data/spec-v1-swagger.json +2121 -0
  154. data/spec/api/accounts_spec.rb +56 -0
  155. data/spec/api/budgets_spec.rb +55 -0
  156. data/spec/api/categories_spec.rb +57 -0
  157. data/spec/api/months_spec.rb +57 -0
  158. data/spec/api/payee_locations_spec.rb +57 -0
  159. data/spec/api/payees_spec.rb +56 -0
  160. data/spec/api/scheduled_transactions_spec.rb +56 -0
  161. data/spec/api/transactions_spec.rb +122 -0
  162. data/spec/fixtures/.DS_Store +0 -0
  163. data/spec/fixtures/vcr_cassettes/account.yml +46 -0
  164. data/spec/fixtures/vcr_cassettes/accounts.yml +46 -0
  165. data/spec/fixtures/vcr_cassettes/accounts_unauthorized.yml +49 -0
  166. data/spec/fixtures/vcr_cassettes/budget.yml +1413 -0
  167. data/spec/fixtures/vcr_cassettes/budgets.yml +49 -0
  168. data/spec/fixtures/vcr_cassettes/budgets_unauthorized.yml +49 -0
  169. data/spec/fixtures/vcr_cassettes/bulk_transactions.yml +46 -0
  170. data/spec/fixtures/vcr_cassettes/categories.yml +67 -0
  171. data/spec/fixtures/vcr_cassettes/categories_unauthorized.yml +49 -0
  172. data/spec/fixtures/vcr_cassettes/category.yml +46 -0
  173. data/spec/fixtures/vcr_cassettes/create_transaction.yml +46 -0
  174. data/spec/fixtures/vcr_cassettes/month.yml +59 -0
  175. data/spec/fixtures/vcr_cassettes/months.yml +47 -0
  176. data/spec/fixtures/vcr_cassettes/months_unauthorized.yml +49 -0
  177. data/spec/fixtures/vcr_cassettes/payee.yml +47 -0
  178. data/spec/fixtures/vcr_cassettes/payee_location.yml +46 -0
  179. data/spec/fixtures/vcr_cassettes/payee_locations.yml +46 -0
  180. data/spec/fixtures/vcr_cassettes/payee_locations_unauthorized.yml +49 -0
  181. data/spec/fixtures/vcr_cassettes/payees.yml +51 -0
  182. data/spec/fixtures/vcr_cassettes/payees_unauthorized.yml +49 -0
  183. data/spec/fixtures/vcr_cassettes/scheduled_transaction.yml +46 -0
  184. data/spec/fixtures/vcr_cassettes/scheduled_transactions.yml +46 -0
  185. data/spec/fixtures/vcr_cassettes/scheduled_transactions_unauthorized.yml +49 -0
  186. data/spec/fixtures/vcr_cassettes/transaction.yml +46 -0
  187. data/spec/fixtures/vcr_cassettes/transactions.yml +46 -0
  188. data/spec/fixtures/vcr_cassettes/transactions_unauthorized.yml +49 -0
  189. data/spec/fixtures/vcr_cassettes/update_transaction.yml +46 -0
  190. data/spec/spec_helper.rb +18 -0
  191. data/swagger-templates/api_client.mustache +386 -0
  192. data/swagger-templates/gemspec.mustache +37 -0
  193. data/ynab.gemspec +40 -0
  194. metadata +353 -0
@@ -0,0 +1,135 @@
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.youneedabudget.com
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module YnabApi
16
+ class PayeesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ # Single payee
24
+ # Returns single payee
25
+ # @param budget_id The ID of the Budget.
26
+ # @param payee_id The ID of the Payee.
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [PayeeResponse]
29
+ def get_payee_by_id(budget_id, payee_id, opts = {})
30
+ data, _status_code, _headers = get_payee_by_id_with_http_info(budget_id, payee_id, opts)
31
+ return data
32
+ end
33
+
34
+ # Single payee
35
+ # Returns single payee
36
+ # @param budget_id The ID of the Budget.
37
+ # @param payee_id The ID of the Payee.
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Array<(PayeeResponse, Fixnum, Hash)>] PayeeResponse data, response status code and response headers
40
+ def get_payee_by_id_with_http_info(budget_id, payee_id, opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug "Calling API: PayeesApi.get_payee_by_id ..."
43
+ end
44
+ # verify the required parameter 'budget_id' is set
45
+ if @api_client.config.client_side_validation && budget_id.nil?
46
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeesApi.get_payee_by_id"
47
+ end
48
+ # verify the required parameter 'payee_id' is set
49
+ if @api_client.config.client_side_validation && payee_id.nil?
50
+ fail ArgumentError, "Missing the required parameter 'payee_id' when calling PayeesApi.get_payee_by_id"
51
+ end
52
+ # resource path
53
+ local_var_path = "/budgets/{budget_id}/payees/{payee_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'payee_id' + '}', payee_id.to_s)
54
+
55
+ # query parameters
56
+ query_params = {}
57
+
58
+ # header parameters
59
+ header_params = {}
60
+ # HTTP header 'Accept' (if needed)
61
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
62
+
63
+ # form parameters
64
+ form_params = {}
65
+
66
+ # http body (model)
67
+ post_body = nil
68
+ auth_names = ['bearer']
69
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
70
+ :header_params => header_params,
71
+ :query_params => query_params,
72
+ :form_params => form_params,
73
+ :body => post_body,
74
+ :auth_names => auth_names,
75
+ :return_type => 'PayeeResponse')
76
+ if @api_client.config.debugging
77
+ @api_client.config.logger.debug "API called: PayeesApi#get_payee_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
+ end
79
+ return data, status_code, headers
80
+ end
81
+
82
+ # List payees
83
+ # Returns all payees
84
+ # @param budget_id The ID of the Budget.
85
+ # @param [Hash] opts the optional parameters
86
+ # @return [PayeesResponse]
87
+ def get_payees(budget_id, opts = {})
88
+ data, _status_code, _headers = get_payees_with_http_info(budget_id, opts)
89
+ return data
90
+ end
91
+
92
+ # List payees
93
+ # Returns all payees
94
+ # @param budget_id The ID of the Budget.
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [Array<(PayeesResponse, Fixnum, Hash)>] PayeesResponse data, response status code and response headers
97
+ def get_payees_with_http_info(budget_id, opts = {})
98
+ if @api_client.config.debugging
99
+ @api_client.config.logger.debug "Calling API: PayeesApi.get_payees ..."
100
+ end
101
+ # verify the required parameter 'budget_id' is set
102
+ if @api_client.config.client_side_validation && budget_id.nil?
103
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeesApi.get_payees"
104
+ end
105
+ # resource path
106
+ local_var_path = "/budgets/{budget_id}/payees".sub('{' + 'budget_id' + '}', budget_id.to_s)
107
+
108
+ # query parameters
109
+ query_params = {}
110
+
111
+ # header parameters
112
+ header_params = {}
113
+ # HTTP header 'Accept' (if needed)
114
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
115
+
116
+ # form parameters
117
+ form_params = {}
118
+
119
+ # http body (model)
120
+ post_body = nil
121
+ auth_names = ['bearer']
122
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
123
+ :header_params => header_params,
124
+ :query_params => query_params,
125
+ :form_params => form_params,
126
+ :body => post_body,
127
+ :auth_names => auth_names,
128
+ :return_type => 'PayeesResponse')
129
+ if @api_client.config.debugging
130
+ @api_client.config.logger.debug "API called: PayeesApi#get_payees\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
131
+ end
132
+ return data, status_code, headers
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,135 @@
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.youneedabudget.com
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module YnabApi
16
+ class ScheduledTransactionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ # Single scheduled transaction
24
+ # Returns a single scheduled transaction
25
+ # @param budget_id The ID of the Budget.
26
+ # @param scheduled_transaction_id The ID of the Scheduled Transaction.
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [ScheduledTransactionResponse]
29
+ def get_scheduled_transaction_by_id(budget_id, scheduled_transaction_id, opts = {})
30
+ data, _status_code, _headers = get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, opts)
31
+ return data
32
+ end
33
+
34
+ # Single scheduled transaction
35
+ # Returns a single scheduled transaction
36
+ # @param budget_id The ID of the Budget.
37
+ # @param scheduled_transaction_id The ID of the Scheduled Transaction.
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Array<(ScheduledTransactionResponse, Fixnum, Hash)>] ScheduledTransactionResponse data, response status code and response headers
40
+ def get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug "Calling API: ScheduledTransactionsApi.get_scheduled_transaction_by_id ..."
43
+ end
44
+ # verify the required parameter 'budget_id' is set
45
+ if @api_client.config.client_side_validation && budget_id.nil?
46
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.get_scheduled_transaction_by_id"
47
+ end
48
+ # verify the required parameter 'scheduled_transaction_id' is set
49
+ if @api_client.config.client_side_validation && scheduled_transaction_id.nil?
50
+ fail ArgumentError, "Missing the required parameter 'scheduled_transaction_id' when calling ScheduledTransactionsApi.get_scheduled_transaction_by_id"
51
+ end
52
+ # resource path
53
+ local_var_path = "/budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'scheduled_transaction_id' + '}', scheduled_transaction_id.to_s)
54
+
55
+ # query parameters
56
+ query_params = {}
57
+
58
+ # header parameters
59
+ header_params = {}
60
+ # HTTP header 'Accept' (if needed)
61
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
62
+
63
+ # form parameters
64
+ form_params = {}
65
+
66
+ # http body (model)
67
+ post_body = nil
68
+ auth_names = ['bearer']
69
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
70
+ :header_params => header_params,
71
+ :query_params => query_params,
72
+ :form_params => form_params,
73
+ :body => post_body,
74
+ :auth_names => auth_names,
75
+ :return_type => 'ScheduledTransactionResponse')
76
+ if @api_client.config.debugging
77
+ @api_client.config.logger.debug "API called: ScheduledTransactionsApi#get_scheduled_transaction_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
+ end
79
+ return data, status_code, headers
80
+ end
81
+
82
+ # List scheduled transactions
83
+ # Returns all scheduled transactions
84
+ # @param budget_id The ID of the Budget.
85
+ # @param [Hash] opts the optional parameters
86
+ # @return [ScheduledTransactionsResponse]
87
+ def get_scheduled_transactions(budget_id, opts = {})
88
+ data, _status_code, _headers = get_scheduled_transactions_with_http_info(budget_id, opts)
89
+ return data
90
+ end
91
+
92
+ # List scheduled transactions
93
+ # Returns all scheduled transactions
94
+ # @param budget_id The ID of the Budget.
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [Array<(ScheduledTransactionsResponse, Fixnum, Hash)>] ScheduledTransactionsResponse data, response status code and response headers
97
+ def get_scheduled_transactions_with_http_info(budget_id, opts = {})
98
+ if @api_client.config.debugging
99
+ @api_client.config.logger.debug "Calling API: ScheduledTransactionsApi.get_scheduled_transactions ..."
100
+ end
101
+ # verify the required parameter 'budget_id' is set
102
+ if @api_client.config.client_side_validation && budget_id.nil?
103
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.get_scheduled_transactions"
104
+ end
105
+ # resource path
106
+ local_var_path = "/budgets/{budget_id}/scheduled_transactions".sub('{' + 'budget_id' + '}', budget_id.to_s)
107
+
108
+ # query parameters
109
+ query_params = {}
110
+
111
+ # header parameters
112
+ header_params = {}
113
+ # HTTP header 'Accept' (if needed)
114
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
115
+
116
+ # form parameters
117
+ form_params = {}
118
+
119
+ # http body (model)
120
+ post_body = nil
121
+ auth_names = ['bearer']
122
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
123
+ :header_params => header_params,
124
+ :query_params => query_params,
125
+ :form_params => form_params,
126
+ :body => post_body,
127
+ :auth_names => auth_names,
128
+ :return_type => 'ScheduledTransactionsResponse')
129
+ if @api_client.config.debugging
130
+ @api_client.config.logger.debug "API called: ScheduledTransactionsApi#get_scheduled_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
131
+ end
132
+ return data, status_code, headers
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,451 @@
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.youneedabudget.com
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module YnabApi
16
+ class TransactionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ # Bulk create transactions
24
+ # Creates multiple transactions
25
+ # @param budget_id The ID of the Budget.
26
+ # @param transactions The list of Transactions to create.
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [BulkResponse]
29
+ def bulk_create_transactions(budget_id, transactions, opts = {})
30
+ data, _status_code, _headers = bulk_create_transactions_with_http_info(budget_id, transactions, opts)
31
+ return data
32
+ end
33
+
34
+ # Bulk create transactions
35
+ # Creates multiple transactions
36
+ # @param budget_id The ID of the Budget.
37
+ # @param transactions The list of Transactions to create.
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Array<(BulkResponse, Fixnum, Hash)>] BulkResponse data, response status code and response headers
40
+ def bulk_create_transactions_with_http_info(budget_id, transactions, opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug "Calling API: TransactionsApi.bulk_create_transactions ..."
43
+ end
44
+ # verify the required parameter 'budget_id' is set
45
+ if @api_client.config.client_side_validation && budget_id.nil?
46
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.bulk_create_transactions"
47
+ end
48
+ # verify the required parameter 'transactions' is set
49
+ if @api_client.config.client_side_validation && transactions.nil?
50
+ fail ArgumentError, "Missing the required parameter 'transactions' when calling TransactionsApi.bulk_create_transactions"
51
+ end
52
+ # resource path
53
+ local_var_path = "/budgets/{budget_id}/transactions/bulk".sub('{' + 'budget_id' + '}', budget_id.to_s)
54
+
55
+ # query parameters
56
+ query_params = {}
57
+
58
+ # header parameters
59
+ header_params = {}
60
+ # HTTP header 'Accept' (if needed)
61
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
62
+
63
+ # form parameters
64
+ form_params = {}
65
+
66
+ # http body (model)
67
+ post_body = @api_client.object_to_http_body(transactions)
68
+ auth_names = ['bearer']
69
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
70
+ :header_params => header_params,
71
+ :query_params => query_params,
72
+ :form_params => form_params,
73
+ :body => post_body,
74
+ :auth_names => auth_names,
75
+ :return_type => 'BulkResponse')
76
+ if @api_client.config.debugging
77
+ @api_client.config.logger.debug "API called: TransactionsApi#bulk_create_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
+ end
79
+ return data, status_code, headers
80
+ end
81
+
82
+ # Create new transaction
83
+ # Creates a transaction
84
+ # @param budget_id The ID of the Budget.
85
+ # @param transaction The Transaction to create.
86
+ # @param [Hash] opts the optional parameters
87
+ # @return [TransactionResponse]
88
+ def create_transaction(budget_id, transaction, opts = {})
89
+ data, _status_code, _headers = create_transaction_with_http_info(budget_id, transaction, opts)
90
+ return data
91
+ end
92
+
93
+ # Create new transaction
94
+ # Creates a transaction
95
+ # @param budget_id The ID of the Budget.
96
+ # @param transaction The Transaction to create.
97
+ # @param [Hash] opts the optional parameters
98
+ # @return [Array<(TransactionResponse, Fixnum, Hash)>] TransactionResponse data, response status code and response headers
99
+ def create_transaction_with_http_info(budget_id, transaction, opts = {})
100
+ if @api_client.config.debugging
101
+ @api_client.config.logger.debug "Calling API: TransactionsApi.create_transaction ..."
102
+ end
103
+ # verify the required parameter 'budget_id' is set
104
+ if @api_client.config.client_side_validation && budget_id.nil?
105
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.create_transaction"
106
+ end
107
+ # verify the required parameter 'transaction' is set
108
+ if @api_client.config.client_side_validation && transaction.nil?
109
+ fail ArgumentError, "Missing the required parameter 'transaction' when calling TransactionsApi.create_transaction"
110
+ end
111
+ # resource path
112
+ local_var_path = "/budgets/{budget_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s)
113
+
114
+ # query parameters
115
+ query_params = {}
116
+
117
+ # header parameters
118
+ header_params = {}
119
+ # HTTP header 'Accept' (if needed)
120
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
121
+
122
+ # form parameters
123
+ form_params = {}
124
+
125
+ # http body (model)
126
+ post_body = @api_client.object_to_http_body(transaction)
127
+ auth_names = ['bearer']
128
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
129
+ :header_params => header_params,
130
+ :query_params => query_params,
131
+ :form_params => form_params,
132
+ :body => post_body,
133
+ :auth_names => auth_names,
134
+ :return_type => 'TransactionResponse')
135
+ if @api_client.config.debugging
136
+ @api_client.config.logger.debug "API called: TransactionsApi#create_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
137
+ end
138
+ return data, status_code, headers
139
+ end
140
+
141
+ # List transactions
142
+ # Returns budget transactions
143
+ # @param budget_id The ID of the Budget.
144
+ # @param [Hash] opts the optional parameters
145
+ # @option opts [Date] :since_date Only return transactions on or after this date.
146
+ # @option opts [String] :type Only return transactions of a certain type (i.e. &#39;uncategorized&#39;, &#39;unapproved&#39;)
147
+ # @return [TransactionsResponse]
148
+ def get_transactions(budget_id, opts = {})
149
+ data, _status_code, _headers = get_transactions_with_http_info(budget_id, opts)
150
+ return data
151
+ end
152
+
153
+ # List transactions
154
+ # Returns budget transactions
155
+ # @param budget_id The ID of the Budget.
156
+ # @param [Hash] opts the optional parameters
157
+ # @option opts [Date] :since_date Only return transactions on or after this date.
158
+ # @option opts [String] :type Only return transactions of a certain type (i.e. &#39;uncategorized&#39;, &#39;unapproved&#39;)
159
+ # @return [Array<(TransactionsResponse, Fixnum, Hash)>] TransactionsResponse data, response status code and response headers
160
+ def get_transactions_with_http_info(budget_id, opts = {})
161
+ if @api_client.config.debugging
162
+ @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions ..."
163
+ end
164
+ # verify the required parameter 'budget_id' is set
165
+ if @api_client.config.client_side_validation && budget_id.nil?
166
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions"
167
+ end
168
+ if @api_client.config.client_side_validation && opts[:'type'] && !['uncategorized', 'unapproved'].include?(opts[:'type'])
169
+ fail ArgumentError, 'invalid value for "type", must be one of uncategorized, unapproved'
170
+ end
171
+ # resource path
172
+ local_var_path = "/budgets/{budget_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s)
173
+
174
+ # query parameters
175
+ query_params = {}
176
+ query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil?
177
+ query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
178
+
179
+ # header parameters
180
+ header_params = {}
181
+ # HTTP header 'Accept' (if needed)
182
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
183
+
184
+ # form parameters
185
+ form_params = {}
186
+
187
+ # http body (model)
188
+ post_body = nil
189
+ auth_names = ['bearer']
190
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
191
+ :header_params => header_params,
192
+ :query_params => query_params,
193
+ :form_params => form_params,
194
+ :body => post_body,
195
+ :auth_names => auth_names,
196
+ :return_type => 'TransactionsResponse')
197
+ if @api_client.config.debugging
198
+ @api_client.config.logger.debug "API called: TransactionsApi#get_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
199
+ end
200
+ return data, status_code, headers
201
+ end
202
+
203
+ # List account transactions
204
+ # Returns all transactions for a specified account
205
+ # @param budget_id The ID of the Budget.
206
+ # @param account_id The ID of the Account.
207
+ # @param [Hash] opts the optional parameters
208
+ # @option opts [Date] :since_date Only return transactions on or after this date.
209
+ # @return [TransactionsResponse]
210
+ def get_transactions_by_account(budget_id, account_id, opts = {})
211
+ data, _status_code, _headers = get_transactions_by_account_with_http_info(budget_id, account_id, opts)
212
+ return data
213
+ end
214
+
215
+ # List account transactions
216
+ # Returns all transactions for a specified account
217
+ # @param budget_id The ID of the Budget.
218
+ # @param account_id The ID of the Account.
219
+ # @param [Hash] opts the optional parameters
220
+ # @option opts [Date] :since_date Only return transactions on or after this date.
221
+ # @return [Array<(TransactionsResponse, Fixnum, Hash)>] TransactionsResponse data, response status code and response headers
222
+ def get_transactions_by_account_with_http_info(budget_id, account_id, opts = {})
223
+ if @api_client.config.debugging
224
+ @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions_by_account ..."
225
+ end
226
+ # verify the required parameter 'budget_id' is set
227
+ if @api_client.config.client_side_validation && budget_id.nil?
228
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_account"
229
+ end
230
+ # verify the required parameter 'account_id' is set
231
+ if @api_client.config.client_side_validation && account_id.nil?
232
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling TransactionsApi.get_transactions_by_account"
233
+ end
234
+ # resource path
235
+ local_var_path = "/budgets/{budget_id}/accounts/{account_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'account_id' + '}', account_id.to_s)
236
+
237
+ # query parameters
238
+ query_params = {}
239
+ query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil?
240
+
241
+ # header parameters
242
+ header_params = {}
243
+ # HTTP header 'Accept' (if needed)
244
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
245
+
246
+ # form parameters
247
+ form_params = {}
248
+
249
+ # http body (model)
250
+ post_body = nil
251
+ auth_names = ['bearer']
252
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
253
+ :header_params => header_params,
254
+ :query_params => query_params,
255
+ :form_params => form_params,
256
+ :body => post_body,
257
+ :auth_names => auth_names,
258
+ :return_type => 'TransactionsResponse')
259
+ if @api_client.config.debugging
260
+ @api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
261
+ end
262
+ return data, status_code, headers
263
+ end
264
+
265
+ # List category transactions
266
+ # Returns all transactions for a specified category
267
+ # @param budget_id The ID of the Budget.
268
+ # @param category_id The ID of the Category.
269
+ # @param [Hash] opts the optional parameters
270
+ # @option opts [Date] :since_date Only return transactions on or after this date.
271
+ # @return [TransactionsResponse]
272
+ def get_transactions_by_category(budget_id, category_id, opts = {})
273
+ data, _status_code, _headers = get_transactions_by_category_with_http_info(budget_id, category_id, opts)
274
+ return data
275
+ end
276
+
277
+ # List category transactions
278
+ # Returns all transactions for a specified category
279
+ # @param budget_id The ID of the Budget.
280
+ # @param category_id The ID of the Category.
281
+ # @param [Hash] opts the optional parameters
282
+ # @option opts [Date] :since_date Only return transactions on or after this date.
283
+ # @return [Array<(TransactionsResponse, Fixnum, Hash)>] TransactionsResponse data, response status code and response headers
284
+ def get_transactions_by_category_with_http_info(budget_id, category_id, opts = {})
285
+ if @api_client.config.debugging
286
+ @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions_by_category ..."
287
+ end
288
+ # verify the required parameter 'budget_id' is set
289
+ if @api_client.config.client_side_validation && budget_id.nil?
290
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_category"
291
+ end
292
+ # verify the required parameter 'category_id' is set
293
+ if @api_client.config.client_side_validation && category_id.nil?
294
+ fail ArgumentError, "Missing the required parameter 'category_id' when calling TransactionsApi.get_transactions_by_category"
295
+ end
296
+ # resource path
297
+ local_var_path = "/budgets/{budget_id}/categories/{category_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'category_id' + '}', category_id.to_s)
298
+
299
+ # query parameters
300
+ query_params = {}
301
+ query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil?
302
+
303
+ # header parameters
304
+ header_params = {}
305
+ # HTTP header 'Accept' (if needed)
306
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
307
+
308
+ # form parameters
309
+ form_params = {}
310
+
311
+ # http body (model)
312
+ post_body = nil
313
+ auth_names = ['bearer']
314
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
315
+ :header_params => header_params,
316
+ :query_params => query_params,
317
+ :form_params => form_params,
318
+ :body => post_body,
319
+ :auth_names => auth_names,
320
+ :return_type => 'TransactionsResponse')
321
+ if @api_client.config.debugging
322
+ @api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
323
+ end
324
+ return data, status_code, headers
325
+ end
326
+
327
+ # Single transaction
328
+ # Returns a single transaction
329
+ # @param budget_id The ID of the Budget.
330
+ # @param transaction_id The ID of the Transaction.
331
+ # @param [Hash] opts the optional parameters
332
+ # @return [TransactionResponse]
333
+ def get_transactions_by_id(budget_id, transaction_id, opts = {})
334
+ data, _status_code, _headers = get_transactions_by_id_with_http_info(budget_id, transaction_id, opts)
335
+ return data
336
+ end
337
+
338
+ # Single transaction
339
+ # Returns a single transaction
340
+ # @param budget_id The ID of the Budget.
341
+ # @param transaction_id The ID of the Transaction.
342
+ # @param [Hash] opts the optional parameters
343
+ # @return [Array<(TransactionResponse, Fixnum, Hash)>] TransactionResponse data, response status code and response headers
344
+ def get_transactions_by_id_with_http_info(budget_id, transaction_id, opts = {})
345
+ if @api_client.config.debugging
346
+ @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions_by_id ..."
347
+ end
348
+ # verify the required parameter 'budget_id' is set
349
+ if @api_client.config.client_side_validation && budget_id.nil?
350
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_id"
351
+ end
352
+ # verify the required parameter 'transaction_id' is set
353
+ if @api_client.config.client_side_validation && transaction_id.nil?
354
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.get_transactions_by_id"
355
+ end
356
+ # resource path
357
+ local_var_path = "/budgets/{budget_id}/transactions/{transaction_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)
358
+
359
+ # query parameters
360
+ query_params = {}
361
+
362
+ # header parameters
363
+ header_params = {}
364
+ # HTTP header 'Accept' (if needed)
365
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
366
+
367
+ # form parameters
368
+ form_params = {}
369
+
370
+ # http body (model)
371
+ post_body = nil
372
+ auth_names = ['bearer']
373
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
374
+ :header_params => header_params,
375
+ :query_params => query_params,
376
+ :form_params => form_params,
377
+ :body => post_body,
378
+ :auth_names => auth_names,
379
+ :return_type => 'TransactionResponse')
380
+ if @api_client.config.debugging
381
+ @api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
382
+ end
383
+ return data, status_code, headers
384
+ end
385
+
386
+ # Updates an existing transaction
387
+ # Updates a transaction
388
+ # @param budget_id The ID of the Budget.
389
+ # @param transaction_id The ID of the Transaction.
390
+ # @param transaction The Transaction to update.
391
+ # @param [Hash] opts the optional parameters
392
+ # @return [TransactionResponse]
393
+ def update_transaction(budget_id, transaction_id, transaction, opts = {})
394
+ data, _status_code, _headers = update_transaction_with_http_info(budget_id, transaction_id, transaction, opts)
395
+ return data
396
+ end
397
+
398
+ # Updates an existing transaction
399
+ # Updates a transaction
400
+ # @param budget_id The ID of the Budget.
401
+ # @param transaction_id The ID of the Transaction.
402
+ # @param transaction The Transaction to update.
403
+ # @param [Hash] opts the optional parameters
404
+ # @return [Array<(TransactionResponse, Fixnum, Hash)>] TransactionResponse data, response status code and response headers
405
+ def update_transaction_with_http_info(budget_id, transaction_id, transaction, opts = {})
406
+ if @api_client.config.debugging
407
+ @api_client.config.logger.debug "Calling API: TransactionsApi.update_transaction ..."
408
+ end
409
+ # verify the required parameter 'budget_id' is set
410
+ if @api_client.config.client_side_validation && budget_id.nil?
411
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.update_transaction"
412
+ end
413
+ # verify the required parameter 'transaction_id' is set
414
+ if @api_client.config.client_side_validation && transaction_id.nil?
415
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.update_transaction"
416
+ end
417
+ # verify the required parameter 'transaction' is set
418
+ if @api_client.config.client_side_validation && transaction.nil?
419
+ fail ArgumentError, "Missing the required parameter 'transaction' when calling TransactionsApi.update_transaction"
420
+ end
421
+ # resource path
422
+ local_var_path = "/budgets/{budget_id}/transactions/{transaction_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)
423
+
424
+ # query parameters
425
+ query_params = {}
426
+
427
+ # header parameters
428
+ header_params = {}
429
+ # HTTP header 'Accept' (if needed)
430
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
431
+
432
+ # form parameters
433
+ form_params = {}
434
+
435
+ # http body (model)
436
+ post_body = @api_client.object_to_http_body(transaction)
437
+ auth_names = ['bearer']
438
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
439
+ :header_params => header_params,
440
+ :query_params => query_params,
441
+ :form_params => form_params,
442
+ :body => post_body,
443
+ :auth_names => auth_names,
444
+ :return_type => 'TransactionResponse')
445
+ if @api_client.config.debugging
446
+ @api_client.config.logger.debug "API called: TransactionsApi#update_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
447
+ end
448
+ return data, status_code, headers
449
+ end
450
+ end
451
+ end