class FireflyIIIClient::RuleGroupsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/firefly_iii_client/api/rule_groups_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

delete_rule_group(id, opts = {}) click to toggle source

Delete a rule group. Delete a rule group. @param id [Integer] The ID of the rule group. @param [Hash] opts the optional parameters @return [nil]

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 27
def delete_rule_group(id, opts = {})
  delete_rule_group_with_http_info(id, opts)
  nil
end
delete_rule_group_with_http_info(id, opts = {}) click to toggle source

Delete a rule group. Delete a rule group. @param id [Integer] The ID of the rule group. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 37
def delete_rule_group_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RuleGroupsApi.delete_rule_group ...'
  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 RuleGroupsApi.delete_rule_group"
  end
  # resource path
  local_var_path = '/api/v1/rule_groups/{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 => :"RuleGroupsApi.delete_rule_group",
    :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: RuleGroupsApi#delete_rule_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
fire_rule_group(id, opts = {}) click to toggle source

Fire the rule group on your transactions. Fire the rule group on your transactions. Changes will be made by the rules in the rule group! Limit the result if you want to. @param id [Integer] The ID of the rule group. @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 group to these asset accounts. Only asset accounts will be accepted. Other types will be silently dropped. @return [nil]

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 91
def fire_rule_group(id, opts = {})
  fire_rule_group_with_http_info(id, opts)
  nil
end
fire_rule_group_with_http_info(id, opts = {}) click to toggle source

Fire the rule group on your transactions. Fire the rule group on your transactions. Changes will be made by the rules in the rule group! Limit the result if you want to. @param id [Integer] The ID of the rule group. @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 group 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/rule_groups_api.rb, line 104
def fire_rule_group_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RuleGroupsApi.fire_rule_group ...'
  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 RuleGroupsApi.fire_rule_group"
  end
  # resource path
  local_var_path = '/api/v1/rule_groups/{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 => :"RuleGroupsApi.fire_rule_group",
    :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: RuleGroupsApi#fire_rule_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_rule_group(id, opts = {}) click to toggle source

Get a single rule group. Get a single rule group. This does not include the rules. For that, see below. @param id [Integer] The ID of the rule group. @param [Hash] opts the optional parameters @return [RuleGroupSingle]

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 158
def get_rule_group(id, opts = {})
  data, _status_code, _headers = get_rule_group_with_http_info(id, opts)
  data
end
get_rule_group_with_http_info(id, opts = {}) click to toggle source

