GoogleReaderApi 0.3.6 → 0.4.0
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/GoogleReaderApi.gemspec +10 -10
- data/README.mdown +13 -2
- data/VERSION +1 -1
- data/lib/google-reader-api/api.rb +1 -2
- data/lib/google-reader-api/feed.rb +18 -18
- metadata +4 -3
data/GoogleReaderApi.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.
|
7
|
+
s.name = "GoogleReaderApi"
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
11
|
+
s.authors = ["Toon Willems"]
|
12
|
+
s.date = "2012-07-03"
|
13
|
+
s.description = "a google reader api (unofficial) written in ruby"
|
14
|
+
s.email = "willemstoon@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.mdown"
|
17
17
|
]
|
@@ -31,10 +31,10 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/google-reader-api/user.rb",
|
32
32
|
"lib/google_reader_api.rb"
|
33
33
|
]
|
34
|
-
s.homepage =
|
35
|
-
s.require_paths = [
|
36
|
-
s.rubygems_version =
|
37
|
-
s.summary =
|
34
|
+
s.homepage = "http://github.com/nudded/GoogleReaderAPI"
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = "1.8.11"
|
37
|
+
s.summary = "a google reader api (unofficial) written in ruby"
|
38
38
|
|
39
39
|
if s.respond_to? :specification_version then
|
40
40
|
s.specification_version = 3
|
data/README.mdown
CHANGED
@@ -10,7 +10,13 @@ Usage
|
|
10
10
|
If you would like to implement your own methods, you can quite easily use
|
11
11
|
the api class provided.
|
12
12
|
|
13
|
-
api = GoogleReaderApi::Api.new email, pass
|
13
|
+
api = GoogleReaderApi::Api.new {:email => 'example@gmail.com', :password => 'the pass'}
|
14
|
+
|
15
|
+
# OR
|
16
|
+
|
17
|
+
api = GoogleReaderApi::Api.new {:auth => 'token'}
|
18
|
+
|
19
|
+
|
14
20
|
|
15
21
|
and then you can perform requests using the `get_link` and `post_link` methods.
|
16
22
|
|
@@ -25,7 +31,12 @@ involved.
|
|
25
31
|
|
26
32
|
# password should be asked by the app using the api
|
27
33
|
# you probably don't want to type that in cleartext here
|
28
|
-
user = GoogleReaderApi::User.new '
|
34
|
+
user = GoogleReaderApi::User.new {:email => 'example@gmail.com', :password => 'the pass'}
|
35
|
+
|
36
|
+
# OR
|
37
|
+
|
38
|
+
user = GoogleReaderApi::User.new {:auth => 'token'}
|
39
|
+
|
29
40
|
|
30
41
|
you can access your feeds from there
|
31
42
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -8,6 +8,7 @@ module GoogleReaderApi
|
|
8
8
|
|
9
9
|
BASE_URL = "http://www.google.com/reader/"
|
10
10
|
|
11
|
+
|
11
12
|
# specify either the :email and :password or the :auth token you got in the past
|
12
13
|
#
|
13
14
|
# [:email] the user's email address for login purposes
|
@@ -41,8 +42,6 @@ module GoogleReaderApi
|
|
41
42
|
@cache['unread-count'] ||= get_link 'api/0/unread-count', :output => :json
|
42
43
|
end
|
43
44
|
|
44
|
-
private
|
45
|
-
|
46
45
|
# url as a string
|
47
46
|
# the post data as a hash
|
48
47
|
def post_request(url,args)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module GoogleReaderApi
|
2
|
-
|
2
|
+
|
3
3
|
class Feed
|
4
|
-
|
4
|
+
|
5
5
|
include GoogleReaderApi::RssUtils
|
6
|
-
|
7
|
-
attr_reader :url, :title
|
8
|
-
|
6
|
+
|
7
|
+
attr_reader :url, :title, :api, :sortid, :categories, :firstitemmsec
|
8
|
+
|
9
9
|
def initialize(hash,api)
|
10
10
|
# strip the first 5 characters of the url (they are 'feed/')
|
11
11
|
@url = hash['id'][5..-1]
|
@@ -14,60 +14,60 @@ module GoogleReaderApi
|
|
14
14
|
@sortid = hash['sortid']
|
15
15
|
@categories = hash['categories']
|
16
16
|
@firstitemmsec = hash['firstitemmsec']
|
17
|
-
|
17
|
+
|
18
18
|
@api = api
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def unsubscribe
|
22
22
|
@api.post_link 'api/0/subscription/edit' , :s => "feed/#{url}",
|
23
23
|
:ac => :unsubscribe
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def unread_count
|
27
27
|
entry = JSON[@api.cached_unread_count]['unreadcounts'].find {|h| h['id'] == "feed/#{url}"}
|
28
28
|
entry ? entry['count'] : 0
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
# return count read items
|
32
32
|
def read_items(count=20)
|
33
33
|
create_entries get_user_items('read',:n => count)
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
def starred_items(count=20)
|
37
37
|
create_entries get_user_items('starred',:n => count)
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
# return the number of specified items. (read or not)
|
41
41
|
def items(count = 20)
|
42
42
|
create_entries get_feed_items(:n => count)
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
# return all the unread items in an array
|
46
46
|
def all_unread_items
|
47
47
|
unread_count > 0 ? unread_items(unread_count) : []
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
# will return an array of GoogleReader::Feed::Entry objects.
|
51
51
|
# will try to return the amount of unread items you specify. unless there are no more.
|
52
52
|
# will return 20 unread items by default.
|
53
53
|
def unread_items(count = 20)
|
54
54
|
create_entries get_feed_items(:n => count,:xt => 'user/-/state/com.google/read')
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
def inspect
|
58
58
|
to_s
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
def to_s
|
62
62
|
"<<Feed: #{title} url:#{url}>>"
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
private
|
66
|
-
|
66
|
+
|
67
67
|
def get_user_items(state,args={})
|
68
68
|
@api.get_link "atom/user/-/state/com.google/#{state}" , args
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
def get_feed_items(args={})
|
72
72
|
@api.get_link "atom/feed/#{url}" , args
|
73
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: GoogleReaderApi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-07-03 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: a google reader api (unofficial) written in ruby
|
15
15
|
email: willemstoon@gmail.com
|
@@ -52,8 +52,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
version: '0'
|
53
53
|
requirements: []
|
54
54
|
rubyforge_project:
|
55
|
-
rubygems_version: 1.8.
|
55
|
+
rubygems_version: 1.8.11
|
56
56
|
signing_key:
|
57
57
|
specification_version: 3
|
58
58
|
summary: a google reader api (unofficial) written in ruby
|
59
59
|
test_files: []
|
60
|
+
has_rdoc:
|