Class: Infostrada::EndpointChecker
- Inherits:
-
Object
- Object
- Infostrada::EndpointChecker
- Includes:
- EM::Deferrable
- Defined in:
- lib/infostrada/endpoints_poller.rb
Overview
EndpointChecker is an helper class that will call CallRefresh.get_latest to check which updates were made since the last request. It will then call .succeed or .fail asynchronously.
Instance Method Summary collapse
-
#initialize(endpoints_whitelist) ⇒ EndpointChecker
constructor
A new instance of EndpointChecker.
Constructor Details
#initialize(endpoints_whitelist) ⇒ EndpointChecker
Returns a new instance of EndpointChecker.
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/infostrada/endpoints_poller.rb', line 68 def initialize(endpoints_whitelist) # The CallRefresh endpoint is the one using 'Utility' instead of 'Football'. Infostrada::CallRefresh.base_uri Infostrada::CallRefresh.base_uri.gsub(/Football/, 'Utility') begin updated = Infostrada::CallRefresh.get_latest updated = updated.select { |endpoint| endpoints_whitelist.include?(endpoint.method) } self.succeed(updated) rescue => e self.fail(e.) end end |