=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 'addressable/uri' module UltracartClient class SsoApi 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::SsoApi.new(api_client) end # Get single sign on session user # This is the equivalent of logging out of the single sign on session # @param [Hash] opts the optional parameters # @return [User] def get_sso_session_user(opts = {}) data, _status_code, _headers = get_sso_session_user_with_http_info(opts) data end # Get single sign on session user # This is the equivalent of logging out of the single sign on session # @param [Hash] opts the optional parameters # @return [Array<(User, Fixnum, Hash)>] User data, response status code and response headers def get_sso_session_user_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SsoApi.get_sso_session_user ...' end # resource path local_var_path = '/sso/session/user' # 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(: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 => 'User') if @api_client.config.debugging @api_client.config.logger.debug "API called: SsoApi#get_sso_session_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Authorize a single sign on session # Starts the process of authorizing a single sign on session. # @param authorization_request Authorization request # @param [Hash] opts the optional parameters # @return [SingleSignOnAuthorizeResponse] def sso_authorize(authorization_request, opts = {}) data, _status_code, _headers = sso_authorize_with_http_info(authorization_request, opts) data end # Authorize a single sign on session # Starts the process of authorizing a single sign on session. # @param authorization_request Authorization request # @param [Hash] opts the optional parameters # @return [Array<(SingleSignOnAuthorizeResponse, Fixnum, Hash)>] SingleSignOnAuthorizeResponse data, response status code and response headers def sso_authorize_with_http_info(authorization_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SsoApi.sso_authorize ...' end # verify the required parameter 'authorization_request' is set if @api_client.config.client_side_validation && authorization_request.nil? fail ArgumentError, "Missing the required parameter 'authorization_request' when calling SsoApi.sso_authorize" end # resource path local_var_path = '/sso/authorize' # 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(authorization_request) 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 => 'SingleSignOnAuthorizeResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: SsoApi#sso_authorize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Revoke single sign on session # This is the equivalent of logging out of the single sign on session # @param [Hash] opts the optional parameters # @return [nil] def sso_session_revoke(opts = {}) sso_session_revoke_with_http_info(opts) nil end # Revoke single sign on session # This is the equivalent of logging out of the single sign on session # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def sso_session_revoke_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SsoApi.sso_session_revoke ...' end # resource path local_var_path = '/sso/session/revoke' # 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: SsoApi#sso_session_revoke\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Exchange a single sign on code for a simple key token # Called by your application after receiving the code back on the redirect URI to obtain a simple key token to make API calls with # @param token_request Token request # @param [Hash] opts the optional parameters # @return [SingleSignOnTokenResponse] def sso_token(token_request, opts = {}) data, _status_code, _headers = sso_token_with_http_info(token_request, opts) data end # Exchange a single sign on code for a simple key token # Called by your application after receiving the code back on the redirect URI to obtain a simple key token to make API calls with # @param token_request Token request # @param [Hash] opts the optional parameters # @return [Array<(SingleSignOnTokenResponse, Fixnum, Hash)>] SingleSignOnTokenResponse data, response status code and response headers def sso_token_with_http_info(token_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SsoApi.sso_token ...' end # verify the required parameter 'token_request' is set if @api_client.config.client_side_validation && token_request.nil? fail ArgumentError, "Missing the required parameter 'token_request' when calling SsoApi.sso_token" end # resource path local_var_path = '/sso/token' # 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(token_request) 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 => 'SingleSignOnTokenResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: SsoApi#sso_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end