=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 OpenAPI spec version: 2.0.0 Contact: support@ultracart.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.15-SNAPSHOT =end require 'uri' module UltracartClient class UserApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete a group # Delete a group on the UltraCart account. # @param group_oid 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 The group_oid to delete. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, 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' + '}', group_oid.to_s) # query parameters query_params = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) 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 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 The user_id to delete. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, 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' + '}', user_id.to_s) # query parameters query_params = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) 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 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 The group id to retrieve. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, 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' + '}', group_oid.to_s) # query parameters query_params = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) 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, Fixnum, 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 = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GroupsResponse') 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 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 The user id to retrieve. # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Fixnum, 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' + '}', user_id.to_s) # query parameters query_params = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UserResponse') 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 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 The user id to retrieve. # @param [Hash] opts the optional parameters # @return [Array<(UserLoginsResponse, Fixnum, 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' + '}', user_id.to_s) # query parameters query_params = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UserLoginsResponse') 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, Fixnum, 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 = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UsersResponse') 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 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 to insert # @param [Hash] opts the optional parameters # @return [Array<(GroupResponse, Fixnum, 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 = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(group) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GroupResponse') 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 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 to insert # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Fixnum, 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 = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(user) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UserResponse') 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 Group to update # @param group_oid The group_oid to update. # @param [Hash] opts the optional parameters # @return [GroupResponse] def update_group(group, group_oid, opts = {}) data, _status_code, _headers = update_group_with_http_info(group, group_oid, opts) data end # Update a group # Update a group on the UltraCart account. # @param group Group to update # @param group_oid The group_oid to update. # @param [Hash] opts the optional parameters # @return [Array<(GroupResponse, Fixnum, Hash)>] GroupResponse data, response status code and response headers def update_group_with_http_info(group, group_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: 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 # 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 # resource path local_var_path = '/user/groups/{group_oid}'.sub('{' + 'group_oid' + '}', group_oid.to_s) # query parameters query_params = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(group) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GroupResponse') 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 User to update # @param user_id The user_id to update. # @param [Hash] opts the optional parameters # @return [UserResponse] def update_user(user, user_id, opts = {}) data, _status_code, _headers = update_user_with_http_info(user, user_id, opts) data end # Update a user # Update a user on the UltraCart account. # @param user User to update # @param user_id The user_id to update. # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Fixnum, Hash)>] UserResponse data, response status code and response headers def update_user_with_http_info(user, user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: 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 # 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 # resource path local_var_path = '/user/users/{user_id}'.sub('{' + 'user_id' + '}', user_id.to_s) # query parameters query_params = {} # header parameters 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(user) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UserResponse') 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