class FireflyIIIClient::BillsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

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

Delete a bill. Delete a bill. This will not delete any associated rules. Will not remove associated transactions. WILL remove all associated attachments. @param id [Integer] The ID of the bill. @param [Hash] opts the optional parameters @return [nil]

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

Delete a bill. Delete a bill. This will not delete any associated rules. Will not remove associated transactions. WILL remove all associated attachments. @param id [Integer] The ID of the bill. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

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

Get a single bill. Get a single bill. @param id [Integer] The ID of the bill. @param [Hash] opts the optional parameters @option opts [Date] :start A date formatted YYYY-MM-DD. If it is are added to the request, Firefly III will calculate the appropriate payment and paid dates. @option opts [Date] :_end A date formatted YYYY-MM-DD. If it is added to the request, Firefly III will calculate the appropriate payment and paid dates. @return [BillSingle]

# File lib/firefly_iii_client/api/bills_api.rb, line 90
def get_bill(id, opts = {})
  data, _status_code, _headers = get_bill_with_http_info(id, opts)
  data
end
get_bill_with_http_info(id, opts = {}) click to toggle source

Get a single bill. Get a single bill. @param id [Integer] The ID of the bill. @param [Hash] opts the optional parameters @option opts [Date] :start A date formatted YYYY-MM-DD. If it is are added to the request, Firefly III will calculate the appropriate payment and paid dates. @option opts [Date] :_end A date formatted YYYY-MM-DD. If it is added to the request, Firefly III will calculate the appropriate payment and paid dates. @return [Array<(BillSingle, Integer, Hash)>] BillSingle data, response status code and response headers

# File lib/firefly_iii_client/api/bills_api.rb, line 102
def get_bill_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillsApi.get_bill ...'
  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 BillsApi.get_bill"
  end
  # resource path
  local_var_path = '/api/v1/bills/{id}'.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] || 'BillSingle'

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

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

List all attachments uploaded to the bill. This endpoint will list all attachments linked to the bill. @param id [Integer] The ID of the bill. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [AttachmentArray]

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

List all attachments uploaded to the bill. This endpoint will list all attachments linked to the bill. @param id [Integer] The ID of the bill. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [Array<(AttachmentArray, Integer, Hash)>] AttachmentArray data, response status code and response headers

# File lib/firefly_iii_client/api/bills_api.rb, line 169
def list_attachment_by_bill_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillsApi.list_attachment_by_bill ...'
  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 BillsApi.list_attachment_by_bill"
  end
  # resource path
  local_var_path = '/api/v1/bills/{id}/attachments'.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] || 'AttachmentArray'

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

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

List all bills. This endpoint will list all the user's bills. @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. If it is are added to the request, Firefly III will calculate the appropriate payment and paid dates. @option opts [Date] :_end A date formatted YYYY-MM-DD. If it is added to the request, Firefly III will calculate the appropriate payment and paid dates. @return [BillArray]

# File lib/firefly_iii_client/api/bills_api.rb, line 225
def list_bill(opts = {})
  data, _status_code, _headers = list_bill_with_http_info(opts)
  data
end
list_bill_with_http_info(opts = {}) click to toggle source

List all bills. This endpoint will list all the user&#39;s bills. @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. If it is are added to the request, Firefly III will calculate the appropriate payment and paid dates. @option opts [Date] :_end A date formatted YYYY-MM-DD. If it is added to the request, Firefly III will calculate the appropriate payment and paid dates. @return [Array<(BillArray, Integer, Hash)>] BillArray data, response status code and response headers

# File lib/firefly_iii_client/api/bills_api.rb, line 237
def list_bill_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillsApi.list_bill ...'
  end
  # resource path
  local_var_path = '/api/v1/bills'

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

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

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

List all rules associated with the bill. This endpoint will list all rules that have an action to set the bill to this bill. @param id [Integer] The ID of the bill. @param [Hash] opts the optional parameters @return [RuleArray]

