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


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

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