Class: Boppers::Notifier::Hipchat
- Inherits:
-
Object
- Object
- Boppers::Notifier::Hipchat
- Defined in:
- lib/boppers/notifier/hipchat.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
-
#room ⇒ Object
readonly
Returns the value of attribute room.
Instance Method Summary collapse
- #call(title, message, options) ⇒ Object
-
#initialize(api_token:, room:, subscribe: nil) ⇒ Hipchat
constructor
A new instance of Hipchat.
Constructor Details
#initialize(api_token:, room:, subscribe: nil) ⇒ Hipchat
Returns a new instance of Hipchat.
8 9 10 11 12 |
# File 'lib/boppers/notifier/hipchat.rb', line 8 def initialize(api_token:, room:, subscribe: nil) @api_token = api_token @room = room @subscribe = subscribe end |
Instance Attribute Details
#api_token ⇒ Object (readonly)
Returns the value of attribute api_token.
6 7 8 |
# File 'lib/boppers/notifier/hipchat.rb', line 6 def api_token @api_token end |
#room ⇒ Object (readonly)
Returns the value of attribute room.
6 7 8 |
# File 'lib/boppers/notifier/hipchat.rb', line 6 def room @room end |
Instance Method Details
#call(title, message, options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/boppers/notifier/hipchat.rb', line 14 def call(title, , ) endpoint = "https://api.hipchat.com/v2/room/#{room}/notification" HttpClient.post(endpoint, message_format: "text", color: .fetch(:color, "gray"), notify: true, message: , title: title, auth_token: api_token) end |