wikipedia-client 1.5.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a004902819ad84ccbc3ca0abb7253ccf811d2df3
4
- data.tar.gz: f41e4764b27e5707e7ba315cae7eaa51dd69ae47
3
+ metadata.gz: 090668f5915b9abd761c0fe9d56c78fbe0256ce2
4
+ data.tar.gz: 1dd3784a3b1037bd339276aeaeca838cbc173706
5
5
  SHA512:
6
- metadata.gz: 94ca09a3b557ca17b39ad0288dbadf60fcc970eb52b8bb3def90ce5815b3a0aa3fd0ab228f409c39a257988d235bc98b303d5b19de1198235aaaf2fb32adfcb9
7
- data.tar.gz: 4e2b577bf5ed9825712e917937468ceb6dce2caaf42a58734a96d8d1aa41cd2bdda4e0e526cbe442418983ee5a4c336a2b6ec736780cd978fef677e3a1f38d0f
6
+ metadata.gz: 17c3a86c983353487bd6a6b8b03ef8f77977c8c33b7637da09c277019e13c32132560bb688b46fb64a777b901406ea85b652b34df103665e432fd94afc897898
7
+ data.tar.gz: 7b01485a0265a17092e0f4215772206db97b9cb73760d8b040e8be29cde7ed646f3154c57e1cf8bd5d0057e695290768c153797e6c86f58c9b1bfdb1bcde22af
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wikipedia-client (1.4.0)
4
+ wikipedia-client (1.6.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.textile CHANGED
@@ -36,6 +36,10 @@ page.content
36
36
 
37
37
  => # all the wiki markup appears here...
38
38
 
39
+ page.summary
40
+
41
+ => # only the wiki summary appears here...
42
+
39
43
  page.categories
40
44
 
41
45
  => [..., "Category:Self-help books", ...]
@@ -117,7 +121,7 @@ Build the gem: <code>bundle exec gem build wikipedia-client.gemspec</code>
117
121
 
118
122
  Commit the changes: <code>git commit -a -m 'Version bump to 1.4.0' && git push</code>
119
123
 
120
- Publish the resurt to RubyGems: <code>bundle exec gem push wikipedia-client-1.4.0.gem</code>
124
+ Publish the result to RubyGems: <code>bundle exec gem push wikipedia-client-1.4.0.gem</code>
121
125
 
122
126
  h2. Thanks!
123
127
 
@@ -44,6 +44,10 @@ module Wikipedia
44
44
  page['extract']
45
45
  end
46
46
 
47
+ def summary
48
+ s = (page['extract'].split(pattern="=="))[0].strip
49
+ end
50
+
47
51
  def categories
48
52
  page['categories'].map {|c| c['title'] } if page['categories']
49
53
  end
@@ -1,3 +1,3 @@
1
1
  module Wikipedia
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.1"
3
3
  end
@@ -113,7 +113,7 @@ describe Wikipedia::Client, ".find page (Edsger_Dijkstra)" do
113
113
  it "should collect the image urls" do
114
114
  @client.follow_redirects = true
115
115
  @page = @client.find('Edsger Dijkstra')
116
- @page.image_urls.should == ["https://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg", "https://upload.wikimedia.org/wikipedia/commons/c/c9/Edsger_Dijkstra_1994.jpg", "https://upload.wikimedia.org/wikipedia/commons/d/d9/Edsger_Wybe_Dijkstra.jpg", "https://upload.wikimedia.org/wikipedia/en/4/48/Folder_Hexagonal_Icon.svg", "https://upload.wikimedia.org/wikipedia/commons/2/21/Speaker_Icon.svg", "https://upload.wikimedia.org/wikipedia/commons/f/fa/Wikiquote-logo.svg"]
116
+ @page.image_urls.should == ["https://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg", "https://upload.wikimedia.org/wikipedia/commons/5/57/Dijkstra_Animation.gif", "https://upload.wikimedia.org/wikipedia/commons/6/6a/Dining_philosophers.png", "https://upload.wikimedia.org/wikipedia/commons/c/c9/Edsger_Dijkstra_1994.jpg", "https://upload.wikimedia.org/wikipedia/commons/d/d9/Edsger_Wybe_Dijkstra.jpg", "https://upload.wikimedia.org/wikipedia/en/4/48/Folder_Hexagonal_Icon.svg", "https://upload.wikimedia.org/wikipedia/commons/7/7b/Rail-semaphore-signal-Dave-F.jpg", "https://upload.wikimedia.org/wikipedia/commons/2/21/Speaker_Icon.svg", "https://upload.wikimedia.org/wikipedia/commons/f/fa/Wikiquote-logo.svg"]
117
117
  end
118
118
  end
119
119
 
@@ -147,3 +147,18 @@ describe Wikipedia::Client, ".find random page" do
147
147
  @page1.should_not == @page2
148
148
  end
149
149
  end
150
+
151
+ describe Wikipedia::Client, "page.summary (mocked)" do
152
+ before(:each) do
153
+ @client = Wikipedia::Client.new
154
+ @edsger_dijkstra = File.read(File.dirname(__FILE__) + '/../fixtures/Edsger_Dijkstra.json')
155
+ @edsger_content = JSON::load(File.read(File.dirname(__FILE__) + '/../fixtures/Edsger_content.txt'))['content']
156
+ @client.should_receive(:request).and_return(@edsger_dijkstra)
157
+ end
158
+
159
+ it "should return only the summary" do
160
+ @page = @client.find('Edsger_Dijkstra')
161
+ @page.summary.should == 'Edsger Wybe Dijkstra (Dutch pronunciation: [ˈɛtsxər ˈʋibə ˈdɛikstra] ( ); 11 May 1930 – 6 August 2002) was a Dutch computer scientist. He received the 1972 Turing Award for fundamental contributions to developing programming languages, and was the Schlumberger Centennial Chair of Computer Sciences at The University of Texas at Austin from 1984 until 2000.
162
+ Shortly before his death in 2002, he received the ACM PODC Influential Paper Award in distributed computing for his work on self-stabilization of program computation. This annual award was renamed the Dijkstra Prize the following year, in his honor.'
163
+ end
164
+ end
@@ -10,7 +10,7 @@ spec = Gem::Specification.new do |s|
10
10
 
11
11
  s.license = 'MIT'
12
12
  s.authors = ["Cyril David", "Ken Pratt", "Mike Haugland", "Aishwarya Subramanian", "Pietro Menna", "Sophie Rapoport"]
13
- s.date = "2015-06-25"
13
+ s.date = "2016-01-03"
14
14
  s.description = "Ruby client for the Wikipedia API"
15
15
  s.email = "ken@kenpratt.net"
16
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikipedia-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril David
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-06-25 00:00:00.000000000 Z
16
+ date: 2016-01-03 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rake
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  requirements: []
172
172
  rubyforge_project:
173
- rubygems_version: 2.4.6
173
+ rubygems_version: 2.4.5.1
174
174
  signing_key:
175
175
  specification_version: 3
176
176
  summary: Ruby client for the Wikipedia API