Class: SlackWebApi::AppsPermissionsController

Inherits:
BaseController show all
Defined in:
lib/slack_web_api/controllers/apps_permissions_controller.rb

Overview

AppsPermissionsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

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

#apps_permissions_info(token: nil) ⇒ ApiResponse

Returns list of permissions this app has on a team. scope: none

Parameters:

  • token (String) (defaults to: nil)

    Optional parameter: Authentication token. Requires

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/slack_web_api/controllers/apps_permissions_controller.rb', line 13

def apps_permissions_info(token: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/apps.permissions.info',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(token, key: 'token'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AppsPermissionsInfoSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Standard failure response when used with an invalid token',
                             AppsPermissionsInfoErrorSchemaException))
    .execute
end

#apps_permissions_request(token, scopes, trigger_id) ⇒ ApiResponse

Allows an app to request additional scopes scope: none scopes to request for permissions API

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • scopes (String)

    Required parameter: A comma separated list of

  • trigger_id (String)

    Required parameter: Token used to trigger the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/slack_web_api/controllers/apps_permissions_controller.rb', line 40

def apps_permissions_request(token,
                             scopes,
                             trigger_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/apps.permissions.request',
                                 Server::DEFAULT)
               .query_param(new_parameter(token, key: 'token')
                             .is_required(true))
               .query_param(new_parameter(scopes, key: 'scopes')
                             .is_required(true))
               .query_param(new_parameter(trigger_id, key: 'trigger_id')
                             .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(AppsPermissionsRequestSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Standard failure response when trigger_id is invalid',
                             AppsPermissionsRequestErrorSchemaException))
    .execute
end