diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-07-05 13:48:08 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-07-05 13:48:08 +0100 |
commit | eeddc7a436fad01a569553465984ef97b3efbc84 (patch) | |
tree | 002b59522336036ffa0ab8a37efb4f689004c071 /lib/mauve/calendar_interface.rb | |
parent | f916722d4370fac1cdf46801a9cf945c4900a44c (diff) |
Moved http api requests into separate module. Added ability to poll a URL for
lists of IPs.
Diffstat (limited to 'lib/mauve/calendar_interface.rb')
-rw-r--r-- | lib/mauve/calendar_interface.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/mauve/calendar_interface.rb b/lib/mauve/calendar_interface.rb index 5282d79..f67c70b 100644 --- a/lib/mauve/calendar_interface.rb +++ b/lib/mauve/calendar_interface.rb @@ -5,10 +5,18 @@ module Mauve # Interface to the Bytemark calendar. # - class CalendarInterface < GenericHttpApiClient + class CalendarInterface class << self + include GenericHttpApiClient + + # return [Log4r::Logger] + def logger + @logger ||= Log4r::Logger.new(self.to_s) + end + + def get_attendees(klass, at=Time.now) # # Returns nil if no calendar_url has been set. @@ -63,11 +71,11 @@ module Mauve private - def get_yaml(url) + def do_get_yaml(url) resp = do_get(url) return (resp.is_a?(String) ? YAML.load(resp) : nil) - rescue StandardError => err + rescue StandardError => ex logger.error "Caught #{ex.class.to_s} (#{ex.to_s}) whilst querying #{url.to_s}." logger.debug err.backtrace.join("\n") nil |