Class: AsposeDiagramCloud::OAuthApi

Inherits:
Object
  • Object
show all
Defined in:
lib/AsposeDiagramCloud/api/o_auth_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ OAuthApi

Returns a new instance of OAuthApi.



19
20
21
# File 'lib/AsposeDiagramCloud/api/o_auth_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/AsposeDiagramCloud/api/o_auth_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#o_auth_post(grant_type, client_id, client_secret, opts = {}) ⇒ AccessTokenResponse

Get Access token

Parameters:

  • grant_type

    Grant Type

  • client_id

    App SID

  • client_secret

    App Key

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



30
31
32
33
# 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 = {}) ⇒ Array<(AccessTokenResponse, Fixnum, Hash)>

Get Access token

Parameters:

  • grant_type

    Grant Type

  • client_id

    App SID

  • client_secret

    App Key

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AccessTokenResponse, Fixnum, Hash)>)

    AccessTokenResponse data, response status code and response headers



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# 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