Class: Infrawrench::SlackNamespace
- Inherits:
-
Object
- Object
- Infrawrench::SlackNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.slack
Instance Attribute Summary collapse
-
#channels ⇒ SlackChannelsNamespace
readonly
client.slack.channels. -
#installations ⇒ SlackInstallationsNamespace
readonly
client.slack.installations.
Instance Method Summary collapse
-
#initialize(transport) ⇒ SlackNamespace
constructor
private
A new instance of SlackNamespace.
-
#install_url(org_id: nil, request_options: nil) ⇒ Hash
Get the Add to Slack URL.
-
#status(org_id: nil, request_options: nil) ⇒ Hash
Get the organization's Slack connection.
-
#test(org_id: nil, request_options: nil) ⇒ Hash
Post a test message to every configured channel.
Constructor Details
#initialize(transport) ⇒ SlackNamespace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SlackNamespace.
3645 3646 3647 3648 3649 |
# File 'lib/infrawrench/client.rb', line 3645 def initialize(transport) @transport = transport @channels = SlackChannelsNamespace.new(@transport) @installations = SlackInstallationsNamespace.new(@transport) end |
Instance Attribute Details
#channels ⇒ SlackChannelsNamespace (readonly)
Returns client.slack.channels.
3639 3640 3641 |
# File 'lib/infrawrench/client.rb', line 3639 def channels @channels end |
#installations ⇒ SlackInstallationsNamespace (readonly)
Returns client.slack.installations.
3641 3642 3643 |
# File 'lib/infrawrench/client.rb', line 3641 def installations @installations end |
Instance Method Details
#install_url(org_id: nil, request_options: nil) ⇒ Hash
Get the Add to Slack URL
Returns a slack.com/oauth/v2/authorize URL carrying a signed state that
binds the resulting install to this organization. Send the user's browser
there; Slack redirects back to /api/slack/oauth/callback.
GET /api/org/orgId/slack/install-url
Raises on 400: Bad request
3666 3667 3668 3669 3670 3671 3672 3673 |
# File 'lib/infrawrench/client.rb', line 3666 def install_url(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/slack/install-url", path_params: { "orgId" => org_id }, request_options: ) end |
#status(org_id: nil, request_options: nil) ⇒ Hash
Get the organization's Slack connection
Reports whether the server has a Slack app registered, which workspaces this organization has connected, and which channels alerts are routed to.
GET /api/org/orgId/slack/status
3687 3688 3689 3690 3691 3692 3693 3694 |
# File 'lib/infrawrench/client.rb', line 3687 def status(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/slack/status", path_params: { "orgId" => org_id }, request_options: ) end |
#test(org_id: nil, request_options: nil) ⇒ Hash
Post a test message to every configured channel
Ignores trigger opt-ins — every channel gets the test. Fails with the
Slack error when nothing could be delivered (not_in_channel means the
bot needs inviting to a private channel).
POST /api/org/orgId/slack/test
Raises on 400: Bad request
3711 3712 3713 3714 3715 3716 3717 3718 |
# File 'lib/infrawrench/client.rb', line 3711 def test(org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/slack/test", path_params: { "orgId" => org_id }, request_options: ) end |