summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/hcl/commands.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/hcl/commands.rb b/lib/hcl/commands.rb
index 5b69d45..9800c95 100644
--- a/lib/hcl/commands.rb
+++ b/lib/hcl/commands.rb
@@ -12,12 +12,15 @@ module HCl
# Show the network status of the Harvest service.
def status
- result = Faraday.new("http://harveststatus.com/") do |f|
- f.use :harvest, '', ''
+ result = Faraday.new("http://kccljmymlslr.statuspage.io/api/v2") do |f|
f.adapter Faraday.default_adapter
end.get('status.json').body
- date = Time.at(result[:last_check_time].to_i)
- "Harvest is #{result[:status]}, response time: #{result[:last_response_time]}ms. [#{date}]"
+
+ json = Yajl::Parser.parse result, symbolize_keys: true
+ status = json[:status][:description]
+ updated_at = DateTime.parse(json[:page][:updated_at]).strftime "%F %T %:z"
+
+ "#{status} [#{updated_at}]"
end
def console