Class: Falcon::Oauth2Api
- Inherits:
-
Object
- Object
- Falcon::Oauth2Api
- Defined in:
- lib/crimson-falcon/api/oauth2_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ Oauth2Api
constructor
A new instance of Oauth2Api.
-
#oauth2_access_token(client_id, client_secret, opts = {}) ⇒ DomainAccessTokenResponseV1
Generate an OAuth2 access token.
-
#oauth2_access_token_with_http_info(client_id, client_secret, opts = {}) ⇒ Array<(DomainAccessTokenResponseV1, Integer, Hash)>
Generate an OAuth2 access token.
-
#oauth2_revoke_token(token, opts = {}) ⇒ MsaReplyMetaOnly
Revoke a previously issued OAuth2 access token before the end of its standard 30-minute lifespan.
-
#oauth2_revoke_token_with_http_info(token, opts = {}) ⇒ Array<(MsaReplyMetaOnly, Integer, Hash)>
Revoke a previously issued OAuth2 access token before the end of its standard 30-minute lifespan.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
34 35 36 |
# File 'lib/crimson-falcon/api/oauth2_api.rb', line 34 def api_client @api_client end |
Instance Method Details
#oauth2_access_token(client_id, client_secret, opts = {}) ⇒ DomainAccessTokenResponseV1
Generate an OAuth2 access token
45 46 47 48 |
# File 'lib/crimson-falcon/api/oauth2_api.rb', line 45 def oauth2_access_token(client_id, client_secret, opts = {}) data, _status_code, _headers = oauth2_access_token_with_http_info(client_id, client_secret, opts) data end |
#oauth2_access_token_with_http_info(client_id, client_secret, opts = {}) ⇒ Array<(DomainAccessTokenResponseV1, Integer, Hash)>
Generate an OAuth2 access token
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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/crimson-falcon/api/oauth2_api.rb', line 56 def oauth2_access_token_with_http_info(client_id, client_secret, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: Oauth2Api.oauth2_access_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 Oauth2Api.oauth2_access_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 Oauth2Api.oauth2_access_token" end # resource path local_var_path = '/oauth2/token' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded', 'text/html']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['client_id'] = client_id form_params['client_secret'] = client_secret form_params['member_cid'] = opts[:'member_cid'] if !opts[:'member_cid'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'DomainAccessTokenResponseV1' # auth_names auth_names = opts[:debug_auth_names] || ['basicAuth'] = opts.merge( :operation => :"Oauth2Api.oauth2_access_token", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: Oauth2Api#oauth2_access_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#oauth2_revoke_token(token, opts = {}) ⇒ MsaReplyMetaOnly
Revoke a previously issued OAuth2 access token before the end of its standard 30-minute lifespan.
121 122 123 124 |
# File 'lib/crimson-falcon/api/oauth2_api.rb', line 121 def oauth2_revoke_token(token, opts = {}) data, _status_code, _headers = oauth2_revoke_token_with_http_info(token, opts) data end |
#oauth2_revoke_token_with_http_info(token, opts = {}) ⇒ Array<(MsaReplyMetaOnly, Integer, Hash)>
Revoke a previously issued OAuth2 access token before the end of its standard 30-minute lifespan.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 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 |
# File 'lib/crimson-falcon/api/oauth2_api.rb', line 131 def oauth2_revoke_token_with_http_info(token, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: Oauth2Api.oauth2_revoke_token ...' end # verify the required parameter 'token' is set if @api_client.config.client_side_validation && token.nil? fail ArgumentError, "Missing the required parameter 'token' when calling Oauth2Api.oauth2_revoke_token" end # resource path local_var_path = '/oauth2/revoke' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['token'] = token form_params['client_id'] = opts[:'client_id'] if !opts[:'client_id'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'MsaReplyMetaOnly' # auth_names auth_names = opts[:debug_auth_names] || ['basicAuth'] = opts.merge( :operation => :"Oauth2Api.oauth2_revoke_token", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: Oauth2Api#oauth2_revoke_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |