Class: SlackWebApi::AuthController
- Inherits:
-
BaseController
- Object
- BaseController
- SlackWebApi::AuthController
- Defined in:
- lib/slack_web_api/controllers/auth_controller.rb
Overview
AuthController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#auth_revoke(token, test: nil) ⇒ ApiResponse
Revokes a token.
-
#auth_test(token) ⇒ ApiResponse
Checks authentication & identity.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from SlackWebApi::BaseController
Instance Method Details
#auth_revoke(token, test: nil) ⇒ ApiResponse
Revokes a token. scope: none parameter to 1 triggers a _testing mode_ where the specified token will not actually be revoked.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/slack_web_api/controllers/auth_controller.rb', line 16 def auth_revoke(token, test: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/auth.revoke', Server::DEFAULT) .query_param(new_parameter(token, key: 'token') .is_required(true)) .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type')) .query_param(new_parameter(test, key: 'test')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('slackAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(AuthRevokeSchema.method(:from_hash)) .is_api_response(true) .local_error('default', 'Typical error response', AuthRevokeErrorSchemaException)) .execute end |
#auth_test(token) ⇒ ApiResponse
Checks authentication & identity. scope: none
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/slack_web_api/controllers/auth_controller.rb', line 42 def auth_test(token) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/auth.test', Server::DEFAULT) .header_param(new_parameter(token, key: 'token') .is_required(true)) .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('slackAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(AuthTestSuccessSchema.method(:from_hash)) .is_api_response(true) .local_error('default', 'Standard failure response when used with an invalid token', AuthTestErrorSchemaException)) .execute end |