grapi 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +1 -1
- data/VERSION +1 -1
- data/grapi.gemspec +1 -1
- data/lib/grapi/reader.rb +7 -2
- metadata +1 -1
data/README.textile
CHANGED
@@ -32,7 +32,7 @@ Public API:
|
|
32
32
|
* reading_list(:continuation => nil, :dump_data => false, :output => "atom/json")
|
33
33
|
* subscribe(feed_url, label=test)
|
34
34
|
* unsubscribe(feed_url)
|
35
|
-
* mark_as_read(
|
35
|
+
* mark_as_read( entry_google_ids ) # can pass an entry id or an array of entries id
|
36
36
|
|
37
37
|
Protected API:
|
38
38
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/grapi.gemspec
CHANGED
data/lib/grapi/reader.rb
CHANGED
@@ -2,6 +2,8 @@ require 'curl'
|
|
2
2
|
|
3
3
|
module Grapi
|
4
4
|
|
5
|
+
class Error < StandardError;end
|
6
|
+
|
5
7
|
class Reader
|
6
8
|
|
7
9
|
VERSION = File.read(File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "VERSION"))).strip
|
@@ -41,8 +43,11 @@ module Grapi
|
|
41
43
|
end
|
42
44
|
|
43
45
|
def mark_as_read(entry_ids)
|
44
|
-
Array(entry_ids).map{|e|e.to_s}
|
45
|
-
|
46
|
+
ids = Array(entry_ids).map{|e|e.to_s}
|
47
|
+
while ids.size>0
|
48
|
+
ids_to_post= ids.slice!(0,250)
|
49
|
+
post_with_token "http://www.google.com/reader/api/0/edit-tag", {"i" => ids_to_post, "a" => "user/-/state/com.google/read"}
|
50
|
+
raise Grapi::Error.new("Failed to mark as read!\n#{@client.body_str}") if @client.response_code == 400
|
46
51
|
end
|
47
52
|
self
|
48
53
|
end
|