Class: SlackbotFrd::SlackMethods::ImOpen

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/slackbot_frd/slack_methods/im_open.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token:, user:) ⇒ ImOpen

Returns a new instance of ImOpen.



18
19
20
21
# File 'lib/slackbot_frd/slack_methods/im_open.rb', line 18

def initialize(token:, user:)
  @token = token
  @user = user
end

Class Method Details

.openChannel(token:, user:) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/slackbot_frd/slack_methods/im_open.rb', line 10

def self.openChannel(token:, user:)
  r = ImOpen.new(
    token: token,
    user: user
  )
  r.openChannel
end

Instance Method Details

#openChannelObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/slackbot_frd/slack_methods/im_open.rb', line 23

def openChannel
  body = {
    token: @token,
    user: @user
  }

  @response = self.class.post('', :body => body)
  ValidateSlack.response(@response)
  @response.body
end