class FireflyIIIClient::BudgetsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

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

Delete a budget. Delete a budget. Transactions will not be deleted. @param id [Integer] The ID of the budget. @param [Hash] opts the optional parameters @return [nil]

# File lib/firefly_iii_client/api/budgets_api.rb, line 27
def delete_budget(id, opts = {})
  delete_budget_with_http_info(id, opts)
  nil
end
delete_budget_limit(id, opts = {}) click to toggle source

Delete a budget limit. Delete a budget limit. @param id [Integer] The ID of the requested budget limit. @param [Hash] opts the optional parameters @return [nil]

# File lib/firefly_iii_client/api/budgets_api.rb, line 92
def delete_budget_limit(id, opts = {})
  delete_budget_limit_with_http_info(id, opts)
  nil
end
delete_budget_limit_with_http_info(id, opts = {}) click to toggle source

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

# File lib/firefly_iii_client/api/budgets_api.rb, line 102
def delete_budget_limit_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.delete_budget_limit ...'
  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 BudgetsApi.delete_budget_limit"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling BudgetsApi.delete_budget_limit, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/v1/budgets/limits/{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 => :"BudgetsApi.delete_budget_limit",
    :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: BudgetsApi#delete_budget_limit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_budget_with_http_info(id, opts = {}) click to toggle source

Delete a budget. Delete a budget. Transactions will not be deleted. @param id [Integer] The ID of the budget. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/firefly_iii_client/api/budgets_api.rb, line 37
def delete_budget_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.delete_budget ...'
  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 BudgetsApi.delete_budget"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling BudgetsApi.delete_budget, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/v1/budgets/{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 => :"BudgetsApi.delete_budget",
    :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: BudgetsApi#delete_budget\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_budget(id, opts = {}) click to toggle source

Get a single budget. Get a single budget. If the start date and end date are submitted as well, the "spent" array will be updated accordingly. @param id [Integer] The ID of the requested budget. @param [Hash] opts the optional parameters @option opts [Date] :start_date A date formatted YYYY-MM-DD, to get info on how much the user has spent. @option opts [Date] :end_date A date formatted YYYY-MM-DD, to get info on how much the user has spent. @return [BudgetSingle]

# File lib/firefly_iii_client/api/budgets_api.rb, line 159
def get_budget(id, opts = {})
  data, _status_code, _headers = get_budget_with_http_info(id, opts)
  data
end
get_budget_limit(id, opts = {}) click to toggle source

Get single budget limit. @param id [Integer] The ID of the requested budget limit. @param [Hash] opts the optional parameters @return [BudgetLimitSingle]

# File lib/firefly_iii_client/api/budgets_api.rb, line 225
def get_budget_limit(id, opts = {})
  data, _status_code, _headers = get_budget_limit_with_http_info(id, opts)
  data
end
get_budget_limit_with_http_info(id, opts = {}) click to toggle source

Get single budget limit. @param id [Integer] The ID of the requested budget limit. @param [Hash] opts the optional parameters @return [Array<(BudgetLimitSingle, Integer, Hash)>] BudgetLimitSingle data, response status code and response headers

# File lib/firefly_iii_client/api/budgets_api.rb, line 234
def get_budget_limit_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budget_limit ...'
  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 BudgetsApi.get_budget_limit"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling BudgetsApi.get_budget_limit, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/v1/budgets/limits/{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] || 'BudgetLimitSingle'

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

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

Get a single budget. Get a single budget. If the start date and end date are submitted as well, the "spent&quot; array will be updated accordingly. @param id [Integer] The ID of the requested budget. @param [Hash] opts the optional parameters @option opts [Date] :start_date A date formatted YYYY-MM-DD, to get info on how much the user has spent. @option opts [Date] :end_date A date formatted YYYY-MM-DD, to get info on how much the user has spent. @return [Array<(BudgetSingle, Integer, Hash)>] BudgetSingle data, response status code and response headers

# File lib/firefly_iii_client/api/budgets_api.rb, line 171
def get_budget_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budget ...'
  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 BudgetsApi.get_budget"
  end
  # resource path
  local_var_path = '/api/v1/budgets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].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] || 'BudgetSingle'

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

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

List all budgets. List all the budgets the user has made. If the start date and end date are submitted as well, the "spent" array will be updated accordingly. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @option opts [Date] :start A date formatted YYYY-MM-DD, to get info on how much the user has spent. You must submit both start and end. @option opts [Date] :_end A date formatted YYYY-MM-DD, to get info on how much the user has spent. You must submit both start and end. @return [BudgetArray]

# File lib/firefly_iii_client/api/budgets_api.rb, line 293
def list_budget(opts = {})
  data, _status_code, _headers = list_budget_with_http_info(opts)
  data
end
list_budget_limit_by_budget(id, opts = {}) click to toggle source

Get all limits Get all budget limits for this budget and the money spent, and money left. You can limit the list by submitting a date range as well. The "spent" array for each budget limit is NOT influenced by the start and end date of your query, but by the start and end date of the budget limit itself. @param id [Integer] The ID of the requested budget. @param [Hash] opts the optional parameters @option opts [Date] :start A date formatted YYYY-MM-DD. @option opts [Date] :_end A date formatted YYYY-MM-DD. @return [BudgetLimitArray]

