=begin #DocuSign REST API #The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. OpenAPI spec version: v2 Contact: devcenter@docusign.com Generated by: https://github.com/swagger-api/swagger-codegen.git =end require "uri" module DocuSign_eSign class LoginOptions # When set to **true**, shows the account API password in the response. attr_accessor :api_password # attr_accessor :embed_account_id_guid # When set to **true**, shows the account ID GUID in the response. attr_accessor :include_account_id_guid # Determines whether login settings are returned in the response. Valid Values: * all - All the login settings are returned. * none - no login settings are returned. attr_accessor :login_settings def self.default @@default ||= LoginOptions.new end end class AuthenticationApi attr_accessor :api_client def initialize(api_client = AuthenticationApi.default) @api_client = api_client end # Deletes user's social account. # Deletes a social account from a use's account. # @param account_id The external account number (int) or account ID Guid. # @param user_id The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. # @param social_account_information (optional parameter) # @return [nil] def delete_social_login(account_id, user_id, social_account_information) delete_social_login_with_http_info(account_id, user_id, social_account_information) return nil end # Deletes user's social account. # Deletes a social account from a use's account. # @param account_id The external account number (int) or account ID Guid. # @param user_id The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. # @param social_account_information (optional parameter) # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_social_login_with_http_info(account_id, user_id, social_account_information) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: AuthenticationApi.delete_social_login ..." end # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling AuthenticationApi.delete_social_login" if account_id.nil? # verify the required parameter 'user_id' is set fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthenticationApi.delete_social_login" if user_id.nil? # resource path local_var_path = "/v2/accounts/{accountId}/users/{userId}/social".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'userId' + '}', user_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(social_account_information) auth_names = [] 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: AuthenticationApi#delete_social_login\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Creates an authorization token. # Creates an OAuth2 authorization server token endpoint. # @return [OauthAccess] def get_o_auth_token() data, _status_code, _headers = get_o_auth_token_with_http_info() return data end # Creates an authorization token. # Creates an OAuth2 authorization server token endpoint. # @return [Array<(OauthAccess, Fixnum, Hash)>] OauthAccess data, response status code and response headers def get_o_auth_token_with_http_info() if @api_client.config.debugging @api_client.config.logger.debug "Calling API: AuthenticationApi.get_o_auth_token ..." end # resource path local_var_path = "/v2/oauth2/token".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] 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 => 'OauthAccess') if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationApi#get_o_auth_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Gets a list of a user's social accounts. # Retrieves a list of social accounts linked to a user's account. # @param account_id The external account number (int) or account ID Guid. # @param user_id The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. # @return [UserSocialIdResult] def list_social_logins(account_id, user_id) data, _status_code, _headers = list_social_logins_with_http_info(account_id, user_id) return data end # Gets a list of a user's social accounts. # Retrieves a list of social accounts linked to a user's account. # @param account_id The external account number (int) or account ID Guid. # @param user_id The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. # @return [Array<(UserSocialIdResult, Fixnum, Hash)>] UserSocialIdResult data, response status code and response headers def list_social_logins_with_http_info(account_id, user_id) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: AuthenticationApi.list_social_logins ..." end # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling AuthenticationApi.list_social_logins" if account_id.nil? # verify the required parameter 'user_id' is set fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthenticationApi.list_social_logins" if user_id.nil? # resource path local_var_path = "/v2/accounts/{accountId}/users/{userId}/social".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'userId' + '}', user_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] 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 => 'UserSocialIdResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationApi#list_social_logins\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Gets login information for a specified user. # Retrieves login information for a specified user. Each account that is associated with the login credentials is listed. You can use the returned information to determine whether a user is authenticated and select an account to use in future operations. The `baseUrl` property, returned in the response, is used in all future API calls as the base of the request URL. The `baseUrl` property contains the DocuSign server, the API version, and the `accountId` property that is used for the login. This request uses your DocuSign credentials to retrieve the account information. # @param DocuSign_eSign::LoginOptions Options for modifying the behavior of the function. # @return [LoginInformation] def login(options = DocuSign_eSign::LoginOptions.default) data, _status_code, _headers = login_with_http_info(options) return data end # Gets login information for a specified user. # Retrieves login information for a specified user. Each account that is associated with the login credentials is listed. You can use the returned information to determine whether a user is authenticated and select an account to use in future operations. The `baseUrl` property, returned in the response, is used in all future API calls as the base of the request URL. The `baseUrl` property contains the DocuSign server, the API version, and the `accountId` property that is used for the login. This request uses your DocuSign credentials to retrieve the account information. # @param DocuSign_eSign::LoginOptions Options for modifying the behavior of the function. # @return [Array<(LoginInformation, Fixnum, Hash)>] LoginInformation data, response status code and response headers def login_with_http_info(options = DocuSign_eSign::LoginOptions.default) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: AuthenticationApi.login ..." end # resource path local_var_path = "/v2/login_information".sub('{format}','json') # query parameters query_params = {} query_params[:'api_password'] = options.api_password if !options.api_password.nil? query_params[:'embed_account_id_guid'] = options.embed_account_id_guid if !options.embed_account_id_guid.nil? query_params[:'include_account_id_guid'] = options.include_account_id_guid if !options.include_account_id_guid.nil? query_params[:'login_settings'] = options.login_settings if !options.login_settings.nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] 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 => 'LoginInformation') if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationApi#login\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Revokes an authorization token. # Revokes an OAuth2 authorization server token. After the revocation is complete, a caller must re-authenticate to restore access. # @return [nil] def revoke_o_auth_token() revoke_o_auth_token_with_http_info() return nil end # Revokes an authorization token. # Revokes an OAuth2 authorization server token. After the revocation is complete, a caller must re-authenticate to restore access. # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def revoke_o_auth_token_with_http_info() if @api_client.config.debugging @api_client.config.logger.debug "Calling API: AuthenticationApi.revoke_o_auth_token ..." end # resource path local_var_path = "/v2/oauth2/revoke".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationApi#revoke_o_auth_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Updates the password for a specified user. # Updates the password for a specified user. # @param login_part Currently, only the value **password** is supported. # @param user_password_information (optional parameter) # @return [nil] def update_password(login_part, user_password_information) update_password_with_http_info(login_part, user_password_information) return nil end # Updates the password for a specified user. # Updates the password for a specified user. # @param login_part Currently, only the value **password** is supported. # @param user_password_information (optional parameter) # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def update_password_with_http_info(login_part, user_password_information) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: AuthenticationApi.update_password ..." end # verify the required parameter 'login_part' is set fail ArgumentError, "Missing the required parameter 'login_part' when calling AuthenticationApi.update_password" if login_part.nil? # resource path local_var_path = "/v2/login_information/{loginPart}".sub('{format}','json').sub('{' + 'loginPart' + '}', login_part.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(user_password_information) auth_names = [] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationApi#update_password\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Adds social account for a user. # Adds a new social account to a user's account. # @param account_id The external account number (int) or account ID Guid. # @param user_id The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. # @param social_account_information (optional parameter) # @return [nil] def update_social_login(account_id, user_id, social_account_information) update_social_login_with_http_info(account_id, user_id, social_account_information) return nil end # Adds social account for a user. # Adds a new social account to a user's account. # @param account_id The external account number (int) or account ID Guid. # @param user_id The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. # @param social_account_information (optional parameter) # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def update_social_login_with_http_info(account_id, user_id, social_account_information) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: AuthenticationApi.update_social_login ..." end # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling AuthenticationApi.update_social_login" if account_id.nil? # verify the required parameter 'user_id' is set fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthenticationApi.update_social_login" if user_id.nil? # resource path local_var_path = "/v2/accounts/{accountId}/users/{userId}/social".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'userId' + '}', user_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(social_account_information) auth_names = [] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationApi#update_social_login\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end