class AsposeDiagramCloud::OAuthApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/AsposeDiagramCloud/api/o_auth_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

o_auth_post(grant_type, client_id, client_secret, opts = {}) click to toggle source

Get Access token

@param grant_type Grant Type @param client_id App SID @param client_secret App Key @param [Hash] opts the optional parameters @return [AccessTokenResponse]

# File lib/AsposeDiagramCloud/api/o_auth_api.rb, line 30
def o_auth_post(grant_type, client_id, client_secret, opts = {})
  data, _status_code, _headers = o_auth_post_with_http_info(grant_type, client_id, client_secret, opts)
  return data
end
o_auth_post_with_http_info(grant_type, client_id, client_secret, opts = {}) click to toggle source

Get Access token

@param grant_type Grant Type @param client_id App SID @param client_secret App Key @param [Hash] opts the optional parameters @return [Array<(AccessTokenResponse, Fixnum, Hash)>] AccessTokenResponse data, response status code and response headers

# File lib/AsposeDiagramCloud/api/o_auth_api.rb, line 42
def o_auth_post_with_http_info(grant_type, client_id, client_secret, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: OAuthApi.o_auth_post ..."
  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 OAuthApi.o_auth_post"
  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 OAuthApi.o_auth_post"
  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 OAuthApi.o_auth_post"
  end
  # resource path
  local_var_path = "/connect/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["grant_type"] = grant_type
  form_params["client_id"] = client_id
  form_params["client_secret"] = client_secret

  # 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 => 'AccessTokenResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OAuthApi#o_auth_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end