# File lib/firefly_iii_client/api/budgets_api.rb, line 359
def list_budget_limit_by_budget(id, opts = {})
  data, _status_code, _headers = list_budget_limit_by_budget_with_http_info(id, opts)
  data
end
list_budget_limit_by_budget_with_http_info(id, opts = {}) click to toggle source

Get all limits Get all budget limits for this budget and the money spent, and money left. You can limit the list by submitting a date range as well. The "spent&quot; array for each budget limit is NOT influenced by the start and end date of your query, but by the start and end date of the budget limit itself. @param id [Integer] The ID of the requested budget. @param [Hash] opts the optional parameters @option opts [Date] :start A date formatted YYYY-MM-DD. @option opts [Date] :_end A date formatted YYYY-MM-DD. @return [Array<(BudgetLimitArray, Integer, Hash)>] BudgetLimitArray data, response status code and response headers

# File lib/firefly_iii_client/api/budgets_api.rb, line 371
def list_budget_limit_by_budget_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.list_budget_limit_by_budget ...'
  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 BudgetsApi.list_budget_limit_by_budget"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling BudgetsApi.list_budget_limit_by_budget, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/v1/budgets/{id}/limits'.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?

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

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

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

List all budgets. List all the budgets the user has made. If the start date and end date are submitted as well, the "spent&quot; array will be updated accordingly. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @option opts [Date] :start A date formatted YYYY-MM-DD, to get info on how much the user has spent. You must submit both start and end. @option opts [Date] :_end A date formatted YYYY-MM-DD, to get info on how much the user has spent. You must submit both start and end. @return [Array<(BudgetArray, Integer, Hash)>] BudgetArray data, response status code and response headers

# File lib/firefly_iii_client/api/budgets_api.rb, line 305
def list_budget_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.list_budget ...'
  end
  # resource path
  local_var_path = '/api/v1/budgets'

  # 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?

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

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

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

All transactions to a budget. Get all transactions linked to a budget, possibly limited by start and end @param id [Integer] The ID of the budget. @param [Hash] opts the optional parameters @option opts [Integer] :limit Limits the number of results on one page. @option opts [Integer] :page Page number. The default pagination is 50. @option opts [Date] :start A date formatted YYYY-MM-DD. @option opts [Date] :_end A date formatted YYYY-MM-DD. @option opts [TransactionTypeFilter] :type Optional filter on the transaction type(s) returned @return [TransactionArray]

# File lib/firefly_iii_client/api/budgets_api.rb, line 435
def list_transaction_by_budget(id, opts = {})
  data, _status_code, _headers = list_transaction_by_budget_with_http_info(id, opts)
  data
end
list_transaction_by_budget_limit(id, opts = {}) click to toggle source

List all transactions by a budget limit ID. List all the transactions within one budget limit. The start and end date are dictated by the budget limit. @param id [Integer] The ID of the requested budget limit. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @option opts [TransactionTypeFilter] :type Optional filter on the transaction type(s) returned @return [TransactionArray]

# File lib/firefly_iii_client/api/budgets_api.rb, line 510
def list_transaction_by_budget_limit(id, opts = {})
  data, _status_code, _headers = list_transaction_by_budget_limit_with_http_info(id, opts)
  data
end
list_transaction_by_budget_limit_with_http_info(id, opts = {}) click to toggle source

List all transactions by a budget limit ID. List all the transactions within one budget limit. The start and end date are dictated by the budget limit. @param id [Integer] The ID of the requested budget limit. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @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/budgets_api.rb, line 522
def list_transaction_by_budget_limit_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.list_transaction_by_budget_limit ...'
  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 BudgetsApi.list_transaction_by_budget_limit"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling BudgetsApi.list_transaction_by_budget_limit, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/v1/budgets/limits/{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[:'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 => :"BudgetsApi.list_transaction_by_budget_limit",
    :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: BudgetsApi#list_transaction_by_budget_limit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_transaction_by_budget_with_http_info(id, opts = {}) click to toggle source

All transactions to a budget. Get all transactions linked to a budget, possibly limited by start and end @param id [Integer] The ID of the budget. @param [Hash] opts the optional parameters @option opts [Integer] :limit Limits the number of results on one page. @option opts [Integer] :page Page number. The default pagination is 50. @option opts [Date] :start A date formatted YYYY-MM-DD. @option opts [Date] :_end A date formatted YYYY-MM-DD. @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/budgets_api.rb, line 450
def list_transaction_by_budget_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.list_transaction_by_budget ...'
  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 BudgetsApi.list_transaction_by_budget"
  end
  # resource path
  local_var_path = '/api/v1/budgets/{id}/transactions'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  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 => :"BudgetsApi.list_transaction_by_budget",
    :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: BudgetsApi#list_transaction_by_budget\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
store_budget(budget, opts = {}) click to toggle source

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

