=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 The version of the OpenAPI document: 2.0.0 Contact: support@ultracart.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.0.1-SNAPSHOT =end require 'cgi' module UltracartClient class UserApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false) api_config = Configuration.new api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key api_config.api_version = '2017-03-01' api_config.verify_ssl = verify_ssl api_client = ApiClient.new(api_config) api_client.config.debugging = debugging UltracartClient::UserApi.new(api_client) end # Delete a group # Delete a group on the UltraCart account. # @param group_oid [Integer] The group_oid to delete. # @param [Hash] opts the optional parameters # @return [nil] def delete_group(group_oid, opts = {}) delete_group_with_http_info(group_oid, opts) nil end # Delete a group # Delete a group on the UltraCart account. # @param group_oid [Integer] The group_oid to delete. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_group_with_http_info(group_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.delete_group ...' end # verify the required parameter 'group_oid' is set if @api_client.config.client_side_validation && group_oid.nil? fail ArgumentError, "Missing the required parameter 'group_oid' when calling UserApi.delete_group" end # resource path local_var_path = '/user/groups/{group_oid}'.sub('{' + 'group_oid' + '}', CGI.escape(group_oid.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.delete_group", :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: UserApi#delete_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a user # Delete a user on the UltraCart account. # @param user_id [Integer] The user_id to delete. # @param [Hash] opts the optional parameters # @return [nil] def delete_user(user_id, opts = {}) delete_user_with_http_info(user_id, opts) nil end # Delete a user # Delete a user on the UltraCart account. # @param user_id [Integer] The user_id to delete. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_user_with_http_info(user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.delete_user ...' end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.delete_user" end # resource path local_var_path = '/user/users/{user_id}'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.delete_user", :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: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a group # Retrieves a single group using the specified group id. # @param group_oid [Integer] The group id to retrieve. # @param [Hash] opts the optional parameters # @return [nil] def get_group(group_oid, opts = {}) get_group_with_http_info(group_oid, opts) nil end # Retrieve a group # Retrieves a single group using the specified group id. # @param group_oid [Integer] The group id to retrieve. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def get_group_with_http_info(group_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.get_group ...' end # verify the required parameter 'group_oid' is set if @api_client.config.client_side_validation && group_oid.nil? fail ArgumentError, "Missing the required parameter 'group_oid' when calling UserApi.get_group" end # resource path local_var_path = '/user/groups/{group_oid}'.sub('{' + 'group_oid' + '}', CGI.escape(group_oid.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.get_group", :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: UserApi#get_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get groups # @param [Hash] opts the optional parameters # @return [GroupsResponse] def get_groups(opts = {}) data, _status_code, _headers = get_groups_with_http_info(opts) data end # Get groups # @param [Hash] opts the optional parameters # @return [Array<(GroupsResponse, Integer, Hash)>] GroupsResponse data, response status code and response headers def get_groups_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.get_groups ...' end # resource path local_var_path = '/user/groups' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] || 'GroupsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.get_groups", :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: UserApi#get_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a user # Retrieves a single user using the specified user id. # @param user_id [Integer] The user id to retrieve. # @param [Hash] opts the optional parameters # @return [UserResponse] def get_user(user_id, opts = {}) data, _status_code, _headers = get_user_with_http_info(user_id, opts) data end # Retrieve a user # Retrieves a single user using the specified user id. # @param user_id [Integer] The user id to retrieve. # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers def get_user_with_http_info(user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.get_user ...' end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.get_user" end # resource path local_var_path = '/user/users/{user_id}'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] || 'UserResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.get_user", :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: UserApi#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a user's login history # Retrieves logins for a single user using the specified user id. # @param user_id [Integer] The user id to retrieve. # @param [Hash] opts the optional parameters # @return [UserLoginsResponse] def get_user_logins(user_id, opts = {}) data, _status_code, _headers = get_user_logins_with_http_info(user_id, opts) data end # Retrieve a user's login history # Retrieves logins for a single user using the specified user id. # @param user_id [Integer] The user id to retrieve. # @param [Hash] opts the optional parameters # @return [Array<(UserLoginsResponse, Integer, Hash)>] UserLoginsResponse data, response status code and response headers def get_user_logins_with_http_info(user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.get_user_logins ...' end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.get_user_logins" end # resource path local_var_path = '/user/users/{user_id}/logins'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] || 'UserLoginsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.get_user_logins", :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: UserApi#get_user_logins\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get users # @param [Hash] opts the optional parameters # @return [UsersResponse] def get_users(opts = {}) data, _status_code, _headers = get_users_with_http_info(opts) data end # Get users # @param [Hash] opts the optional parameters # @return [Array<(UsersResponse, Integer, Hash)>] UsersResponse data, response status code and response headers def get_users_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.get_users ...' end # resource path local_var_path = '/user/users' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] || 'UsersResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.get_users", :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: UserApi#get_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Insert a group # Insert a group on the UltraCart account. # @param group [Group] Group to insert # @param [Hash] opts the optional parameters # @return [GroupResponse] def insert_group(group, opts = {}) data, _status_code, _headers = insert_group_with_http_info(group, opts) data end # Insert a group # Insert a group on the UltraCart account. # @param group [Group] Group to insert # @param [Hash] opts the optional parameters # @return [Array<(GroupResponse, Integer, Hash)>] GroupResponse data, response status code and response headers def insert_group_with_http_info(group, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.insert_group ...' end # verify the required parameter 'group' is set if @api_client.config.client_side_validation && group.nil? fail ArgumentError, "Missing the required parameter 'group' when calling UserApi.insert_group" end # resource path local_var_path = '/user/groups' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(group) # return_type return_type = opts[:debug_return_type] || 'GroupResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.insert_group", :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: UserApi#insert_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Insert a user # Insert a user on the UltraCart account. # @param user [User] User to insert # @param [Hash] opts the optional parameters # @return [UserResponse] def insert_user(user, opts = {}) data, _status_code, _headers = insert_user_with_http_info(user, opts) data end # Insert a user # Insert a user on the UltraCart account. # @param user [User] User to insert # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers def insert_user_with_http_info(user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.insert_user ...' end # verify the required parameter 'user' is set if @api_client.config.client_side_validation && user.nil? fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.insert_user" end # resource path local_var_path = '/user/users' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(user) # return_type return_type = opts[:debug_return_type] || 'UserResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.insert_user", :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: UserApi#insert_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a group # Update a group on the UltraCart account. # @param group_oid [Integer] The group_oid to update. # @param group [Group] Group to update # @param [Hash] opts the optional parameters # @return [GroupResponse] def update_group(group_oid, group, opts = {}) data, _status_code, _headers = update_group_with_http_info(group_oid, group, opts) data end # Update a group # Update a group on the UltraCart account. # @param group_oid [Integer] The group_oid to update. # @param group [Group] Group to update # @param [Hash] opts the optional parameters # @return [Array<(GroupResponse, Integer, Hash)>] GroupResponse data, response status code and response headers def update_group_with_http_info(group_oid, group, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.update_group ...' end # verify the required parameter 'group_oid' is set if @api_client.config.client_side_validation && group_oid.nil? fail ArgumentError, "Missing the required parameter 'group_oid' when calling UserApi.update_group" end # verify the required parameter 'group' is set if @api_client.config.client_side_validation && group.nil? fail ArgumentError, "Missing the required parameter 'group' when calling UserApi.update_group" end # resource path local_var_path = '/user/groups/{group_oid}'.sub('{' + 'group_oid' + '}', CGI.escape(group_oid.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(group) # return_type return_type = opts[:debug_return_type] || 'GroupResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.update_group", :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: UserApi#update_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a user # Update a user on the UltraCart account. # @param user_id [Integer] The user_id to update. # @param user [User] User to update # @param [Hash] opts the optional parameters # @return [UserResponse] def update_user(user_id, user, opts = {}) data, _status_code, _headers = update_user_with_http_info(user_id, user, opts) data end # Update a user # Update a user on the UltraCart account. # @param user_id [Integer] The user_id to update. # @param user [User] User to update # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers def update_user_with_http_info(user_id, user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.update_user ...' end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.update_user" end # verify the required parameter 'user' is set if @api_client.config.client_side_validation && user.nil? fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.update_user" end # resource path local_var_path = '/user/users/{user_id}'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(user) # return_type return_type = opts[:debug_return_type] || 'UserResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"UserApi.update_user", :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: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end