gscholar 0.1.3 → 0.1.4

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: bd34a4f6359401e63d32a8dd3159a779aa3c22f4
4
- data.tar.gz: c32e9db22b0202a768154dda78bf03a7f25bd476
3
+ metadata.gz: a928bc754b26578753527fde89ad8c7b502e11ce
4
+ data.tar.gz: e43c195709f89aefdf22a0c406cd9f9cdcea6dc0
5
5
  SHA512:
6
- metadata.gz: b60061252434e68a3d7f96a450ac3dd27906f53f53e4405980ec5edc0b7bf5b21c40d938885992cbd0749481d54d686e6fd1e8077a318a911f024fd9320bac41
7
- data.tar.gz: ca965b3d5a4c89e42e8a65699af4e9b459c2cee2bc08ebdc2ae1de31ea4548af6f59cb381eaa08219989a6d744d9a5081befa311ec975399dcd6746df8ac03b8
6
+ metadata.gz: 3e8b65a227ed1d91e9b7ec3ac48b4dbb9a2f36b6178e211510e1bcb7ed798091462ae4374c5a9f96ad0786e230ed3b6f3fc11e4842008f66f27ca6cf73bcc9c4
7
+ data.tar.gz: 4ae1dc7288ba7bbe244b63159bf3317c749fce27bb25961f4baf07db1a02326d5704f1dd5b3cf44c1d85eff09dd4c15ea5f4b0c0f37fc323e1828c644a4c10f6
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/gscholar.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "gscholar"
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Zifei Tong"]
data/lib/gscholar.rb CHANGED
@@ -1,9 +1,3 @@
1
1
  require 'gscholar/utils'
2
2
  require 'gscholar/citation'
3
3
  require 'gscholar/paper'
4
-
5
- module GScholar
6
- def self.reset
7
- Utils.reset_fetcher
8
- end
9
- end
@@ -8,9 +8,5 @@ module GScholar
8
8
  @fetcher ||= Fetcher.new
9
9
  @fetcher.fetch(url)
10
10
  end
11
-
12
- def self.reset_fetcher
13
- @fetcher = nil
14
- end
15
11
  end
16
12
  end
@@ -18,7 +18,17 @@ module GScholar
18
18
  end
19
19
 
20
20
  def fetch(url)
21
- @cache[url] ||= @agent.get(url)
21
+ begin
22
+ @cache[url] ||= @agent.get(url)
23
+ rescue Mechanize::ResponseCodeError => e
24
+ case e.response_code
25
+ when 403
26
+ @agent.reset
27
+ retry
28
+ else
29
+ raise
30
+ end
31
+ end
22
32
  end
23
33
  end
24
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gscholar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zifei Tong