class FireflyIIIClient::PreferencesApi
Attributes
Public Class Methods
# File lib/firefly_iii_client/api/preferences_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Return a single preference. Return a single preference. @param name [String] The name of the preference. @param [Hash] opts the optional parameters @return [PreferenceSingle]
# File lib/firefly_iii_client/api/preferences_api.rb, line 27 def get_preference(name, opts = {}) data, _status_code, _headers = get_preference_with_http_info(name, opts) data end
Return a single preference. Return a single preference. @param name [String] The name of the preference. @param [Hash] opts the optional parameters @return [Array<(PreferenceSingle
, Integer, Hash)>] PreferenceSingle
data, response status code and response headers
# File lib/firefly_iii_client/api/preferences_api.rb, line 37 def get_preference_with_http_info(name, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PreferencesApi.get_preference ...' 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 PreferencesApi.get_preference" end # resource path local_var_path = '/api/v1/preferences/{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']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'PreferenceSingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"PreferencesApi.get_preference", :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: PreferencesApi#get_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List all users preferences. List all preferences of the user. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [PreferenceArray]
# File lib/firefly_iii_client/api/preferences_api.rb, line 90 def list_preference(opts = {}) data, _status_code, _headers = list_preference_with_http_info(opts) data end
List all users preferences. List all preferences of the user. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [Array<(PreferenceArray
, Integer, Hash)>] PreferenceArray
data, response status code and response headers
# File lib/firefly_iii_client/api/preferences_api.rb, line 100 def list_preference_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PreferencesApi.list_preference ...' end # resource path local_var_path = '/api/v1/preferences' # 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] || 'PreferenceArray' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"PreferencesApi.list_preference", :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: PreferencesApi#list_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update preference Update a user's preference. @param name [String] The name of the preference. Will always overwrite. Will be created if it does not exist. @param preference [Preference] JSON array or key=value pairs with the necessary preference information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [PreferenceSingle]
# File lib/firefly_iii_client/api/preferences_api.rb, line 151 def update_preference(name, preference, opts = {}) data, _status_code, _headers = update_preference_with_http_info(name, preference, opts) data end
Update preference Update a user's preference. @param name [String] The name of the preference. Will always overwrite. Will be created if it does not exist. @param preference [Preference] JSON array or key=value pairs with the necessary preference information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(PreferenceSingle
, Integer, Hash)>] PreferenceSingle
data, response status code and response headers
# File lib/firefly_iii_client/api/preferences_api.rb, line 162 def update_preference_with_http_info(name, preference, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PreferencesApi.update_preference ...' 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 PreferencesApi.update_preference" end # verify the required parameter 'preference' is set if @api_client.config.client_side_validation && preference.nil? fail ArgumentError, "Missing the required parameter 'preference' when calling PreferencesApi.update_preference" end # resource path local_var_path = '/api/v1/preferences/{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/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(preference) # return_type return_type = opts[:debug_return_type] || 'PreferenceSingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"PreferencesApi.update_preference", :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: PreferencesApi#update_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end