Class: Timetrap::Hipchat
- Inherits:
-
Object
- Object
- Timetrap::Hipchat
- Includes:
- Helpers
- Defined in:
- lib/timetrap/hipchat.rb
Instance Method Summary collapse
- #in ⇒ Object
-
#initialize(api_token, room, user) ⇒ Hipchat
constructor
A new instance of Hipchat.
- #out ⇒ Object
- #resume ⇒ Object
Constructor Details
#initialize(api_token, room, user) ⇒ Hipchat
Returns a new instance of Hipchat.
7 8 9 10 11 |
# File 'lib/timetrap/hipchat.rb', line 7 def initialize(api_token, room, user) @client = HipChat::Client.new api_token, api_version: 'v2' @room = room @user = user end |
Instance Method Details
#in ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/timetrap/hipchat.rb', line 13 def in entry = Timetrap::Timer.active_entry image = shield 'started', 'green' send 'green', <<-MSG <img src="#{image}" /> <strong>#{entry.note}</strong> MSG end |
#out ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/timetrap/hipchat.rb', line 23 def out entry = Timetrap::Timer.last_checkout duration = format_seconds entry.duration image = shield 'stopped', 'red' send 'red', <<-MSG <img src="#{image}" /> <strong>#{entry.note}</strong> after <em>#{duration}</em> MSG end |
#resume ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/timetrap/hipchat.rb', line 34 def resume entry = Timetrap::Timer.active_entry image = shield 'resumed', 'yellow' send 'yellow', <<-MSG <img src="#{image}" /> <strong>#{entry.note}</strong> MSG end |