Get a single rule group. Get a single rule group. This does not include the rules. For that, see below. @param id [Integer] The ID of the rule group. @param [Hash] opts the optional parameters @return [Array<(RuleGroupSingle, Integer, Hash)>] RuleGroupSingle data, response status code and response headers

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 168
def get_rule_group_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RuleGroupsApi.get_rule_group ...'
  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 RuleGroupsApi.get_rule_group"
  end
  # resource path
  local_var_path = '/api/v1/rule_groups/{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] || 'RuleGroupSingle'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['firefly_iii_auth']

  new_options = opts.merge(
    :operation => :"RuleGroupsApi.get_rule_group",
    :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: RuleGroupsApi#get_rule_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_rule_by_group(id, opts = {}) click to toggle source

List rules in this rule group. List rules in this rule group. @param id [Integer] The ID of the rule group. @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/rule_groups_api.rb, line 222
def list_rule_by_group(id, opts = {})
  data, _status_code, _headers = list_rule_by_group_with_http_info(id, opts)
  data
end
list_rule_by_group_with_http_info(id, opts = {}) click to toggle source

List rules in this rule group. List rules in this rule group. @param id [Integer] The ID of the rule group. @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/rule_groups_api.rb, line 233
def list_rule_by_group_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RuleGroupsApi.list_rule_by_group ...'
  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 RuleGroupsApi.list_rule_by_group"
  end
  # resource path
  local_var_path = '/api/v1/rule_groups/{id}/rules'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # 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 => :"RuleGroupsApi.list_rule_by_group",
    :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: RuleGroupsApi#list_rule_by_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_rule_group(opts = {}) click to toggle source

List all rule groups. List all rule groups. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50 @return [RuleGroupArray]

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 287
def list_rule_group(opts = {})
  data, _status_code, _headers = list_rule_group_with_http_info(opts)
  data
end
list_rule_group_with_http_info(opts = {}) click to toggle source

List all rule groups. List all rule groups. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50 @return [Array<(RuleGroupArray, Integer, Hash)>] RuleGroupArray data, response status code and response headers

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 297
def list_rule_group_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RuleGroupsApi.list_rule_group ...'
  end
  # resource path
  local_var_path = '/api/v1/rule_groups'

  # 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] || 'RuleGroupArray'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['firefly_iii_auth']

  new_options = opts.merge(
    :operation => :"RuleGroupsApi.list_rule_group",
    :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: RuleGroupsApi#list_rule_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
store_rule_group(rule_group, opts = {}) click to toggle source

Store a new rule group. Creates a new rule group. The data required can be submitted as a JSON body or as a list of parameters. @param rule_group [RuleGroup] JSON array or key&#x3D;value pairs with the necessary rule group information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [RuleGroupSingle]

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 347
def store_rule_group(rule_group, opts = {})
  data, _status_code, _headers = store_rule_group_with_http_info(rule_group, opts)
  data
end
store_rule_group_with_http_info(rule_group, opts = {}) click to toggle source

Store a new rule group. Creates a new rule group. The data required can be submitted as a JSON body or as a list of parameters. @param rule_group [RuleGroup] JSON array or key&#x3D;value pairs with the necessary rule group information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(RuleGroupSingle, Integer, Hash)>] RuleGroupSingle data, response status code and response headers

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 357
def store_rule_group_with_http_info(rule_group, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RuleGroupsApi.store_rule_group ...'
  end
  # verify the required parameter 'rule_group' is set
  if @api_client.config.client_side_validation && rule_group.nil?
    fail ArgumentError, "Missing the required parameter 'rule_group' when calling RuleGroupsApi.store_rule_group"
  end
  # resource path
  local_var_path = '/api/v1/rule_groups'

  # 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_group)

  # return_type
  return_type = opts[:debug_return_type] || 'RuleGroupSingle'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['firefly_iii_auth']

  new_options = opts.merge(
    :operation => :"RuleGroupsApi.store_rule_group",
    :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: RuleGroupsApi#store_rule_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
test_rule_group(id, opts = {}) click to toggle source

Test which transactions would be hit by the rule group. No changes will be made. Test which transactions would be hit by the rule group. No changes will be made. Limit the result if you want to. @param id [Integer] The ID of the rule group. @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&#39;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 group can actually trigger on, before Firefly III stops. I would suggest setting this to 10 or 15. Don&#39;t go above the user&#39;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 group to these asset accounts. Only asset accounts will be accepted. Other types will be silently dropped. @return [TransactionArray]

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 418
def test_rule_group(id, opts = {})
  data, _status_code, _headers = test_rule_group_with_http_info(id, opts)
  data
end
test_rule_group_with_http_info(id, opts = {}) click to toggle source

Test which transactions would be hit by the rule group. No changes will be made. Test which transactions would be hit by the rule group. No changes will be made. Limit the result if you want to. @param id [Integer] The ID of the rule group. @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&#39;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 group can actually trigger on, before Firefly III stops. I would suggest setting this to 10 or 15. Don&#39;t go above the user&#39;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 group 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/rule_groups_api.rb, line 434
def test_rule_group_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RuleGroupsApi.test_rule_group ...'
  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 RuleGroupsApi.test_rule_group"
  end
  # resource path
  local_var_path = '/api/v1/rule_groups/{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 => :"RuleGroupsApi.test_rule_group",
    :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: RuleGroupsApi#test_rule_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_rule_group(id, rule_group, opts = {}) click to toggle source

Update existing rule group. Update existing rule group. @param id [Integer] The ID of the rule group. @param rule_group [RuleGroup] JSON array with updated rule group information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [RuleGroupSingle]

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 494
def update_rule_group(id, rule_group, opts = {})
  data, _status_code, _headers = update_rule_group_with_http_info(id, rule_group, opts)
  data
end
update_rule_group_with_http_info(id, rule_group, opts = {}) click to toggle source

Update existing rule group. Update existing rule group. @param id [Integer] The ID of the rule group. @param rule_group [RuleGroup] JSON array with updated rule group information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(RuleGroupSingle, Integer, Hash)>] RuleGroupSingle data, response status code and response headers

# File lib/firefly_iii_client/api/rule_groups_api.rb, line 505
def update_rule_group_with_http_info(id, rule_group, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RuleGroupsApi.update_rule_group ...'
  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 RuleGroupsApi.update_rule_group"
  end
  # verify the required parameter 'rule_group' is set
  if @api_client.config.client_side_validation && rule_group.nil?
    fail ArgumentError, "Missing the required parameter 'rule_group' when calling RuleGroupsApi.update_rule_group"
  end
  # resource path
  local_var_path = '/api/v1/rule_groups/{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_group)

  # return_type
  return_type = opts[:debug_return_type] || 'RuleGroupSingle'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['firefly_iii_auth']

  new_options = opts.merge(
    :operation => :"RuleGroupsApi.update_rule_group",
    :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: RuleGroupsApi#update_rule_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end