Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add 'Google::Reader::Tag.rename' method

The unnoficial docs from pyrfeed don't mention it but by monitoring the
Google Reader webapp requests I was able to discover the existence of an
'rename-tag' API endpoing, used to (suprise!) rename tags/labels. I've
added a method to the Tag class that wraps it.
  • Loading branch information...
commit 023d1b8ccfc54a050071dc171485c9e6e441096a 1 parent 2ff6581
Gustavo Machado Campagnani Gama authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/google-reader/tag.rb
View
14 lib/google-reader/tag.rb
@@ -36,6 +36,20 @@ def unshare
share(false)
end
+ def rename(new_label)
+ label or raise "trying to rename 'unlabeled' tag: \"#{id}\""
+ new_id = new_label.match(/\/label\//) ? new_label : self.class.build_id(new_label, client.user)
+ params = {
+ 's' => id, # current tag id
+ 't' => label, # the current tag label
+ 'dest' => new_id, # the new tag id
+ 'T' => client.token # the write-access token
+ }
+ resp = client.access_token.post('/reader/api/0/rename-tag', params)
+ resp.code_type == Net::HTTPOK or raise "unable to rename tag \"#{id}\": #{resp.inspect}"
+ id = new_id
+ end
+
def disable
params = {
's' => id, # the tag id
Please sign in to comment.
Something went wrong with that request. Please try again.