wikipedia-client 1.0.0 → 1.1.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/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 = "christian.hellsten@gmail.com"
11
- gem.homepage = "http://github.com/christianhellsten/wikipedia-client"
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
- spec_path = File.expand_path(File.dirname(__FILE__) + '/spec/**/*.rb')
32
- system("spec -cfs #{spec_path}")
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 'rake/rdoctask'
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.0.0
1
+ 1.1.0
data/lib/wikipedia.rb CHANGED
@@ -25,8 +25,9 @@ module Wikipedia
25
25
  end
26
26
 
27
27
  Configure {
28
- domain 'en.wikipedia.org'
29
- path 'w/api.php'
28
+ protocol 'http'
29
+ domain 'en.wikipedia.org'
30
+ path 'w/api.php'
30
31
  }
31
32
 
32
33
  private
@@ -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 = "http://:domain/:path?action=:action&format=json"
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
- :domain => Configuration[:domain],
55
- :path => Configuration[:path]
54
+ :protocol => Configuration[:protocol],
55
+ :domain => Configuration[:domain],
56
+ :path => Configuration[:path]
56
57
  }
57
58
  end
58
59
 
@@ -20,6 +20,6 @@ module Wikipedia
20
20
  instance.send(directive)
21
21
  end
22
22
 
23
- directives :domain, :path
23
+ directives :protocol, :domain, :path
24
24
  end
25
25
  end
@@ -11,7 +11,7 @@ module Wikipedia
11
11
  end
12
12
 
13
13
  def content
14
- page['revisions'].first.values.first if page['revisions']
14
+ page['revisions'].first['*'] if page['revisions']
15
15
  end
16
16
 
17
17
  def sanitized_content
@@ -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
@@ -1,4 +1,4 @@
1
1
  require 'rubygems'
2
- require 'spec'
2
+ require 'rspec'
3
3
 
4
- require File.dirname(__FILE__) + '/../lib/wikipedia'
4
+ require File.dirname(__FILE__) + '/../lib/wikipedia'
@@ -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 the gemspec command
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 = %q{wikipedia-client}
8
- s.version = "1.0.0"
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 = %q{2010-08-09}
13
- s.description = %q{Ruby client for the Wikipedia API}
14
- s.email = %q{christian.hellsten@gmail.com}
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
- ".gitignore",
20
- "MIT-LICENSE",
21
- "README.textile",
22
- "Rakefile",
23
- "VERSION",
24
- "init.rb",
25
- "install.rb",
26
- "lib/wikipedia.rb",
27
- "lib/wikipedia/client.rb",
28
- "lib/wikipedia/configuration.rb",
29
- "lib/wikipedia/page.rb",
30
- "lib/wikipedia/url.rb",
31
- "script/add_sanitization_test",
32
- "spec/fixtures/Edsger_Dijkstra.json",
33
- "spec/fixtures/Edsger_Dijkstra.yaml",
34
- "spec/fixtures/Edsger_Dijkstra_section_0.json",
35
- "spec/fixtures/Edsger_content.txt",
36
- "spec/fixtures/File_Edsger_Wybe_Dijkstra_jpg.json",
37
- "spec/fixtures/sanitization_samples/Ceawlin_of_Wessex-raw.txt",
38
- "spec/fixtures/sanitization_samples/Ceawlin_of_Wessex-sanitized.txt",
39
- "spec/fixtures/sanitization_samples/Edsger_W_Dijkstra-raw.txt",
40
- "spec/fixtures/sanitization_samples/Edsger_W_Dijkstra-sanitized.txt",
41
- "spec/fixtures/sanitization_samples/Flower_video_game-raw.txt",
42
- "spec/fixtures/sanitization_samples/Flower_video_game-sanitized.txt",
43
- "spec/fixtures/sanitization_samples/How_to_Lose_Friends__Alienate_People_film-raw.txt",
44
- "spec/fixtures/sanitization_samples/How_to_Lose_Friends__Alienate_People_film-sanitized.txt",
45
- "spec/fixtures/sanitization_samples/Kirsten_Dunst-raw.txt",
46
- "spec/fixtures/sanitization_samples/Kirsten_Dunst-sanitized.txt",
47
- "spec/fixtures/sanitization_samples/Large_Hadron_Collider-raw.txt",
48
- "spec/fixtures/sanitization_samples/Large_Hadron_Collider-sanitized.txt",
49
- "spec/fixtures/sanitization_samples/Metro_Goldwyn_Mayer-raw.txt",
50
- "spec/fixtures/sanitization_samples/Metro_Goldwyn_Mayer-sanitized.txt",
51
- "spec/fixtures/sanitization_samples/Middle_Ages-raw.txt",
52
- "spec/fixtures/sanitization_samples/Middle_Ages-sanitized.txt",
53
- "spec/fixtures/sanitization_samples/SMS_Elbing-raw.txt",
54
- "spec/fixtures/sanitization_samples/SMS_Elbing-sanitized.txt",
55
- "spec/fixtures/sanitization_samples/Sashimi-raw.txt",
56
- "spec/fixtures/sanitization_samples/Sashimi-sanitized.txt",
57
- "spec/fixtures/sanitization_samples/Superb_Fairywren-raw.txt",
58
- "spec/fixtures/sanitization_samples/Superb_Fairywren-sanitized.txt",
59
- "spec/fixtures/sanitization_samples/Velociraptor-raw.txt",
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
- "spec/lib/sanitize_spec.rb",
78
- "spec/lib/url_spec.rb",
79
- "spec/lib/wikipedia_spec.rb",
80
- "spec/spec_helper.rb"
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
- hash: 23
5
- prerelease: false
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
- date: 2010-08-09 00:00:00 +03:00
20
- default_executable:
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
- prerelease: false
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
- hash: 3
31
- segments:
32
- - 0
33
- version: "0"
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
34
24
  type: :development
35
- version_requirements: *id001
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: christian.hellsten@gmail.com
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
- has_rdoc: true
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
- - --charset=UTF-8
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
- hash: 3
110
- segments:
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
- hash: 3
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.3.7
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: []
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- *.swp
2
- *.tmp
3
- *.log
4
- pkg/*
5
-