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 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(entry_google_id)
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.0
1
+ 0.4.1
data/grapi.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{grapi}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aurelian Oancea"]
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}.slice(999).each do | slice |
45
- post_with_token "http://www.google.com/reader/api/0/edit-tag", {"i" => slice, "a" => "user/-/state/com.google/read"}
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aurelian Oancea