Class: Coffee::Remote
Class Method Summary collapse
Class Method Details
.message(content) ⇒ Object
5 6 7 |
# File 'lib/coffee/remote.rb', line 5 def self.(content) get(Coffee::Config.url("/coffee/message"), basic_auth: Coffee::Config.basic, body: { message: content }) end |
.off ⇒ Object
13 14 15 |
# File 'lib/coffee/remote.rb', line 13 def self.off get(Coffee::Config.url("/coffee/off"), basic_auth: Coffee::Config.basic) end |
.on ⇒ Object
9 10 11 |
# File 'lib/coffee/remote.rb', line 9 def self.on get(Coffee::Config.url("/coffee/on"), basic_auth: Coffee::Config.basic) end |
.print_status ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/coffee/remote.rb', line 21 def self.print_status stats = self.status total_seconds = stats["uptime"] seconds = total_seconds % 60 minutes = (total_seconds / 60) % 60 hours = total_seconds / (60 * 60) uptime = "%02d:%02d:%02d" % [hours, minutes, seconds] puts "Running: #{stats["running"].inspect}" puts "Uptime: #{uptime}" end |
.status ⇒ Object
17 18 19 |
# File 'lib/coffee/remote.rb', line 17 def self.status JSON.parse(get(Coffee::Config.url("/coffee/about"), basic_auth: Coffee::Config.basic).parsed_response) end |