class FireflyIIIClient::PiggyBanksApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

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

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

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

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

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

Get a single piggy bank. Get a single piggy bank. @param id [Integer] The ID of the piggy bank. @param [Hash] opts the optional parameters @return [PiggyBankSingle]

# File lib/firefly_iii_client/api/piggy_banks_api.rb, line 88
def get_piggy_bank(id, opts = {})
  data, _status_code, _headers = get_piggy_bank_with_http_info(id, opts)
  data
end
get_piggy_bank_with_http_info(id, opts = {}) click to toggle source

Get a single piggy bank. Get a single piggy bank. @param id [Integer] The ID of the piggy bank. @param [Hash] opts the optional parameters @return [Array<(PiggyBankSingle, Integer, Hash)>] PiggyBankSingle data, response status code and response headers

# File lib/firefly_iii_client/api/piggy_banks_api.rb, line 98
def get_piggy_bank_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PiggyBanksApi.get_piggy_bank ...'
  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 PiggyBanksApi.get_piggy_bank"
  end
  # resource path
  local_var_path = '/api/v1/piggy_banks/{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] || 'PiggyBankSingle'

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

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

List all events linked to a piggy bank. List all events linked to a piggy bank (adding and removing money). @param id [Integer] The ID of the piggy bank @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [PiggyBankEventArray]

# File lib/firefly_iii_client/api/piggy_banks_api.rb, line 152
def list_event_by_piggy_bank(id, opts = {})
  data, _status_code, _headers = list_event_by_piggy_bank_with_http_info(id, opts)
  data
end
list_event_by_piggy_bank_with_http_info(id, opts = {}) click to toggle source

List all events linked to a piggy bank. List all events linked to a piggy bank (adding and removing money). @param id [Integer] The ID of the piggy bank @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [Array<(PiggyBankEventArray, Integer, Hash)>] PiggyBankEventArray data, response status code and response headers

# File lib/firefly_iii_client/api/piggy_banks_api.rb, line 163
def list_event_by_piggy_bank_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PiggyBanksApi.list_event_by_piggy_bank ...'
  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 PiggyBanksApi.list_event_by_piggy_bank"
  end
  # resource path
  local_var_path = '/api/v1/piggy_banks/{id}/events'.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] || 'PiggyBankEventArray'

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

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

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

# File lib/firefly_iii_client/api/piggy_banks_api.rb, line 217
def list_piggy_bank(opts = {})
  data, _status_code, _headers = list_piggy_bank_with_http_info(opts)
  data
end
list_piggy_bank_with_http_info(opts = {}) click to toggle source

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

# File lib/firefly_iii_client/api/piggy_banks_api.rb, line 227
def list_piggy_bank_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PiggyBanksApi.list_piggy_bank ...'
  end
  # resource path
  local_var_path = '/api/v1/piggy_banks'

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

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

# File lib/firefly_iii_client/api/piggy_banks_api.rb, line 277
def store_piggy_bank(piggy_bank, opts = {})
  data, _status_code, _headers = store_piggy_bank_with_http_info(piggy_bank, opts)
  data
end
store_piggy_bank_with_http_info(piggy_bank, opts = {}) click to toggle source

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

# File lib/firefly_iii_client/api/piggy_banks_api.rb, line 287
def store_piggy_bank_with_http_info(piggy_bank, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PiggyBanksApi.store_piggy_bank ...'
  end
  # verify the required parameter 'piggy_bank' is set
  if @api_client.config.client_side_validation && piggy_bank.nil?
    fail ArgumentError, "Missing the required parameter 'piggy_bank' when calling PiggyBanksApi.store_piggy_bank"
  end
  # resource path
  local_var_path = '/api/v1/piggy_banks'

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

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

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

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

Update existing piggy bank. Update existing piggy bank. @param id [Integer] The ID of the piggy bank @param piggy_bank [PiggyBank] JSON array with updated piggy bank information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [PiggyBankSingle]

# File lib/firefly_iii_client/api/piggy_banks_api.rb, line 343
def update_piggy_bank(id, piggy_bank, opts = {})
  data, _status_code, _headers = update_piggy_bank_with_http_info(id, piggy_bank, opts)
  data
end
update_piggy_bank_with_http_info(id, piggy_bank, opts = {}) click to toggle source

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

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

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

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

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