Class: SlackWebApi::CallsController

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

Overview

CallsController

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

#calls_add(token, external_unique_id, join_url, external_display_id: nil, desktop_app_join_url: nil, date_start: nil, title: nil, created_by: nil, users: nil) ⇒ ApiResponse

Registers a new Call. scope: calls:write the 3rd-party Call provider. It must be unique across all Calls from that service. to join the Call. human-readable ID supplied by the 3rd-party Call provider. If supplied, this ID will be displayed in the Call object. available Slack clients will attempt to directly launch the 3rd-party Call with this URL. UNIX timestamp format the user who created this Call. When this method is called with a user token, the created_by field is optional and defaults to the authed user of the token. Otherwise, the field is required. participants in the Call. [Read more on how to specify users here](/apis/calls#users).

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • external_unique_id (String)

    Required parameter: An ID supplied by

  • join_url (String)

    Required parameter: The URL required for a client

  • external_display_id (String) (defaults to: nil)

    Optional parameter: An optional,

  • desktop_app_join_url (String) (defaults to: nil)

    Optional parameter: When supplied,

  • date_start (Integer) (defaults to: nil)

    Optional parameter: Call start time in UTC

  • title (String) (defaults to: nil)

    Optional parameter: The name of the Call.

  • created_by (String) (defaults to: nil)

    Optional parameter: The valid Slack user ID of

  • users (String) (defaults to: nil)

    Optional parameter: The list of users to register as

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



34
35
36
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
# File 'lib/slack_web_api/controllers/calls_controller.rb', line 34

def calls_add(token,
              external_unique_id,
              join_url,
              external_display_id: nil,
              desktop_app_join_url: nil,
              date_start: nil,
              title: nil,
              created_by: nil,
              users: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/calls.add',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(external_unique_id, key: 'external_unique_id')
                            .is_required(true))
               .form_param(new_parameter(join_url, key: 'join_url')
                            .is_required(true))
               .form_param(new_parameter(external_display_id, key: 'external_display_id'))
               .form_param(new_parameter(desktop_app_join_url, key: 'desktop_app_join_url'))
               .form_param(new_parameter(date_start, key: 'date_start'))
               .form_param(new_parameter(title, key: 'title'))
               .form_param(new_parameter(created_by, key: 'created_by'))
               .form_param(new_parameter(users, key: 'users'))
               .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(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#calls_end(token, id, duration: nil) ⇒ ApiResponse

Ends a Call. scope: calls:write call using the [calls.add](/methods/calls.add) method.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • id (String)

    Required parameter: id returned when registering the

  • duration (Integer) (defaults to: nil)

    Optional parameter: Call duration in seconds

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/slack_web_api/controllers/calls_controller.rb', line 79

def calls_end(token,
              id,
              duration: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/calls.end',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(id, key: 'id')
                            .is_required(true))
               .form_param(new_parameter(duration, key: 'duration'))
               .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(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#calls_info(token, id) ⇒ ApiResponse

Returns information about a Call. scope: calls:read [calls.add](/methods/calls.add) method.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • id (String)

    Required parameter: id of the Call returned by the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/slack_web_api/controllers/calls_controller.rb', line 110

def calls_info(token,
               id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/calls.info',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .query_param(new_parameter(id, key: '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(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#calls_update(token, id, title: nil, join_url: nil, desktop_app_join_url: nil) ⇒ ApiResponse

Updates information about a Call. scope: calls:write [calls.add](/methods/calls.add) method. to join the Call. available Slack clients will attempt to directly launch the 3rd-party Call with this URL.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • id (String)

    Required parameter: id returned by the

  • title (String) (defaults to: nil)

    Optional parameter: The name of the Call.

  • join_url (String) (defaults to: nil)

    Optional parameter: The URL required for a client

  • desktop_app_join_url (String) (defaults to: nil)

    Optional parameter: When supplied,

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def calls_update(token,
                 id,
                 title: nil,
                 join_url: nil,
                 desktop_app_join_url: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/calls.update',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(id, key: 'id')
                            .is_required(true))
               .form_param(new_parameter(title, key: 'title'))
               .form_param(new_parameter(join_url, key: 'join_url'))
               .form_param(new_parameter(desktop_app_join_url, key: 'desktop_app_join_url'))
               .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(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end