google_reader 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/README.textile +4 -0
- data/google_reader.gemspec +0 -1
- data/lib/google_reader/client.rb +2 -1
- data/lib/google_reader/entry.rb +12 -5
- data/lib/google_reader/source.rb +11 -0
- data/lib/google_reader/version.rb +1 -1
- data/lib/google_reader.rb +1 -0
- data/spec/entry_spec.rb +1 -0
- data/spec/spec_helper.rb +6 -0
- metadata +26 -12
data/.gitignore
CHANGED
data/README.textile
CHANGED
data/google_reader.gemspec
CHANGED
data/lib/google_reader/client.rb
CHANGED
@@ -39,7 +39,8 @@ module GoogleReader
|
|
39
39
|
tracking-body-link-used).each do |suffix|
|
40
40
|
|
41
41
|
method_name = suffix.gsub("-", "_") + "_items"
|
42
|
-
define_method(method_name) do |
|
42
|
+
define_method(method_name) do |*args|
|
43
|
+
count = args.first || 20
|
43
44
|
content = RestClient.get(STATE_URL + suffix + "?n=#{CGI.escape(count.to_s)}", headers)
|
44
45
|
parse_atom_feed(content)
|
45
46
|
end
|
data/lib/google_reader/entry.rb
CHANGED
@@ -13,7 +13,11 @@ module GoogleReader
|
|
13
13
|
|
14
14
|
def original_id
|
15
15
|
oid_node = id_node.attribute_with_ns("original-id", GOOGLE_ATOM_NAMESPACE)
|
16
|
-
|
16
|
+
return self.id if oid_node.nil?
|
17
|
+
|
18
|
+
# Cater to JRuby + libffi
|
19
|
+
return self.id if oid_node.respond_to?(:null?) && oid_node.null?
|
20
|
+
oid_node.text
|
17
21
|
end
|
18
22
|
|
19
23
|
def title
|
@@ -50,6 +54,9 @@ module GoogleReader
|
|
50
54
|
return false unless node
|
51
55
|
attr = node.attribute_with_ns("unknown-author", GOOGLE_ATOM_NAMESPACE)
|
52
56
|
return true unless attr
|
57
|
+
|
58
|
+
# Cater to JRuby + libffi
|
59
|
+
return true if attr.respond_to?(:null?) && attr.null?
|
53
60
|
attr.text != "true"
|
54
61
|
end
|
55
62
|
|
@@ -59,10 +66,10 @@ module GoogleReader
|
|
59
66
|
|
60
67
|
def source
|
61
68
|
node = @entry.search("source").first
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
69
|
+
Source.new(:title => unhtml(node.search("title").first.text),
|
70
|
+
:href => node.search("link[rel=alternate]").first["href"],
|
71
|
+
:id => node.search("id").first.text,
|
72
|
+
:stream_id => node.attribute_with_ns("stream-id", GOOGLE_ATOM_NAMESPACE).text)
|
66
73
|
end
|
67
74
|
|
68
75
|
def liking_users
|
data/lib/google_reader.rb
CHANGED
data/spec/entry_spec.rb
CHANGED
@@ -34,6 +34,7 @@ describe GoogleReader::Entry, "where the author is known, and the updated timest
|
|
34
34
|
it { subject.href.should == "http://www.depesz.com/index.php/2011/04/27/find-cheapest-combination-of-rooms-in-hotels/" }
|
35
35
|
it { subject.should have_known_author }
|
36
36
|
it { subject.author.should == "depesz" }
|
37
|
+
it { subject.source.should_not be_nil }
|
37
38
|
it { subject.source.id.should == "tag:google.com,2005:reader/feed/http://www.depesz.com/index.php/feed/" }
|
38
39
|
it { subject.source.href == "http://www.depesz.com" }
|
39
40
|
it { subject.id.should == "tag:google.com,2005:reader/item/d5dee0c34e012ddb" }
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- "Fran\xC3\xA7ois Beausoleil"
|
@@ -21,6 +26,11 @@ dependencies:
|
|
21
26
|
requirements:
|
22
27
|
- - ~>
|
23
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 6
|
33
|
+
- 1
|
24
34
|
version: 1.6.1
|
25
35
|
type: :runtime
|
26
36
|
version_requirements: *id001
|
@@ -32,6 +42,11 @@ dependencies:
|
|
32
42
|
requirements:
|
33
43
|
- - ~>
|
34
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 15
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 4
|
49
|
+
- 4
|
35
50
|
version: 1.4.4
|
36
51
|
type: :runtime
|
37
52
|
version_requirements: *id002
|
@@ -43,20 +58,12 @@ dependencies:
|
|
43
58
|
requirements:
|
44
59
|
- - ">="
|
45
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
62
|
+
segments:
|
63
|
+
- 0
|
46
64
|
version: "0"
|
47
65
|
type: :development
|
48
66
|
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: ruby-debug19
|
51
|
-
prerelease: false
|
52
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: "0"
|
58
|
-
type: :development
|
59
|
-
version_requirements: *id004
|
60
67
|
description: Access Google Reader in a quick and simple way, using plain Ruby.
|
61
68
|
email:
|
62
69
|
- francois@teksol.info
|
@@ -76,6 +83,7 @@ files:
|
|
76
83
|
- lib/google_reader.rb
|
77
84
|
- lib/google_reader/client.rb
|
78
85
|
- lib/google_reader/entry.rb
|
86
|
+
- lib/google_reader/source.rb
|
79
87
|
- lib/google_reader/version.rb
|
80
88
|
- spec/client_spec.rb
|
81
89
|
- spec/entry_spec.rb
|
@@ -98,12 +106,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
106
|
requirements:
|
99
107
|
- - ">="
|
100
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
110
|
+
segments:
|
111
|
+
- 0
|
101
112
|
version: "0"
|
102
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
114
|
none: false
|
104
115
|
requirements:
|
105
116
|
- - ">="
|
106
117
|
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
119
|
+
segments:
|
120
|
+
- 0
|
107
121
|
version: "0"
|
108
122
|
requirements: []
|
109
123
|
|