Class: Ruboty::GithubStatus::Actions::GithubStatus
- Inherits:
-
Actions::Base
- Object
- Actions::Base
- Ruboty::GithubStatus::Actions::GithubStatus
- Defined in:
- lib/ruboty/github_status/actions/github_status.rb
Instance Method Summary collapse
Instance Method Details
#last_message ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ruboty/github_status/actions/github_status.rb', line 22 def html = open('https://status.github.com/api/last-message.json').read json = JSON.parser.new(html).parse date = Time.parse(json['created_on']).getlocal msg = "Status: #{json['status']}\n" msg += "Message: #{json['body']}\n" msg += "Date: #{date}" .reply(msg) end |
#status ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ruboty/github_status/actions/github_status.rb', line 8 def status html = open('https://status.github.com/api/status.json').read json = JSON.parser.new(html).parse now = Time.now date = Time.parse(json['last_updated']).getlocal p now p date seconds_ago = (now - date).to_i msg = "Status: #{json['status']} (#{seconds_ago} seconds ago)" .reply(msg) end |