class SlackbotFrd::SlackMethods::GroupsInvite

Attributes

response[R]

Public Class Methods

invite(token:, user:, channel:) click to toggle source
# File lib/slackbot_frd/slack_methods/group_invite.rb, line 12
def self.invite(token:, user:, channel:)
  SlackbotFrd::Log.info(user.to_s)
  GroupsInvite.new(token: token, user: user, channel: channel).run
end
new(token:, user:, channel:) click to toggle source
# File lib/slackbot_frd/slack_methods/group_invite.rb, line 17
def initialize(token:, user:, channel:)
  @token = token
  @user = user

  @channel = channel
end

Public Instance Methods

run() click to toggle source
# File lib/slackbot_frd/slack_methods/group_invite.rb, line 24
def run
  @response = JSON.parse(
    self.class.post(
      '',
      body: {
        token: @token, channel: @channel, user: @user
      }
    ).body
  )
  ValidateSlack.response(@response)
  @response
end