class FireflyIIIClient::AccountsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

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

Permanently delete account. Will permanently delete an account. Any associated transactions and piggy banks are ALSO deleted. Cannot be recovered from. @param id [Integer] The ID of the account. @param [Hash] opts the optional parameters @return [nil]

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

Permanently delete account. Will permanently delete an account. Any associated transactions and piggy banks are ALSO deleted. Cannot be recovered from. @param id [Integer] The ID of the account. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

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

Get single account. Returns a single account by its ID. @param id [Integer] The ID of the account. @param [Hash] opts the optional parameters @option opts [Date] :date A date formatted YYYY-MM-DD. When added to the request, Firefly III will show the account&#39;s balance on that day. @return [AccountSingle]

# File lib/firefly_iii_client/api/accounts_api.rb, line 89
def get_account(id, opts = {})
  data, _status_code, _headers = get_account_with_http_info(id, opts)
  data
end
get_account_with_http_info(id, opts = {}) click to toggle source

Get single account. Returns a single account by its ID. @param id [Integer] The ID of the account. @param [Hash] opts the optional parameters @option opts [Date] :date A date formatted YYYY-MM-DD. When added to the request, Firefly III will show the account&#39;s balance on that day. @return [Array<(AccountSingle, Integer, Hash)>] AccountSingle data, response status code and response headers

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'date'] = opts[:'date'] if !opts[:'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] || 'AccountSingle'

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

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

List all accounts. This endpoint returns a list of all the accounts owned by the authenticated user. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is per 50 items. @option opts [Date] :date A date formatted YYYY-MM-DD. When added to the request, Firefly III will show the account&#39;s balance on that day. @option opts [AccountTypeFilter] :type Optional filter on the account type(s) returned @return [AccountArray]

# File lib/firefly_iii_client/api/accounts_api.rb, line 156
def list_account(opts = {})
  data, _status_code, _headers = list_account_with_http_info(opts)
  data
end
list_account_with_http_info(opts = {}) click to toggle source

List all accounts. This endpoint returns a list of all the accounts owned by the authenticated user. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is per 50 items. @option opts [Date] :date A date formatted YYYY-MM-DD. When added to the request, Firefly III will show the account&#39;s balance on that day. @option opts [AccountTypeFilter] :type Optional filter on the account type(s) returned @return [Array<(AccountArray, Integer, Hash)>] AccountArray data, response status code and response headers

# File lib/firefly_iii_client/api/accounts_api.rb, line 168
def list_account_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountsApi.list_account ...'
  end
  # resource path
  local_var_path = '/api/v1/accounts'

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

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

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

List all piggy banks related to the account. This endpoint returns a list of all the piggy banks connected to the account. @param id [Integer] The ID of the account. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is per 50 items. @return [PiggyBankArray]

# File lib/firefly_iii_client/api/accounts_api.rb, line 221
def list_piggy_bank_by_account(id, opts = {})
  data, _status_code, _headers = list_piggy_bank_by_account_with_http_info(id, opts)
  data
end
list_piggy_bank_by_account_with_http_info(id, opts = {}) click to toggle source

List all piggy banks related to the account. This endpoint returns a list of all the piggy banks connected to the account. @param id [Integer] The ID of the account. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is per 50 items. @return [Array<(PiggyBankArray, Integer, Hash)>] PiggyBankArray data, response status code and response headers

# File lib/firefly_iii_client/api/accounts_api.rb, line 232
def list_piggy_bank_by_account_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountsApi.list_piggy_bank_by_account ...'
  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 AccountsApi.list_piggy_bank_by_account"
  end
  # resource path
  local_var_path = '/api/v1/accounts/{id}/piggy_banks'.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] || 'PiggyBankArray'

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

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

List all transactions related to the account. This endpoint returns a list of all the transactions connected to the account. @param id [Integer] The ID of the account. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is per 50 items. @option opts [Integer] :limit Limits the number of results on one page. @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/accounts_api.rb, line 291
def list_transaction_by_account(id, opts = {})
  data, _status_code, _headers = list_transaction_by_account_with_http_info(id, opts)
  data
end
list_transaction_by_account_with_http_info(id, opts = {}) click to toggle source

List all transactions related to the account. This endpoint returns a list of all the transactions connected to the account. @param id [Integer] The ID of the account. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is per 50 items. @option opts [Integer] :limit Limits the number of results on one page. @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/accounts_api.rb, line 306
def list_transaction_by_account_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountsApi.list_transaction_by_account ...'
  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 AccountsApi.list_transaction_by_account"
  end
  # resource path
  local_var_path = '/api/v1/accounts/{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[:'limit'] = opts[:'limit'] if !opts[:'limit'].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 => :"AccountsApi.list_transaction_by_account",
    :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: AccountsApi#list_transaction_by_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
store_account(account, opts = {}) click to toggle source

Create new account. Creates a new account. The data required can be submitted as a JSON body or as a list of parameters (in key=value pairs, like a webform). @param account [Account] JSON array with the necessary account information or key&#x3D;value pairs. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [AccountSingle]

# File lib/firefly_iii_client/api/accounts_api.rb, line 364
def store_account(account, opts = {})
  data, _status_code, _headers = store_account_with_http_info(account, opts)
  data
end
store_account_with_http_info(account, opts = {}) click to toggle source

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

# File lib/firefly_iii_client/api/accounts_api.rb, line 374
def store_account_with_http_info(account, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountsApi.store_account ...'
  end
  # verify the required parameter 'account' is set
  if @api_client.config.client_side_validation && account.nil?
    fail ArgumentError, "Missing the required parameter 'account' when calling AccountsApi.store_account"
  end
  # resource path
  local_var_path = '/api/v1/accounts'

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

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

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

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

Update existing account. Used to update a single account. All fields that are not submitted will be cleared (set to NULL). The model will tell you which fields are mandatory. @param id [Integer] The ID of the account. @param account [Account] JSON array or formdata with updated account information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [AccountSingle]

# File lib/firefly_iii_client/api/accounts_api.rb, line 430
def update_account(id, account, opts = {})
  data, _status_code, _headers = update_account_with_http_info(id, account, opts)
  data
end
update_account_with_http_info(id, account, opts = {}) click to toggle source

Update existing account. Used to update a single account. All fields that are not submitted will be cleared (set to NULL). The model will tell you which fields are mandatory. @param id [Integer] The ID of the account. @param account [Account] JSON array or formdata with updated account information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(AccountSingle, Integer, Hash)>] AccountSingle data, response status code and response headers

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

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

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

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