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 CategoriesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ # List categories
24
+ # Returns all categories grouped by category group.
25
+ # @param budget_id The ID of the Budget.
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [CategoriesResponse]
28
+ def get_categories(budget_id, opts = {})
29
+ data, _status_code, _headers = get_categories_with_http_info(budget_id, opts)
30
+ return data
31
+ end
32
+
33
+ # List categories
34
+ # Returns all categories grouped by category group.
35
+ # @param budget_id The ID of the Budget.
36
+ # @param [Hash] opts the optional parameters
37
+ # @return [Array<(CategoriesResponse, Fixnum, Hash)>] CategoriesResponse data, response status code and response headers
38
+ def get_categories_with_http_info(budget_id, opts = {})
39
+ if @api_client.config.debugging
40
+ @api_client.config.logger.debug "Calling API: CategoriesApi.get_categories ..."
41
+ end
42
+ # verify the required parameter 'budget_id' is set
43
+ if @api_client.config.client_side_validation && budget_id.nil?
44
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.get_categories"
45
+ end
46
+ # resource path
47
+ local_var_path = "/budgets/{budget_id}/categories".sub('{' + 'budget_id' + '}', budget_id.to_s)
48
+
49
+ # query parameters
50
+ query_params = {}
51
+
52
+ # header parameters
53
+ header_params = {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
56
+
57
+ # form parameters
58
+ form_params = {}
59
+
60
+ # http body (model)
61
+ post_body = nil
62
+ auth_names = ['bearer']
63
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
64
+ :header_params => header_params,
65
+ :query_params => query_params,
66
+ :form_params => form_params,
67
+ :body => post_body,
68
+ :auth_names => auth_names,
69
+ :return_type => 'CategoriesResponse')
70
+ if @api_client.config.debugging
71
+ @api_client.config.logger.debug "API called: CategoriesApi#get_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
72
+ end
73
+ return data, status_code, headers
74
+ end
75
+
76
+ # Single category
77
+ # Returns a single category
78
+ # @param budget_id The ID of the Budget.
79
+ # @param category_id The ID of the Category.
80
+ # @param [Hash] opts the optional parameters
81
+ # @return [CategoryResponse]
82
+ def get_category_by_id(budget_id, category_id, opts = {})
83
+ data, _status_code, _headers = get_category_by_id_with_http_info(budget_id, category_id, opts)
84
+ return data
85
+ end
86
+
87
+ # Single category
88
+ # Returns a single category
89
+ # @param budget_id The ID of the Budget.
90
+ # @param category_id The ID of the Category.
91
+ # @param [Hash] opts the optional parameters
92
+ # @return [Array<(CategoryResponse, Fixnum, Hash)>] CategoryResponse data, response status code and response headers
93
+ def get_category_by_id_with_http_info(budget_id, category_id, opts = {})
94
+ if @api_client.config.debugging
95
+ @api_client.config.logger.debug "Calling API: CategoriesApi.get_category_by_id ..."
96
+ end
97
+ # verify the required parameter 'budget_id' is set
98
+ if @api_client.config.client_side_validation && budget_id.nil?
99
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.get_category_by_id"
100
+ end
101
+ # verify the required parameter 'category_id' is set
102
+ if @api_client.config.client_side_validation && category_id.nil?
103
+ fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.get_category_by_id"
104
+ end
105
+ # resource path
106
+ local_var_path = "/budgets/{budget_id}/categories/{category_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'category_id' + '}', category_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 => 'CategoryResponse')
129
+ if @api_client.config.debugging
130
+ @api_client.config.logger.debug "API called: CategoriesApi#get_category_by_id\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 MonthsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ # Single budget month
24
+ # Returns a single budget month
25
+ # @param budget_id The ID of the Budget.
26
+ # @param month The Budget Month. \&quot;current\&quot; can also be used to specify the current calendar month (UTC).
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [MonthDetailResponse]
29
+ def get_budget_month(budget_id, month, opts = {})
30
+ data, _status_code, _headers = get_budget_month_with_http_info(budget_id, month, opts)
31
+ return data
32
+ end
33
+
34
+ # Single budget month
35
+ # Returns a single budget month
36
+ # @param budget_id The ID of the Budget.
37
+ # @param month The Budget Month. \&quot;current\&quot; can also be used to specify the current calendar month (UTC).
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Array<(MonthDetailResponse, Fixnum, Hash)>] MonthDetailResponse data, response status code and response headers
40
+ def get_budget_month_with_http_info(budget_id, month, opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug "Calling API: MonthsApi.get_budget_month ..."
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 MonthsApi.get_budget_month"
47
+ end
48
+ # verify the required parameter 'month' is set
49
+ if @api_client.config.client_side_validation && month.nil?
50
+ fail ArgumentError, "Missing the required parameter 'month' when calling MonthsApi.get_budget_month"
51
+ end
52
+ # resource path
53
+ local_var_path = "/budgets/{budget_id}/months/{month}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'month' + '}', month.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 => 'MonthDetailResponse')
76
+ if @api_client.config.debugging
77
+ @api_client.config.logger.debug "API called: MonthsApi#get_budget_month\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
+ end
79
+ return data, status_code, headers
80
+ end
81
+
82
+ # List budget months
83
+ # Returns all budget months
84
+ # @param budget_id The ID of the Budget.
85
+ # @param [Hash] opts the optional parameters
86
+ # @return [MonthSummariesResponse]
87
+ def get_budget_months(budget_id, opts = {})
88
+ data, _status_code, _headers = get_budget_months_with_http_info(budget_id, opts)
89
+ return data
90
+ end
91
+
92
+ # List budget months
93
+ # Returns all budget months
94
+ # @param budget_id The ID of the Budget.
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [Array<(MonthSummariesResponse, Fixnum, Hash)>] MonthSummariesResponse data, response status code and response headers
97
+ def get_budget_months_with_http_info(budget_id, opts = {})
98
+ if @api_client.config.debugging
99
+ @api_client.config.logger.debug "Calling API: MonthsApi.get_budget_months ..."
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 MonthsApi.get_budget_months"
104
+ end
105
+ # resource path
106
+ local_var_path = "/budgets/{budget_id}/months".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 => 'MonthSummariesResponse')
129
+ if @api_client.config.debugging
130
+ @api_client.config.logger.debug "API called: MonthsApi#get_budget_months\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,194 @@
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 PayeeLocationsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ # Single payee location
24
+ # Returns a single payee location
25
+ # @param budget_id The ID of the Budget.
26
+ # @param payee_location_id ID of payee location
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [PayeeLocationResponse]
29
+ def get_payee_location_by_id(budget_id, payee_location_id, opts = {})
30
+ data, _status_code, _headers = get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts)
31
+ return data
32
+ end
33
+
34
+ # Single payee location
35
+ # Returns a single payee location
36
+ # @param budget_id The ID of the Budget.
37
+ # @param payee_location_id ID of payee location
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Array<(PayeeLocationResponse, Fixnum, Hash)>] PayeeLocationResponse data, response status code and response headers
40
+ def get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug "Calling API: PayeeLocationsApi.get_payee_location_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 PayeeLocationsApi.get_payee_location_by_id"
47
+ end
48
+ # verify the required parameter 'payee_location_id' is set
49
+ if @api_client.config.client_side_validation && payee_location_id.nil?
50
+ fail ArgumentError, "Missing the required parameter 'payee_location_id' when calling PayeeLocationsApi.get_payee_location_by_id"
51
+ end
52
+ # resource path
53
+ local_var_path = "/budgets/{budget_id}/payee_locations/{payee_location_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'payee_location_id' + '}', payee_location_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 => 'PayeeLocationResponse')
76
+ if @api_client.config.debugging
77
+ @api_client.config.logger.debug "API called: PayeeLocationsApi#get_payee_location_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
+ end
79
+ return data, status_code, headers
80
+ end
81
+
82
+ # List payee locations
83
+ # Returns all payee locations
84
+ # @param budget_id The ID of the Budget.
85
+ # @param [Hash] opts the optional parameters
86
+ # @return [PayeeLocationsResponse]
87
+ def get_payee_locations(budget_id, opts = {})
88
+ data, _status_code, _headers = get_payee_locations_with_http_info(budget_id, opts)
89
+ return data
90
+ end
91
+
92
+ # List payee locations
93
+ # Returns all payee locations
94
+ # @param budget_id The ID of the Budget.
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [Array<(PayeeLocationsResponse, Fixnum, Hash)>] PayeeLocationsResponse data, response status code and response headers
97
+ def get_payee_locations_with_http_info(budget_id, opts = {})
98
+ if @api_client.config.debugging
99
+ @api_client.config.logger.debug "Calling API: PayeeLocationsApi.get_payee_locations ..."
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 PayeeLocationsApi.get_payee_locations"
104
+ end
105
+ # resource path
106
+ local_var_path = "/budgets/{budget_id}/payee_locations".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 => 'PayeeLocationsResponse')
129
+ if @api_client.config.debugging
130
+ @api_client.config.logger.debug "API called: PayeeLocationsApi#get_payee_locations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
131
+ end
132
+ return data, status_code, headers
133
+ end
134
+
135
+ # List locations for a payee
136
+ # Returns all payee locations for the specified payee
137
+ # @param budget_id The ID of the Budget.
138
+ # @param payee_id ID of payee
139
+ # @param [Hash] opts the optional parameters
140
+ # @return [PayeeLocationsResponse]
141
+ def get_payee_locations_by_payee(budget_id, payee_id, opts = {})
142
+ data, _status_code, _headers = get_payee_locations_by_payee_with_http_info(budget_id, payee_id, opts)
143
+ return data
144
+ end
145
+
146
+ # List locations for a payee
147
+ # Returns all payee locations for the specified payee
148
+ # @param budget_id The ID of the Budget.
149
+ # @param payee_id ID of payee
150
+ # @param [Hash] opts the optional parameters
151
+ # @return [Array<(PayeeLocationsResponse, Fixnum, Hash)>] PayeeLocationsResponse data, response status code and response headers
152
+ def get_payee_locations_by_payee_with_http_info(budget_id, payee_id, opts = {})
153
+ if @api_client.config.debugging
154
+ @api_client.config.logger.debug "Calling API: PayeeLocationsApi.get_payee_locations_by_payee ..."
155
+ end
156
+ # verify the required parameter 'budget_id' is set
157
+ if @api_client.config.client_side_validation && budget_id.nil?
158
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeeLocationsApi.get_payee_locations_by_payee"
159
+ end
160
+ # verify the required parameter 'payee_id' is set
161
+ if @api_client.config.client_side_validation && payee_id.nil?
162
+ fail ArgumentError, "Missing the required parameter 'payee_id' when calling PayeeLocationsApi.get_payee_locations_by_payee"
163
+ end
164
+ # resource path
165
+ local_var_path = "/budgets/{budget_id}/payees/{payee_id}/payee_locations".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'payee_id' + '}', payee_id.to_s)
166
+
167
+ # query parameters
168
+ query_params = {}
169
+
170
+ # header parameters
171
+ header_params = {}
172
+ # HTTP header 'Accept' (if needed)
173
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
174
+
175
+ # form parameters
176
+ form_params = {}
177
+
178
+ # http body (model)
179
+ post_body = nil
180
+ auth_names = ['bearer']
181
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
182
+ :header_params => header_params,
183
+ :query_params => query_params,
184
+ :form_params => form_params,
185
+ :body => post_body,
186
+ :auth_names => auth_names,
187
+ :return_type => 'PayeeLocationsResponse')
188
+ if @api_client.config.debugging
189
+ @api_client.config.logger.debug "API called: PayeeLocationsApi#get_payee_locations_by_payee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
190
+ end
191
+ return data, status_code, headers
192
+ end
193
+ end
194
+ end