wikipedia-client 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +4 -0
- data/Rakefile +6 -6
- data/VERSION +1 -1
- data/lib/wikipedia.rb +3 -2
- data/lib/wikipedia/client.rb +4 -3
- data/lib/wikipedia/configuration.rb +1 -1
- data/lib/wikipedia/page.rb +1 -1
- data/spec/lib/client_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -2
- data/wikipedia-client.gemspec +59 -69
- metadata +39 -61
- data/.gitignore +0 -5
data/README.textile
CHANGED
@@ -7,6 +7,10 @@ Wikipedia API reference: "http://en.wikipedia.org/w/api.php":http://en.wikipedia
|
|
7
7
|
|
8
8
|
Adopted from: "http://code.google.com/p/wikipedia-client/":http://code.google.com/p/wikipedia-client/
|
9
9
|
|
10
|
+
h2. Installation
|
11
|
+
|
12
|
+
<pre><code>gem install wikipedia-client</code></pre>
|
13
|
+
|
10
14
|
h2. Examples
|
11
15
|
|
12
16
|
<pre><code>require 'wikipedia'
|
data/Rakefile
CHANGED
@@ -7,9 +7,9 @@ begin
|
|
7
7
|
gem.name = "wikipedia-client"
|
8
8
|
gem.summary = %Q{Ruby client for the Wikipedia API}
|
9
9
|
gem.description = %Q{Ruby client for the Wikipedia API}
|
10
|
-
gem.email = "
|
11
|
-
gem.homepage = "http://github.com/
|
12
|
-
gem.authors = ["Cyril David", "Ken Pratt"]
|
10
|
+
gem.email = "mike.haugland@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/mhaugland/wikipedia-client"
|
12
|
+
gem.authors = ["Cyril David", "Ken Pratt", "Mike Haugland"]
|
13
13
|
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
15
|
end
|
@@ -28,8 +28,8 @@ end
|
|
28
28
|
|
29
29
|
desc 'Test the wikipedia plugin.'
|
30
30
|
task :spec do
|
31
|
-
|
32
|
-
|
31
|
+
spec_path = File.expand_path(File.dirname(__FILE__) + '/spec/**/*.rb')
|
32
|
+
system("rspec -cfs #{spec_path}")
|
33
33
|
end
|
34
34
|
|
35
35
|
begin
|
@@ -49,7 +49,7 @@ task :spec => :check_dependencies
|
|
49
49
|
|
50
50
|
task :default => :spec
|
51
51
|
|
52
|
-
require '
|
52
|
+
require 'rdoc/task'
|
53
53
|
Rake::RDocTask.new do |rdoc|
|
54
54
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
55
55
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/lib/wikipedia.rb
CHANGED
data/lib/wikipedia/client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Wikipedia
|
2
2
|
class Client
|
3
3
|
# see http://en.wikipedia.org/w/api.php
|
4
|
-
BASE_URL = "
|
4
|
+
BASE_URL = ":protocol://:domain/:path?action=:action&format=json"
|
5
5
|
|
6
6
|
attr_accessor :follow_redirects
|
7
7
|
|
@@ -51,8 +51,9 @@ module Wikipedia
|
|
51
51
|
protected
|
52
52
|
def configuration_options
|
53
53
|
{
|
54
|
-
:
|
55
|
-
:
|
54
|
+
:protocol => Configuration[:protocol],
|
55
|
+
:domain => Configuration[:domain],
|
56
|
+
:path => Configuration[:path]
|
56
57
|
}
|
57
58
|
end
|
58
59
|
|
data/lib/wikipedia/page.rb
CHANGED
data/spec/lib/client_spec.rb
CHANGED
@@ -88,12 +88,12 @@ describe Wikipedia::Client, ".find page (Edsger_Dijkstra)" do
|
|
88
88
|
@client = Wikipedia::Client.new
|
89
89
|
@client.follow_redirects = false
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
it "should get a redirect when trying Edsger Dijkstra" do
|
93
93
|
@page = @client.find('Edsger Dijkstra')
|
94
94
|
@page.should be_redirect
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
it "should get a final page when follow_redirects is true" do
|
98
98
|
@client.follow_redirects = true
|
99
99
|
@page = @client.find('Edsger Dijkstra')
|
@@ -103,6 +103,6 @@ describe Wikipedia::Client, ".find page (Edsger_Dijkstra)" do
|
|
103
103
|
it "should collect the image urls" do
|
104
104
|
@client.follow_redirects = true
|
105
105
|
@page = @client.find('Edsger Dijkstra')
|
106
|
-
@page.image_urls.should == ["http://upload.wikimedia.org/wikipedia/commons/d/d9/Edsger_Wybe_Dijkstra.jpg"]
|
106
|
+
@page.image_urls.should == ["http://upload.wikimedia.org/wikipedia/commons/c/c9/Edsger_Dijkstra_1994.jpg", "http://upload.wikimedia.org/wikipedia/commons/d/d9/Edsger_Wybe_Dijkstra.jpg"]
|
107
107
|
end
|
108
108
|
end
|
data/spec/spec_helper.rb
CHANGED
data/wikipedia-client.gemspec
CHANGED
@@ -1,87 +1,77 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "1.
|
7
|
+
s.name = "wikipedia-client"
|
8
|
+
s.version = "1.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Cyril David", "Ken Pratt"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
11
|
+
s.authors = ["Cyril David", "Ken Pratt", "Mike Haugland"]
|
12
|
+
s.date = "2013-06-06"
|
13
|
+
s.description = "Ruby client for the Wikipedia API"
|
14
|
+
s.email = "mike.haugland@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.textile"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
"
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
"spec/fixtures/sanitization_samples/Velociraptor-sanitized.txt",
|
61
|
-
"spec/lib/client_spec.rb",
|
62
|
-
"spec/lib/sanitize_spec.rb",
|
63
|
-
"spec/lib/url_spec.rb",
|
64
|
-
"spec/lib/wikipedia_spec.rb",
|
65
|
-
"spec/spec_helper.rb",
|
66
|
-
"tasks/wikipedia_tasks.rake",
|
67
|
-
"uninstall.rb",
|
68
|
-
"wikipedia-client.gemspec"
|
69
|
-
]
|
70
|
-
s.homepage = %q{http://github.com/christianhellsten/wikipedia-client}
|
71
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
72
|
-
s.require_paths = ["lib"]
|
73
|
-
s.rubygems_version = %q{1.3.7}
|
74
|
-
s.summary = %q{Ruby client for the Wikipedia API}
|
75
|
-
s.test_files = [
|
19
|
+
"MIT-LICENSE",
|
20
|
+
"README.textile",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"init.rb",
|
24
|
+
"install.rb",
|
25
|
+
"lib/wikipedia.rb",
|
26
|
+
"lib/wikipedia/client.rb",
|
27
|
+
"lib/wikipedia/configuration.rb",
|
28
|
+
"lib/wikipedia/page.rb",
|
29
|
+
"lib/wikipedia/url.rb",
|
30
|
+
"script/add_sanitization_test",
|
31
|
+
"spec/fixtures/Edsger_Dijkstra.json",
|
32
|
+
"spec/fixtures/Edsger_Dijkstra.yaml",
|
33
|
+
"spec/fixtures/Edsger_Dijkstra_section_0.json",
|
34
|
+
"spec/fixtures/Edsger_content.txt",
|
35
|
+
"spec/fixtures/File_Edsger_Wybe_Dijkstra_jpg.json",
|
36
|
+
"spec/fixtures/sanitization_samples/Ceawlin_of_Wessex-raw.txt",
|
37
|
+
"spec/fixtures/sanitization_samples/Ceawlin_of_Wessex-sanitized.txt",
|
38
|
+
"spec/fixtures/sanitization_samples/Edsger_W_Dijkstra-raw.txt",
|
39
|
+
"spec/fixtures/sanitization_samples/Edsger_W_Dijkstra-sanitized.txt",
|
40
|
+
"spec/fixtures/sanitization_samples/Flower_video_game-raw.txt",
|
41
|
+
"spec/fixtures/sanitization_samples/Flower_video_game-sanitized.txt",
|
42
|
+
"spec/fixtures/sanitization_samples/How_to_Lose_Friends__Alienate_People_film-raw.txt",
|
43
|
+
"spec/fixtures/sanitization_samples/How_to_Lose_Friends__Alienate_People_film-sanitized.txt",
|
44
|
+
"spec/fixtures/sanitization_samples/Kirsten_Dunst-raw.txt",
|
45
|
+
"spec/fixtures/sanitization_samples/Kirsten_Dunst-sanitized.txt",
|
46
|
+
"spec/fixtures/sanitization_samples/Large_Hadron_Collider-raw.txt",
|
47
|
+
"spec/fixtures/sanitization_samples/Large_Hadron_Collider-sanitized.txt",
|
48
|
+
"spec/fixtures/sanitization_samples/Metro_Goldwyn_Mayer-raw.txt",
|
49
|
+
"spec/fixtures/sanitization_samples/Metro_Goldwyn_Mayer-sanitized.txt",
|
50
|
+
"spec/fixtures/sanitization_samples/Middle_Ages-raw.txt",
|
51
|
+
"spec/fixtures/sanitization_samples/Middle_Ages-sanitized.txt",
|
52
|
+
"spec/fixtures/sanitization_samples/SMS_Elbing-raw.txt",
|
53
|
+
"spec/fixtures/sanitization_samples/SMS_Elbing-sanitized.txt",
|
54
|
+
"spec/fixtures/sanitization_samples/Sashimi-raw.txt",
|
55
|
+
"spec/fixtures/sanitization_samples/Sashimi-sanitized.txt",
|
56
|
+
"spec/fixtures/sanitization_samples/Superb_Fairywren-raw.txt",
|
57
|
+
"spec/fixtures/sanitization_samples/Superb_Fairywren-sanitized.txt",
|
58
|
+
"spec/fixtures/sanitization_samples/Velociraptor-raw.txt",
|
59
|
+
"spec/fixtures/sanitization_samples/Velociraptor-sanitized.txt",
|
76
60
|
"spec/lib/client_spec.rb",
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
61
|
+
"spec/lib/sanitize_spec.rb",
|
62
|
+
"spec/lib/url_spec.rb",
|
63
|
+
"spec/lib/wikipedia_spec.rb",
|
64
|
+
"spec/spec_helper.rb",
|
65
|
+
"tasks/wikipedia_tasks.rake",
|
66
|
+
"uninstall.rb",
|
67
|
+
"wikipedia-client.gemspec"
|
81
68
|
]
|
69
|
+
s.homepage = "http://github.com/mhaugland/wikipedia-client"
|
70
|
+
s.require_paths = ["lib"]
|
71
|
+
s.rubygems_version = "1.8.23"
|
72
|
+
s.summary = "Ruby client for the Wikipedia API"
|
82
73
|
|
83
74
|
if s.respond_to? :specification_version then
|
84
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
85
75
|
s.specification_version = 3
|
86
76
|
|
87
77
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
metadata
CHANGED
@@ -1,48 +1,41 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: wikipedia-client
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
version: 1.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Cyril David
|
14
9
|
- Ken Pratt
|
10
|
+
- Mike Haugland
|
15
11
|
autorequire:
|
16
12
|
bindir: bin
|
17
13
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
date: 2013-06-06 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
23
17
|
name: thoughtbot-shoulda
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
26
19
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
version: "0"
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0'
|
34
24
|
type: :development
|
35
|
-
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
36
32
|
description: Ruby client for the Wikipedia API
|
37
|
-
email:
|
33
|
+
email: mike.haugland@gmail.com
|
38
34
|
executables: []
|
39
|
-
|
40
35
|
extensions: []
|
41
|
-
|
42
|
-
extra_rdoc_files:
|
36
|
+
extra_rdoc_files:
|
43
37
|
- README.textile
|
44
|
-
files:
|
45
|
-
- .gitignore
|
38
|
+
files:
|
46
39
|
- MIT-LICENSE
|
47
40
|
- README.textile
|
48
41
|
- Rakefile
|
@@ -92,43 +85,28 @@ files:
|
|
92
85
|
- tasks/wikipedia_tasks.rake
|
93
86
|
- uninstall.rb
|
94
87
|
- wikipedia-client.gemspec
|
95
|
-
|
96
|
-
homepage: http://github.com/christianhellsten/wikipedia-client
|
88
|
+
homepage: http://github.com/mhaugland/wikipedia-client
|
97
89
|
licenses: []
|
98
|
-
|
99
90
|
post_install_message:
|
100
|
-
rdoc_options:
|
101
|
-
|
102
|
-
require_paths:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
103
93
|
- lib
|
104
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
95
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
111
|
-
- 0
|
112
|
-
version: "0"
|
113
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
101
|
none: false
|
115
|
-
requirements:
|
116
|
-
- -
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
|
119
|
-
segments:
|
120
|
-
- 0
|
121
|
-
version: "0"
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
122
106
|
requirements: []
|
123
|
-
|
124
107
|
rubyforge_project:
|
125
|
-
rubygems_version: 1.
|
108
|
+
rubygems_version: 1.8.23
|
126
109
|
signing_key:
|
127
110
|
specification_version: 3
|
128
111
|
summary: Ruby client for the Wikipedia API
|
129
|
-
test_files:
|
130
|
-
- spec/lib/client_spec.rb
|
131
|
-
- spec/lib/sanitize_spec.rb
|
132
|
-
- spec/lib/url_spec.rb
|
133
|
-
- spec/lib/wikipedia_spec.rb
|
134
|
-
- spec/spec_helper.rb
|
112
|
+
test_files: []
|