Class: HangoutsChat::Sender
- Inherits:
-
Object
- Object
- HangoutsChat::Sender
- Defined in:
- lib/hangouts_chat.rb,
lib/hangouts_chat/http.rb,
lib/hangouts_chat/exceptions.rb
Overview
Provide methods to send messages to Hangouts Chat rooms using webhooks API
Defined Under Namespace
Instance Attribute Summary collapse
-
#url ⇒ String
readonly
Webhook URL, given on initialization.
Instance Method Summary collapse
-
#card(header, sections) ⇒ Net::HTTPResponse
Sends Card Message.
-
#initialize(webhook_url) ⇒ Sender
constructor
Creates Sender object.
-
#simple(text) ⇒ Net::HTTPResponse
Sends Simple Text Message.
Constructor Details
Instance Attribute Details
#url ⇒ String (readonly)
Returns Webhook URL, given on initialization.
10 11 12 |
# File 'lib/hangouts_chat.rb', line 10 def url @url end |
Instance Method Details
#card(header, sections) ⇒ Net::HTTPResponse
Sends Card Message
32 33 34 35 |
# File 'lib/hangouts_chat.rb', line 32 def card(header, sections) payload = { cards: [header: header, sections: sections] } send_request(payload) end |
#simple(text) ⇒ Net::HTTPResponse
Sends Simple Text Message
22 23 24 25 |
# File 'lib/hangouts_chat.rb', line 22 def simple(text) payload = { text: text } send_request(payload) end |