class FireflyIIIClient::RulesApi
Attributes
Public Class Methods
# File lib/firefly_iii_client/api/rules_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Delete an rule. Delete an rule. @param id [Integer] The ID of the rule. @param [Hash] opts the optional parameters @return [nil]
# File lib/firefly_iii_client/api/rules_api.rb, line 27 def delete_rule(id, opts = {}) delete_rule_with_http_info(id, opts) nil end
Delete an rule. Delete an rule. @param id [Integer] The ID of the rule. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/firefly_iii_client/api/rules_api.rb, line 37 def delete_rule_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RulesApi.delete_rule ...' 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 RulesApi.delete_rule" end # resource path local_var_path = '/api/v1/rules/{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 => :"RulesApi.delete_rule", :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: RulesApi#delete_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Fire the rule on your transactions. Fire the rule group on your transactions. Changes will be made by the rules in the group! Limit the result if you want to. @param id [Integer] The ID of the rule. @param [Hash] opts the optional parameters @option opts [Date] :start A date formatted YYYY-MM-DD, to limit the transactions the actions will be applied to. Both the start date and the end date must be present. @option opts [Date] :_end A date formatted YYYY-MM-DD, to limit the transactions the actions will be applied to. Both the start date and the end date must be present. @option opts [String] :accounts Limit the testing of the rule to these asset accounts. Only asset accounts will be accepted. Other types will be silently dropped. @return [nil]
# File lib/firefly_iii_client/api/rules_api.rb, line 91 def fire_rule(id, opts = {}) fire_rule_with_http_info(id, opts) nil end
Fire the rule on your transactions. Fire the rule group on your transactions. Changes will be made by the rules in the group! Limit the result if you want to. @param id [Integer] The ID of the rule. @param [Hash] opts the optional parameters @option opts [Date] :start A date formatted YYYY-MM-DD, to limit the transactions the actions will be applied to. Both the start date and the end date must be present. @option opts [Date] :_end A date formatted YYYY-MM-DD, to limit the transactions the actions will be applied to. Both the start date and the end date must be present. @option opts [String] :accounts Limit the testing of the rule to these asset accounts. Only asset accounts will be accepted. Other types will be silently dropped. @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/firefly_iii_client/api/rules_api.rb, line 104 def fire_rule_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RulesApi.fire_rule ...' 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 RulesApi.fire_rule" end # resource path local_var_path = '/api/v1/rules/{id}/trigger'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? query_params[:'end'] = opts[:'_end'] if !opts[:'_end'].nil? query_params[:'accounts'] = opts[:'accounts'] if !opts[:'accounts'].nil? # 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 => :"RulesApi.fire_rule", :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: RulesApi#fire_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get a single rule. Get a single rule. @param id [Integer] The ID of the object.X @param [Hash] opts the optional parameters @return [RuleSingle]
# File lib/firefly_iii_client/api/rules_api.rb, line 158 def get_rule(id, opts = {}) data, _status_code, _headers = get_rule_with_http_info(id, opts) data end
Get a single rule. Get a single rule. @param id [Integer] The ID of the object.X @param [Hash] opts the optional parameters @return [Array<(RuleSingle
, Integer, Hash)>] RuleSingle
data, response status code and response headers
# File lib/firefly_iii_client/api/rules_api.rb, line 168 def get_rule_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RulesApi.get_rule ...' 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 RulesApi.get_rule" end # resource path local_var_path = '/api/v1/rules/{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] || 'RuleSingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"RulesApi.get_rule", :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: RulesApi#get_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List all rules. List all rules. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [RuleArray]
# File lib/firefly_iii_client/api/rules_api.rb, line 221 def list_rule(opts = {}) data, _status_code, _headers = list_rule_with_http_info(opts) data end
List all rules. List all rules. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [Array<(RuleArray
, Integer, Hash)>] RuleArray
data, response status code and response headers
# File lib/firefly_iii_client/api/rules_api.rb, line 231 def list_rule_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RulesApi.list_rule ...' end # resource path local_var_path = '/api/v1/rules' # 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] || 'RuleArray' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"RulesApi.list_rule", :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: RulesApi#list_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Store a new rule Creates a new rule. The data required can be submitted as a JSON body or as a list of parameters. @param rule [Rule] JSON array or key=value pairs with the necessary rule information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [RuleSingle]
# File lib/firefly_iii_client/api/rules_api.rb, line 281 def store_rule(rule, opts = {}) data, _status_code, _headers = store_rule_with_http_info(rule, opts) data end
Store a new rule Creates a new rule. The data required can be submitted as a JSON body or as a list of parameters. @param rule [Rule] JSON array or key=value pairs with the necessary rule information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(RuleSingle
, Integer, Hash)>] RuleSingle
data, response status code and response headers
# File lib/firefly_iii_client/api/rules_api.rb, line 291 def store_rule_with_http_info(rule, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RulesApi.store_rule ...' end # verify the required parameter 'rule' is set if @api_client.config.client_side_validation && rule.nil? fail ArgumentError, "Missing the required parameter 'rule' when calling RulesApi.store_rule" end # resource path local_var_path = '/api/v1/rules' # 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(rule) # return_type return_type = opts[:debug_return_type] || 'RuleSingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"RulesApi.store_rule", :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: RulesApi#store_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Test which transactions would be hit by the rule. No changes will be made. Test which transactions would be hit by the rule. No changes will be made. Limit the result if you want to. @param id [Integer] The ID of the rule. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50 items. @option opts [Date] :start A date formatted YYYY-MM-DD, to limit the transactions the test will be applied to. Both the start date and the end date must be present. @option opts [Date] :_end A date formatted YYYY-MM-DD, to limit the transactions the test will be applied to. Both the start date and the end date must be present. @option opts [Integer] :search_limit Maximum number of transactions Firefly III will try. Don't set this too high, or it will take Firefly III very long to run the test. I suggest a max of 200. @option opts [Integer] :triggered_limit Maximum number of transactions the rule can actually trigger on, before Firefly III stops. I would suggest setting this to 10 or 15. Don't go above the user's page size, because browsing to page 2 or 3 of a test result would fire the test again, making any navigation efforts very slow. @option opts [String] :accounts Limit the testing of the rule to these asset accounts. Only asset accounts will be accepted. Other types will be silently dropped. @return [TransactionArray]
# File lib/firefly_iii_client/api/rules_api.rb, line 352 def test_rule(id, opts = {}) data, _status_code, _headers = test_rule_with_http_info(id, opts) data end
Test which transactions would be hit by the rule. No changes will be made. Test which transactions would be hit by the rule. No changes will be made. Limit the result if you want to. @param id [Integer] The ID of the rule. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50 items. @option opts [Date] :start A date formatted YYYY-MM-DD, to limit the transactions the test will be applied to. Both the start date and the end date must be present. @option opts [Date] :_end A date formatted YYYY-MM-DD, to limit the transactions the test will be applied to. Both the start date and the end date must be present. @option opts [Integer] :search_limit Maximum number of transactions Firefly III will try. Don't set this too high, or it will take Firefly III very long to run the test. I suggest a max of 200. @option opts [Integer] :triggered_limit Maximum number of transactions the rule can actually trigger on, before Firefly III stops. I would suggest setting this to 10 or 15. Don't go above the user's page size, because browsing to page 2 or 3 of a test result would fire the test again, making any navigation efforts very slow. @option opts [String] :accounts Limit the testing of the rule to these asset accounts. Only asset accounts will be accepted. Other types will be silently dropped. @return [Array<(TransactionArray
, Integer, Hash)>] TransactionArray
data, response status code and response headers
# File lib/firefly_iii_client/api/rules_api.rb, line 368 def test_rule_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RulesApi.test_rule ...' 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 RulesApi.test_rule" end # resource path local_var_path = '/api/v1/rules/{id}/test'.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[:'search_limit'] = opts[:'search_limit'] if !opts[:'search_limit'].nil? query_params[:'triggered_limit'] = opts[:'triggered_limit'] if !opts[:'triggered_limit'].nil? query_params[:'accounts'] = opts[:'accounts'] if !opts[:'accounts'].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 => :"RulesApi.test_rule", :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: RulesApi#test_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update existing rule. Update existing rule. @param id [Integer] The ID of the object.X @param rule [Rule] JSON array with updated rule information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [RuleSingle]
# File lib/firefly_iii_client/api/rules_api.rb, line 428 def update_rule(id, rule, opts = {}) data, _status_code, _headers = update_rule_with_http_info(id, rule, opts) data end
Update existing rule. Update existing rule. @param id [Integer] The ID of the object.X @param rule [Rule] JSON array with updated rule information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(RuleSingle
, Integer, Hash)>] RuleSingle
data, response status code and response headers
# File lib/firefly_iii_client/api/rules_api.rb, line 439 def update_rule_with_http_info(id, rule, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RulesApi.update_rule ...' 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 RulesApi.update_rule" end # verify the required parameter 'rule' is set if @api_client.config.client_side_validation && rule.nil? fail ArgumentError, "Missing the required parameter 'rule' when calling RulesApi.update_rule" end # resource path local_var_path = '/api/v1/rules/{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(rule) # return_type return_type = opts[:debug_return_type] || 'RuleSingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"RulesApi.update_rule", :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: RulesApi#update_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end