Class: Hall::Client
Instance Method Summary collapse
-
#initialize(room_token, from_name) ⇒ Client
constructor
Client initialization.
-
#post_message(text) ⇒ Object
Post a message.
Constructor Details
#initialize(room_token, from_name) ⇒ Client
Client initialization
Usage:
Hall::Client.new('room_token', 'from_name')
Parametrs:
room_token
-
token for your room grab it through the Add integration -> Other or hall.com/docs/integrations/generic/
from_name
-
defines the name used for message posting
23 24 25 26 |
# File 'lib/hall.rb', line 23 def initialize(room_token, from_name) @room_token = room_token @from_name = from_name end |
Instance Method Details
#post_message(text) ⇒ Object
Post a message.
Usage:
'plain text'
Parametrs:
text
-
plain text to be send to the chat
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/hall.rb', line 39 def (text) body ={ "title" => @from_name, "message" => text } = {body: body, options: { headers: { 'ContentType' => 'application/json' } } } self.class.post(room_path, ) end |