Class: MosEisley::WebAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/http-client/webapi.rb

Constant Summary collapse

BASE_URL =
'https://slack.com/api/'.freeze

Class Method Summary collapse

Class Method Details

.auth_testObject



5
6
7
8
9
10
# File 'lib/http-client/webapi.rb', line 5

def self.auth_test
  post_to_slack('auth.test', nil, true) do |r|
    MosEisley.config.meta.merge!(r)
    MosEisley.logger.info('Saved meta data.')
  end
end

.dialog_open(msg) ⇒ Object



28
29
30
# File 'lib/http-client/webapi.rb', line 28

def self.dialog_open(msg)
  post_to_slack('dialog.open', msg)
end

.me_message(channel:, text:) ⇒ Object



12
13
14
# File 'lib/http-client/webapi.rb', line 12

def self.me_message(channel:, text:)
  post_to_slack('chat.meMessage', {channel: channel, text: text})
end

.post_ephemeral(msg) ⇒ Object



20
21
22
# File 'lib/http-client/webapi.rb', line 20

def self.post_ephemeral(msg)
  post_to_slack('chat.postEphemeral', msg)
end

.post_message(msg) ⇒ Object



16
17
18
# File 'lib/http-client/webapi.rb', line 16

def self.post_message(msg)
  post_to_slack('chat.postMessage', msg)
end

.update(msg) ⇒ Object



24
25
26
# File 'lib/http-client/webapi.rb', line 24

def self.update(msg)
  post_to_slack('chat.update', msg)
end