Class: Hall::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/hall.rb

Instance Method Summary collapse

Constructor Details

#initialize(room_token, from_name, from_picture = nil) ⇒ 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

from_picture

optional add picture to the post



25
26
27
28
29
# File 'lib/hall.rb', line 25

def initialize(room_token, from_name, from_picture = nil)
  @room_token   = room_token
  @from_name    = from_name
  @from_picture = from_picture
end

Instance Method Details

#post_message(text) ⇒ Object

Post a message.

Usage:

post_message 'plain text'

Parametrs:

text

plain text to be send to the chat



42
43
44
45
46
47
48
49
50
# File 'lib/hall.rb', line 42

def post_message(text)
  body ={
    "title"   => @from_name,
    "picture" => @from_picture,
    "message" => text
  }

  self.class.post(room_path, request_options(body))
end