Class: Pachube
Defined Under Namespace
Classes: PachubeError
Instance Method Summary collapse
-
#get_eeml(feed_url) ⇒ Object
Fetches the Pachube feed Returns the latest datastream entry as EEML::Environment object.
-
#get_xml(feed_url) ⇒ Object
Fetches the Pachube feed Returns the latest datastream entry as XML.
-
#initialize(key) ⇒ Pachube
constructor
A new instance of Pachube.
-
#update(feed_url, eeml) ⇒ Object
Posts an update to a specified Pachube feed.
Constructor Details
#initialize(key) ⇒ Pachube
Returns a new instance of Pachube.
16 17 18 |
# File 'lib/pachuber.rb', line 16 def initialize(key) @key = key end |
Instance Method Details
#get_eeml(feed_url) ⇒ Object
Fetches the Pachube feed Returns the latest datastream entry as EEML::Environment object
29 30 31 32 |
# File 'lib/pachuber.rb', line 29 def get_eeml(feed_url) xml = self.get_xml(feed_url) eeml = EEML::Environment.from_eeml(xml) end |
#get_xml(feed_url) ⇒ Object
Fetches the Pachube feed Returns the latest datastream entry as XML
22 23 24 25 |
# File 'lib/pachuber.rb', line 22 def get_xml(feed_url) = { :format => "xml", :headers => {"X-PachubeApiKey" => @key} } self.class.get(feed_url, ) end |
#update(feed_url, eeml) ⇒ Object
Posts an update to a specified Pachube feed
35 36 37 38 39 40 |
# File 'lib/pachuber.rb', line 35 def update(feed_url, eeml) = { :headers => {"X-PachubeApiKey" => @key}, :body => eeml } self.class.put(feed_url, ) end |