class Telstra_Messaging::AuthenticationApi
Attributes
Public Class Methods
# File lib/Telstra_Messaging/api/authentication_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Generate OAuth2 token To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. @param client_id @param client_secret @param grant_type @param [Hash] opts the optional parameters @return [OAuthResponse]
# File lib/Telstra_Messaging/api/authentication_api.rb, line 29 def auth_token(client_id, client_secret, grant_type, opts = {}) data, _status_code, _headers = auth_token_with_http_info(client_id, client_secret, grant_type, opts) data end
Generate OAuth2 token To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. @param client_id @param client_secret @param grant_type @param [Hash] opts the optional parameters @return [Array<(OAuthResponse
, Fixnum, Hash)>] OAuthResponse
data, response status code and response headers
# File lib/Telstra_Messaging/api/authentication_api.rb, line 41 def auth_token_with_http_info(client_id, client_secret, grant_type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationApi.auth_token ...' end # verify the required parameter 'client_id' is set if @api_client.config.client_side_validation && client_id.nil? fail ArgumentError, "Missing the required parameter 'client_id' when calling AuthenticationApi.auth_token" end # verify the required parameter 'client_secret' is set if @api_client.config.client_side_validation && client_secret.nil? fail ArgumentError, "Missing the required parameter 'client_secret' when calling AuthenticationApi.auth_token" end # verify the required parameter 'grant_type' is set if @api_client.config.client_side_validation && grant_type.nil? fail ArgumentError, "Missing the required parameter 'grant_type' when calling AuthenticationApi.auth_token" end # resource path local_var_path = '/oauth/token' # query parameters query_params = {} # header parameters 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/x-www-form-urlencoded']) # form parameters form_params = {} form_params['client_id'] = client_id form_params['client_secret'] = client_secret form_params['grant_type'] = grant_type # 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 => 'OAuthResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationApi#auth_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end