class FireflyIIIClient::ConfigurationApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

get_configuration(opts = {}) click to toggle source

Get Firefly III system configuration. Get system configuration @param [Hash] opts the optional parameters @return [SystemConfiguration]

# File lib/firefly_iii_client/api/configuration_api.rb, line 26
def get_configuration(opts = {})
  data, _status_code, _headers = get_configuration_with_http_info(opts)
  data
end
get_configuration_with_http_info(opts = {}) click to toggle source

Get Firefly III system configuration. Get system configuration @param [Hash] opts the optional parameters @return [Array<(SystemConfiguration, Integer, Hash)>] SystemConfiguration data, response status code and response headers

# File lib/firefly_iii_client/api/configuration_api.rb, line 35
def get_configuration_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConfigurationApi.get_configuration ...'
  end
  # resource path
  local_var_path = '/api/v1/configuration'

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

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

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

Update configuration Set a single config value. @param name [String] The configuration value name. @param value [String] Can be a number or a boolean. This depends on the actual configuration value. @param [Hash] opts the optional parameters @return [SystemConfiguration]

# File lib/firefly_iii_client/api/configuration_api.rb, line 85
def set_configuration(name, value, opts = {})
  data, _status_code, _headers = set_configuration_with_http_info(name, value, opts)
  data
end
set_configuration_with_http_info(name, value, opts = {}) click to toggle source

Update configuration Set a single config value. @param name [String] The configuration value name. @param value [String] Can be a number or a boolean. This depends on the actual configuration value. @param [Hash] opts the optional parameters @return [Array<(SystemConfiguration, Integer, Hash)>] SystemConfiguration data, response status code and response headers

# File lib/firefly_iii_client/api/configuration_api.rb, line 96
def set_configuration_with_http_info(name, value, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConfigurationApi.set_configuration ...'
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling ConfigurationApi.set_configuration"
  end
  # verify enum value
  allowable_values = ["is_demo_site", "last_update_check", "single_user_mode"]
  if @api_client.config.client_side_validation && !allowable_values.include?(name)
    fail ArgumentError, "invalid value for \"name\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'value' is set
  if @api_client.config.client_side_validation && value.nil?
    fail ArgumentError, "Missing the required parameter 'value' when calling ConfigurationApi.set_configuration"
  end
  # resource path
  local_var_path = '/api/v1/configuration/{name}'.sub('{' + 'name' + '}', CGI.escape(name.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/x-www-form-urlencoded', 'application/json'])

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['value'] = value

  # http body (model)
  post_body = opts[:debug_body]

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

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

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