# File lib/firefly_iii_client/api/bills_api.rb, line 289
def list_rule_by_bill(id, opts = {})
  data, _status_code, _headers = list_rule_by_bill_with_http_info(id, opts)
  data
end
list_rule_by_bill_with_http_info(id, opts = {}) click to toggle source

List all rules associated with the bill. This endpoint will list all rules that have an action to set the bill to this bill. @param id [Integer] The ID of the bill. @param [Hash] opts the optional parameters @return [Array<(RuleArray, Integer, Hash)>] RuleArray data, response status code and response headers

# File lib/firefly_iii_client/api/bills_api.rb, line 299
def list_rule_by_bill_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillsApi.list_rule_by_bill ...'
  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 BillsApi.list_rule_by_bill"
  end
  # resource path
  local_var_path = '/api/v1/bills/{id}/rules'.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] || 'RuleArray'

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

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

List all transactions associated with the bill. This endpoint will list all transactions linked to this bill. @param id [Integer] The ID of the bill. @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. @option opts [TransactionTypeFilter] :type Optional filter on the transaction type(s) returned @return [TransactionArray]

# File lib/firefly_iii_client/api/bills_api.rb, line 355
def list_transaction_by_bill(id, opts = {})
  data, _status_code, _headers = list_transaction_by_bill_with_http_info(id, opts)
  data
end
list_transaction_by_bill_with_http_info(id, opts = {}) click to toggle source

List all transactions associated with the bill. This endpoint will list all transactions linked to this bill. @param id [Integer] The ID of the bill. @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. @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/bills_api.rb, line 368
def list_transaction_by_bill_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillsApi.list_transaction_by_bill ...'
  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 BillsApi.list_transaction_by_bill"
  end
  # resource path
  local_var_path = '/api/v1/bills/{id}/transactions'.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[:'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 => :"BillsApi.list_transaction_by_bill",
    :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: BillsApi#list_transaction_by_bill\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
store_bill(bill, opts = {}) click to toggle source

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

# File lib/firefly_iii_client/api/bills_api.rb, line 424
def store_bill(bill, opts = {})
  data, _status_code, _headers = store_bill_with_http_info(bill, opts)
  data
end
store_bill_with_http_info(bill, opts = {}) click to toggle source

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

# File lib/firefly_iii_client/api/bills_api.rb, line 434
def store_bill_with_http_info(bill, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillsApi.store_bill ...'
  end
  # verify the required parameter 'bill' is set
  if @api_client.config.client_side_validation && bill.nil?
    fail ArgumentError, "Missing the required parameter 'bill' when calling BillsApi.store_bill"
  end
  # resource path
  local_var_path = '/api/v1/bills'

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

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

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

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

Update existing bill. Update existing bill. @param id [Integer] The ID of the bill. @param bill [Bill] JSON array or key&#x3D;value pairs with updated bill information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [BillSingle]

# File lib/firefly_iii_client/api/bills_api.rb, line 490
def update_bill(id, bill, opts = {})
  data, _status_code, _headers = update_bill_with_http_info(id, bill, opts)
  data
end
update_bill_with_http_info(id, bill, opts = {}) click to toggle source

Update existing bill. Update existing bill. @param id [Integer] The ID of the bill. @param bill [Bill] JSON array or key&#x3D;value pairs with updated bill information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(BillSingle, Integer, Hash)>] BillSingle data, response status code and response headers

# File lib/firefly_iii_client/api/bills_api.rb, line 501
def update_bill_with_http_info(id, bill, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillsApi.update_bill ...'
  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 BillsApi.update_bill"
  end
  # verify the required parameter 'bill' is set
  if @api_client.config.client_side_validation && bill.nil?
    fail ArgumentError, "Missing the required parameter 'bill' when calling BillsApi.update_bill"
  end
  # resource path
  local_var_path = '/api/v1/bills/{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(bill)

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

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

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