class Slackvite::Invite
Attributes
email[RW]
subdomain[RW]
token[RW]
Public Class Methods
new(token, subdomain)
click to toggle source
# File lib/slackvite/invite.rb, line 10 def initialize(token, subdomain) @token = token @subdomain = subdomain end
Public Instance Methods
sendTo(email)
click to toggle source
# File lib/slackvite/invite.rb, line 15 def sendTo(email) @email = email puts "Sending invite to #{email}." url = "https://#{@subdomain}.slack.com/api/users.admin.invite" options = { :form => { email: @email, token: @token, set_active: true } } response = HTTP.auth("Bearer #{@token}").post(url, options) if response.code == 200 puts "Success!" else puts "Something went wrong." end end