Browse files

Add getLastEdited API method

  • Loading branch information...
1 parent e8d5f56 commit f118ea13d20270c6cda1d2a6dd8954cf4629fa26 @jhollinger committed Jul 7, 2012
Showing with 15 additions and 0 deletions.
  1. +5 −0 lib/etherpad-lite/client.rb
  2. +5 −0 lib/etherpad-lite/models/pad.rb
  3. +5 −0 spec/pad_spec.rb
View
5 lib/etherpad-lite/client.rb
@@ -218,6 +218,11 @@ def getRevisionsCount(padID)
get :getRevisionsCount, :padID => padID
end
+ # Returns the time the pad was last edited as a Unix timestamp
+ def getLastEdited(padID)
+ get :getLastEdited, :padID => padID
+ end
+
# Delete the given Pad
def deletePad(padID)
post :deletePad, :padID => padID
View
5 lib/etherpad-lite/models/pad.rb
@@ -124,6 +124,11 @@ def read_only_id
@read_only_id ||= @instance.client.getReadOnlyID(@id)[:readOnlyID]
end
+ # Returns the time the pad was last edited as a Unix timestamp
+ def last_edited
+ @instance.client.getLastEdited(@id)[:lastEdited]
+ end
+
# Returns an array of ids of authors who've edited this pad
def author_ids
@instance.client.listAuthorsOfPad(@id)[:authorIDs] || []
View
5 spec/pad_spec.rb
@@ -94,6 +94,11 @@
pad.authors.should == []
end
+ it "should get the last edit date" do
+ pad = @eth.pad 'brand new pad3'
+ pad.last_edited.>(1).should == true
+ end
+
it "should be deleted" do
@eth.get_pad('another new pad').delete
@eth.create_pad('another new pad').id.should_not == nil

0 comments on commit f118ea1

Please sign in to comment.