Class: Boppers::Notifier::Hipchat

Inherits:
Object
  • Object
show all
Defined in:
lib/boppers/notifier/hipchat.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_tokenObject (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

#roomObject (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, message, options)
  endpoint = "https://api.hipchat.com/v2/room/#{room}/notification"
  HttpClient.post(endpoint,
                  message_format: "text",
                  color: options.fetch(:color, "gray"),
                  notify: true,
                  message: message,
                  title: title,
                  auth_token: api_token)
end