DRMacIver-gourmand 0.0.9 → 0.0.10
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/VERSION +1 -1
- data/gourmand.gemspec +3 -2
- data/lib/googlereader.rb +47 -0
- data/lib/gourmand.rb +4 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.10
|
data/gourmand.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{gourmand}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.10"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["David R. MacIver"]
|
9
|
-
s.date = %q{2009-08-
|
9
|
+
s.date = %q{2009-08-17}
|
10
10
|
s.default_executable = %q{gourmand}
|
11
11
|
s.email = %q{david.maciver@gmail.com}
|
12
12
|
s.executables = ["gourmand"]
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
"bin/gourmand",
|
24
24
|
"gourmand.gemspec",
|
25
25
|
"lib/delicious.rb",
|
26
|
+
"lib/googlereader.rb",
|
26
27
|
"lib/gourmand.rb",
|
27
28
|
"lib/post.rb",
|
28
29
|
"lib/reddit.rb",
|
data/lib/googlereader.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require "open-uri"
|
2
|
+
require "rubygems"
|
3
|
+
require "nokogiri"
|
4
|
+
|
5
|
+
class GoogleReader < Site
|
6
|
+
def self.scrape_link_from_profile(profile)
|
7
|
+
Nokogiri(open(profile)).search("link[rel='alternate']")[0]["href"]
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialise(gourmand)
|
11
|
+
super
|
12
|
+
@gourmand = gourmand
|
13
|
+
end
|
14
|
+
|
15
|
+
def name
|
16
|
+
"google-reader"
|
17
|
+
end
|
18
|
+
|
19
|
+
def update!
|
20
|
+
balance
|
21
|
+
|
22
|
+
feed = Nokogiri(open(credentials["url"]))
|
23
|
+
|
24
|
+
entries = feed.search("entry")
|
25
|
+
|
26
|
+
new_posts = entries.map{|x| {
|
27
|
+
"description" => x.search("title")[0].text,
|
28
|
+
"url" => x.search("link")[0]["href"],
|
29
|
+
"tag" => x.search("category").text + " via:google-reader",
|
30
|
+
"dt" => x.search("published").text
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
@posts += new_posts
|
35
|
+
|
36
|
+
@posts.
|
37
|
+
select{|x| !@ids.include?(x["url"])}.
|
38
|
+
map{|x| to_post(x)}
|
39
|
+
end
|
40
|
+
|
41
|
+
def ask_for_credentials
|
42
|
+
puts "URL of google reader shared links:"
|
43
|
+
url = STDIN.gets.strip
|
44
|
+
url = GoogleReader.scrape_link_from_profile(url) unless url =~ /atom/
|
45
|
+
self.credentials = {"url" => url}
|
46
|
+
end
|
47
|
+
end
|
data/lib/gourmand.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: DRMacIver-gourmand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David R. MacIver
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-17 00:00:00 -07:00
|
13
13
|
default_executable: gourmand
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- bin/gourmand
|
71
71
|
- gourmand.gemspec
|
72
72
|
- lib/delicious.rb
|
73
|
+
- lib/googlereader.rb
|
73
74
|
- lib/gourmand.rb
|
74
75
|
- lib/post.rb
|
75
76
|
- lib/reddit.rb
|