class FireflyIIIClient::CategoriesApi
Attributes
Public Class Methods
# File lib/firefly_iii_client/api/categories_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Delete a category. Delete a category. Transactions will not be removed. @param id [Integer] The ID of the category. @param [Hash] opts the optional parameters @return [nil]
# File lib/firefly_iii_client/api/categories_api.rb, line 27 def delete_category(id, opts = {}) delete_category_with_http_info(id, opts) nil end
Delete a category. Delete a category. Transactions will not be removed. @param id [Integer] The ID of the category. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/firefly_iii_client/api/categories_api.rb, line 37 def delete_category_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.delete_category ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling CategoriesApi.delete_category" end # resource path local_var_path = '/api/v1/categories/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"CategoriesApi.delete_category", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CategoriesApi#delete_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get a single category. Get a single category. @param id [Integer] The ID of the category. @param [Hash] opts the optional parameters @return [CategorySingle]
# File lib/firefly_iii_client/api/categories_api.rb, line 88 def get_category(id, opts = {}) data, _status_code, _headers = get_category_with_http_info(id, opts) data end
Get a single category. Get a single category. @param id [Integer] The ID of the category. @param [Hash] opts the optional parameters @return [Array<(CategorySingle
, Integer, Hash)>] CategorySingle
data, response status code and response headers
# File lib/firefly_iii_client/api/categories_api.rb, line 98 def get_category_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.get_category ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling CategoriesApi.get_category" end # resource path local_var_path = '/api/v1/categories/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CategorySingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"CategoriesApi.get_category", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CategoriesApi#get_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List all categories. List all categories. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [CategoryArray]
# File lib/firefly_iii_client/api/categories_api.rb, line 151 def list_category(opts = {}) data, _status_code, _headers = list_category_with_http_info(opts) data end
List all categories. List all categories. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [Array<(CategoryArray
, Integer, Hash)>] CategoryArray
data, response status code and response headers
# File lib/firefly_iii_client/api/categories_api.rb, line 161 def list_category_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.list_category ...' end # resource path local_var_path = '/api/v1/categories' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CategoryArray' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"CategoriesApi.list_category", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CategoriesApi#list_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List all transactions in a category. List all transactions in a category, optionally limited to the date ranges specified. @param id [Integer] The ID of the category. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is per 50. @option opts [Date] :start A date formatted YYYY-MM-DD, to limit the result list. @option opts [Date] :_end A date formatted YYYY-MM-DD, to limit the result list. @option opts [TransactionTypeFilter] :type Optional filter on the transaction type(s) returned @return [TransactionArray]
# File lib/firefly_iii_client/api/categories_api.rb, line 215 def list_transaction_by_category(id, opts = {}) data, _status_code, _headers = list_transaction_by_category_with_http_info(id, opts) data end
List all transactions in a category. List all transactions in a category, optionally limited to the date ranges specified. @param id [Integer] The ID of the category. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is per 50. @option opts [Date] :start A date formatted YYYY-MM-DD, to limit the result list. @option opts [Date] :_end A date formatted YYYY-MM-DD, to limit the result list. @option opts [TransactionTypeFilter] :type Optional filter on the transaction type(s) returned @return [Array<(TransactionArray
, Integer, Hash)>] TransactionArray
data, response status code and response headers
# File lib/firefly_iii_client/api/categories_api.rb, line 229 def list_transaction_by_category_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.list_transaction_by_category ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling CategoriesApi.list_transaction_by_category" end # resource path local_var_path = '/api/v1/categories/{id}/transactions'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? query_params[:'end'] = opts[:'_end'] if !opts[:'_end'].nil? query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TransactionArray' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"CategoriesApi.list_transaction_by_category", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CategoriesApi#list_transaction_by_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Store a new category Creates a new category. The data required can be submitted as a JSON body or as a list of parameters. @param category [Category] JSON array or key=value pairs with the necessary category information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [CategorySingle]
# File lib/firefly_iii_client/api/categories_api.rb, line 286 def store_category(category, opts = {}) data, _status_code, _headers = store_category_with_http_info(category, opts) data end
Store a new category Creates a new category. The data required can be submitted as a JSON body or as a list of parameters. @param category [Category] JSON array or key=value pairs with the necessary category information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(CategorySingle
, Integer, Hash)>] CategorySingle
data, response status code and response headers
# File lib/firefly_iii_client/api/categories_api.rb, line 296 def store_category_with_http_info(category, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.store_category ...' end # verify the required parameter 'category' is set if @api_client.config.client_side_validation && category.nil? fail ArgumentError, "Missing the required parameter 'category' when calling CategoriesApi.store_category" end # resource path local_var_path = '/api/v1/categories' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(category) # return_type return_type = opts[:debug_return_type] || 'CategorySingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"CategoriesApi.store_category", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CategoriesApi#store_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update existing category. Update existing category. @param id [Integer] The ID of the category. @param category [Category] JSON array with updated category information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [CategorySingle]
# File lib/firefly_iii_client/api/categories_api.rb, line 352 def update_category(id, category, opts = {}) data, _status_code, _headers = update_category_with_http_info(id, category, opts) data end
Update existing category. Update existing category. @param id [Integer] The ID of the category. @param category [Category] JSON array with updated category information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(CategorySingle
, Integer, Hash)>] CategorySingle
data, response status code and response headers
# File lib/firefly_iii_client/api/categories_api.rb, line 363 def update_category_with_http_info(id, category, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.update_category ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling CategoriesApi.update_category" end # verify the required parameter 'category' is set if @api_client.config.client_side_validation && category.nil? fail ArgumentError, "Missing the required parameter 'category' when calling CategoriesApi.update_category" end # resource path local_var_path = '/api/v1/categories/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(category) # return_type return_type = opts[:debug_return_type] || 'CategorySingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"CategoriesApi.update_category", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CategoriesApi#update_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end