Class: Mirrored::Update

Inherits:
Base
  • Object
show all
Defined in:
lib/mirrored/update.rb

Class Method Summary collapse

Methods inherited from Base

api_url, connection, establish_connection, remove_connection, service, valid_service?

Class Method Details

.lastObject

Returns a ruby time object that is equal to the last time you posted something. If you haven’t posted anything it returns an empty string (probably).

Usage:

Mirrored::Update.last # => a ruby time object in UTC


7
8
9
10
11
12
# File 'lib/mirrored/update.rb', line 7

def self.last
  result = connection.get('posts/update')
  doc    = Hpricot::XML(result)
  update = doc.at('update')
  update ? Time.parse(update['time']) : ''
end