# File lib/firefly_iii_client/api/budgets_api.rb, line 581
def store_budget(budget, opts = {})
  data, _status_code, _headers = store_budget_with_http_info(budget, opts)
  data
end
store_budget_limit(id, budget_limit, opts = {}) click to toggle source

Store new budget limit. Store a new budget limit. @param id [Integer] The ID of the budget. @param budget_limit [BudgetLimit] JSON array or key&#x3D;value pairs with the necessary budget information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [BudgetLimitSingle]

# File lib/firefly_iii_client/api/budgets_api.rb, line 647
def store_budget_limit(id, budget_limit, opts = {})
  data, _status_code, _headers = store_budget_limit_with_http_info(id, budget_limit, opts)
  data
end
store_budget_limit_with_http_info(id, budget_limit, opts = {}) click to toggle source

Store new budget limit. Store a new budget limit. @param id [Integer] The ID of the budget. @param budget_limit [BudgetLimit] JSON array or key&#x3D;value pairs with the necessary budget information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(BudgetLimitSingle, Integer, Hash)>] BudgetLimitSingle data, response status code and response headers

# File lib/firefly_iii_client/api/budgets_api.rb, line 658
def store_budget_limit_with_http_info(id, budget_limit, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.store_budget_limit ...'
  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 BudgetsApi.store_budget_limit"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling BudgetsApi.store_budget_limit, must be greater than or equal to 1.'
  end

  # verify the required parameter 'budget_limit' is set
  if @api_client.config.client_side_validation && budget_limit.nil?
    fail ArgumentError, "Missing the required parameter 'budget_limit' when calling BudgetsApi.store_budget_limit"
  end
  # resource path
  local_var_path = '/api/v1/budgets/{id}/limits'.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(budget_limit)

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

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

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

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

# File lib/firefly_iii_client/api/budgets_api.rb, line 591
def store_budget_with_http_info(budget, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.store_budget ...'
  end
  # verify the required parameter 'budget' is set
  if @api_client.config.client_side_validation && budget.nil?
    fail ArgumentError, "Missing the required parameter 'budget' when calling BudgetsApi.store_budget"
  end
  # resource path
  local_var_path = '/api/v1/budgets'

  # 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(budget)

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

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

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

Update existing budget. Update existing budget. This endpoint cannot be used to set budget amount limits. @param id [Integer] The ID of the budget. @param budget [Budget] JSON array with updated budget information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [BudgetSingle]

# File lib/firefly_iii_client/api/budgets_api.rb, line 722
def update_budget(id, budget, opts = {})
  data, _status_code, _headers = update_budget_with_http_info(id, budget, opts)
  data
end
update_budget_limit(id, budget_limit, opts = {}) click to toggle source

Update existing budget limit. Update existing budget limit. @param id [Integer] The ID of the requested budget limit. The budget limit MUST be associated to the budget ID. @param budget_limit [BudgetLimit] JSON array with updated budget limit information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [BudgetLimitSingle]

# File lib/firefly_iii_client/api/budgets_api.rb, line 797
def update_budget_limit(id, budget_limit, opts = {})
  data, _status_code, _headers = update_budget_limit_with_http_info(id, budget_limit, opts)
  data
end
update_budget_limit_with_http_info(id, budget_limit, opts = {}) click to toggle source

Update existing budget limit. Update existing budget limit. @param id [Integer] The ID of the requested budget limit. The budget limit MUST be associated to the budget ID. @param budget_limit [BudgetLimit] JSON array with updated budget limit information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(BudgetLimitSingle, Integer, Hash)>] BudgetLimitSingle data, response status code and response headers

# File lib/firefly_iii_client/api/budgets_api.rb, line 808
def update_budget_limit_with_http_info(id, budget_limit, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.update_budget_limit ...'
  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 BudgetsApi.update_budget_limit"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling BudgetsApi.update_budget_limit, must be greater than or equal to 1.'
  end

  # verify the required parameter 'budget_limit' is set
  if @api_client.config.client_side_validation && budget_limit.nil?
    fail ArgumentError, "Missing the required parameter 'budget_limit' when calling BudgetsApi.update_budget_limit"
  end
  # resource path
  local_var_path = '/api/v1/budgets/limits/{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(budget_limit)

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

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

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

Update existing budget. Update existing budget. This endpoint cannot be used to set budget amount limits. @param id [Integer] The ID of the budget. @param budget [Budget] JSON array with updated budget information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(BudgetSingle, Integer, Hash)>] BudgetSingle data, response status code and response headers

# File lib/firefly_iii_client/api/budgets_api.rb, line 733
def update_budget_with_http_info(id, budget, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BudgetsApi.update_budget ...'
  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 BudgetsApi.update_budget"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling BudgetsApi.update_budget, must be greater than or equal to 1.'
  end

  # verify the required parameter 'budget' is set
  if @api_client.config.client_side_validation && budget.nil?
    fail ArgumentError, "Missing the required parameter 'budget' when calling BudgetsApi.update_budget"
  end
  # resource path
  local_var_path = '/api/v1/budgets/{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(budget)

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

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

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