Class: PhoneComClient::OauthApi
- Inherits:
-
Object
- Object
- PhoneComClient::OauthApi
- Defined in:
- lib/phone_com_client/api/oauth_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_oauth_access_token(opts = {}) ⇒ OauthAccessToken
To create an access token via the /oauth/access-token API, an API user may choose any one of the grant types it supports: Authorization Code Grant, Client Credential Grant, Password Credential Grant or Refresh Token Grant.
-
#create_oauth_access_token_with_http_info(opts = {}) ⇒ Array<(OauthAccessToken, Fixnum, Hash)>
To create an access token via the /oauth/access-token API, an API user may choose any one of the grant types it supports: Authorization Code Grant, Client Credential Grant, Password Credential Grant or Refresh Token Grant.
-
#create_oauth_authorization(client_id, response_type, scope, redirect_uri, opts = {}) ⇒ nil
Create Authorization Code or Access Token.
-
#create_oauth_authorization_with_http_info(client_id, response_type, scope, redirect_uri, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>
Create Authorization Code or Access Token.
-
#get_oauth_access_token(opts = {}) ⇒ GetOauthAccessToken
Retrieve details of an access token, such as scope, expiration and extension ID.
-
#get_oauth_access_token_with_http_info(opts = {}) ⇒ Array<(GetOauthAccessToken, Fixnum, Hash)>
Retrieve details of an access token, such as scope, expiration and extension ID.
-
#initialize(api_client = ApiClient.default) ⇒ OauthApi
constructor
A new instance of OauthApi.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/phone_com_client/api/oauth_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_oauth_access_token(opts = {}) ⇒ OauthAccessToken
To create an access token via the /oauth/access-token API, an API user may choose any one of the grant types it supports: Authorization Code Grant, Client Credential Grant, Password Credential Grant or Refresh Token Grant. To create an access token via the /oauth/access-token API, an API user may choose any one of the grant types it supports: Authorization Code Grant, Client Credential Grant, Password Credential Grant or Refresh Token Grant. For Authorization Code Grant, the input parameter ‘code’ is generated via the Create Authorization API. NOTE: The Create Access Token API now accepts requests in query string format as well as JSON body format. See OAuth for more details on how to obtain client id and client secret to create an access token at real time.
27 28 29 30 |
# File 'lib/phone_com_client/api/oauth_api.rb', line 27 def create_oauth_access_token(opts = {}) data, _status_code, _headers = create_oauth_access_token_with_http_info(opts) data end |
#create_oauth_access_token_with_http_info(opts = {}) ⇒ Array<(OauthAccessToken, Fixnum, Hash)>
To create an access token via the /oauth/access-token API, an API user may choose any one of the grant types it supports: Authorization Code Grant, Client Credential Grant, Password Credential Grant or Refresh Token Grant. To create an access token via the /oauth/access-token API, an API user may choose any one of the grant types it supports: Authorization Code Grant, Client Credential Grant, Password Credential Grant or Refresh Token Grant. For Authorization Code Grant, the input parameter 'code' is generated via the Create Authorization API. NOTE: The Create Access Token API now accepts requests in query string format as well as JSON body format. See OAuth for more details on how to obtain client id and client secret to create an access token at real time.
37 38 39 40 41 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 |
# File 'lib/phone_com_client/api/oauth_api.rb', line 37 def create_oauth_access_token_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OauthApi.create_oauth_access_token ...' end # resource path local_var_path = '/oauth/access-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/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'data']) auth_names = ['apiKey'] 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 => 'OauthAccessToken') if @api_client.config.debugging @api_client.config.logger.debug "API called: OauthApi#create_oauth_access_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_oauth_authorization(client_id, response_type, scope, redirect_uri, opts = {}) ⇒ nil
Create Authorization Code or Access Token. Create Authorization Code or Access Token. The /oauth/authorization API supports Authorization Grant and Implicit Grant. In Authorization Grant, this API returns a code (response_type=code) for clients implemented in a browser using a scripting language such as JavaScript. Users may then use the code via the Create Access Token API to create an access token. The Implicit Grant is a simplified authorization code flow. In the implicit flow, instead of issuing the client an authorization code, the client is issued an access token (response_type=token) directly. See OAuth for more details on how to obtain client id and client secret to create authorization code access token at real time.
80 81 82 83 |
# File 'lib/phone_com_client/api/oauth_api.rb', line 80 def (client_id, response_type, scope, redirect_uri, opts = {}) (client_id, response_type, scope, redirect_uri, opts) nil end |
#create_oauth_authorization_with_http_info(client_id, response_type, scope, redirect_uri, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>
Create Authorization Code or Access Token. Create Authorization Code or Access Token. The /oauth/authorization API supports Authorization Grant and Implicit Grant. In Authorization Grant, this API returns a code (response_type=code) for clients implemented in a browser using a scripting language such as JavaScript. Users may then use the code via the Create Access Token API to create an access token. The Implicit Grant is a simplified authorization code flow. In the implicit flow, instead of issuing the client an authorization code, the client is issued an access token (response_type=token) directly. See OAuth for more details on how to obtain client id and client secret to create authorization code access token at real time.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/phone_com_client/api/oauth_api.rb', line 93 def (client_id, response_type, scope, redirect_uri, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OauthApi.create_oauth_authorization ...' 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.create_oauth_authorization" end # verify the required parameter 'response_type' is set if @api_client.config.client_side_validation && response_type.nil? fail ArgumentError, "Missing the required parameter 'response_type' when calling OauthApi.create_oauth_authorization" end # verify the required parameter 'scope' is set if @api_client.config.client_side_validation && scope.nil? fail ArgumentError, "Missing the required parameter 'scope' when calling OauthApi.create_oauth_authorization" end # verify the required parameter 'redirect_uri' is set if @api_client.config.client_side_validation && redirect_uri.nil? fail ArgumentError, "Missing the required parameter 'redirect_uri' when calling OauthApi.create_oauth_authorization" end # resource path local_var_path = '/oauth/authorization' # query parameters query_params = {} query_params[:'client_id'] = client_id query_params[:'response_type'] = response_type query_params[:'scope'] = scope query_params[:'redirect_uri'] = redirect_uri # 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/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['apiKey'] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: OauthApi#create_oauth_authorization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_oauth_access_token(opts = {}) ⇒ GetOauthAccessToken
Retrieve details of an access token, such as scope, expiration and extension ID. Retrieve details of an access token, such as scope, expiration and extension ID. Voip ID will be returned as well if scope contains account-owner scope.
151 152 153 154 |
# File 'lib/phone_com_client/api/oauth_api.rb', line 151 def get_oauth_access_token(opts = {}) data, _status_code, _headers = get_oauth_access_token_with_http_info(opts) data end |
#get_oauth_access_token_with_http_info(opts = {}) ⇒ Array<(GetOauthAccessToken, Fixnum, Hash)>
Retrieve details of an access token, such as scope, expiration and extension ID. Retrieve details of an access token, such as scope, expiration and extension ID. Voip ID will be returned as well if scope contains account-owner scope.
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/phone_com_client/api/oauth_api.rb', line 160 def get_oauth_access_token_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OauthApi.get_oauth_access_token ...' end # resource path local_var_path = '/oauth/access-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/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['apiKey'] 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 => 'GetOauthAccessToken') if @api_client.config.debugging @api_client.config.logger.debug "API called: OauthApi#get_oauth_access_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |