lib/melonsmasher/pokemon-go-status.rb in pokemon-go-status-0.0.6 vs lib/melonsmasher/pokemon-go-status.rb in pokemon-go-status-0.0.7
- old
+ new
@@ -7,35 +7,40 @@
def interpret_response_average avg_ms
if avg_ms === -1
{
:exit_code => 3,
:description => 'Error! Probably not a good sign, but try again.',
- :avg_ms => avg_ms
+ :avg_ms => avg_ms,
+ :available => false
}
elsif avg_ms < 800
{
:exit_code => 0,
:description => 'All good! Go catch\'em all!',
- :avg_ms => avg_ms
+ :avg_ms => avg_ms,
+ :available => true
}
elsif avg_ms >= 800 && avg_ms < 3000
{
:exit_code => 1,
:description => 'Servers are slow. Your mileage may vary.',
- :avg_ms => avg_ms
+ :avg_ms => avg_ms,
+ :available => true
}
elsif avg_ms > 3000
{
:exit_code => 2,
:description => 'Servers don\'t seem to be up.',
- :avg_ms => avg_ms
+ :avg_ms => avg_ms,
+ :available => false
}
else
{
:exit_code => 3,
:description => 'Error! Probably not a good sign, but try again.',
- :avg_ms => avg_ms
+ :avg_ms => avg_ms,
+ :available => false
}
end
end
def get_server_response_average url
@@ -50,10 +55,10 @@
total_time = total_time + response_time.round
end
total_time / times.count
end
- def get_server_status url
+ def get_server_status url = 'https://pgorelease.nianticlabs.com/plfe/'
self.interpret_response_average self.get_server_response_average url
end
end
end