arxiv 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: 28d18456ea242c15b1dcfb9216e6fe93b5271d25
4
- data.tar.gz: fbffc28c0bc8fc57ede996873fa1c59a71b61934
3
+ metadata.gz: 6b3c270215d3c9b3813d3c92d9c10d2c170a3881
4
+ data.tar.gz: a739179d013070d32ad37e6f78a6c413858c85c2
5
5
  SHA512:
6
- metadata.gz: 1155e2e5584f27b1d108aefbaa2bf8f9049fef96b65b0b09fee3407147a3ea8fa9bd90942703b507989c25ee66d91c5802fbcebc340152cdd645d1d77ff48ddc
7
- data.tar.gz: ce62f4b9e4d0625c4aae1c364af50cb0905bb81468fc191848806da85308569342f9a29d8875d9286b9573d9066fcaf35379b38d48c6f7e04c7445a786012e58
6
+ metadata.gz: f6c947d476518316af35c3ae69e80dde43d382803c8848db0a2eeddbe88a72302d00d63a9b7045db9775241592e9dfe85e100a5a15de098cb9958b159ebe7892
7
+ data.tar.gz: 31ede1191b470074922d30d6e3281cb2e06867d3990c0e1dd7b9ab52c3e34284645a65beb66d0d0c0b722d2e268610c1287d851951f44277a1dd07672f6fe8bf
@@ -19,8 +19,8 @@ module Arxiv
19
19
 
20
20
  # In 2007, the ArXiv API changed document ID formats:
21
21
  #
22
- # http://arxiv.org/abs/math/0510097v1 (legacy)
23
- # http://arxiv.org/abs/1202.0819v1 (current)
22
+ # https://arxiv.org/abs/math/0510097v1 (legacy)
23
+ # https://arxiv.org/abs/1202.0819v1 (current)
24
24
  #
25
25
  # These constants help us deal with both use cases.
26
26
  #
@@ -45,8 +45,6 @@ module Arxiv
45
45
  manuscript
46
46
  end
47
47
 
48
- private
49
-
50
48
  def self.parse_arxiv_identifier(identifier)
51
49
  if valid_id?(identifier)
52
50
  identifier
@@ -57,16 +55,20 @@ module Arxiv
57
55
  identifier # probably an error
58
56
  end
59
57
  end
58
+ private_class_method :parse_arxiv_identifier
60
59
 
61
60
  def self.valid_id?(identifier)
62
61
  identifier =~ ID_FORMAT || identifier =~ LEGACY_ID_FORMAT
63
62
  end
63
+ private_class_method :valid_id?
64
64
 
65
65
  def self.valid_url?(identifier)
66
66
  identifier =~ LEGACY_URL_FORMAT || identifier =~ CURRENT_URL_FORMAT
67
67
  end
68
+ private_class_method :valid_url?
68
69
 
69
70
  def self.legacy_url?(identifier)
70
71
  identifier =~ LEGACY_URL_FORMAT
71
72
  end
73
+ private_class_method :legacy_url?
72
74
  end
@@ -3,7 +3,7 @@ module Arxiv
3
3
  include HappyMapper
4
4
 
5
5
  tag 'entry'
6
- element :arxiv_url, String, tag: 'id'
6
+ element :arxiv_url, StringScrubber, tag: 'id', parser: :force_ssl_url
7
7
  element :created_at, DateTime, tag: 'published'
8
8
  element :updated_at, DateTime, tag: 'updated'
9
9
  element :title, StringScrubber, parser: :scrub
@@ -1,7 +1,23 @@
1
1
  module Arxiv
2
2
  class StringScrubber
3
- def self.scrub(string)
3
+ def self.scrub(string)
4
4
  string.gsub("\n", ' ').strip.squeeze(" ")
5
5
  end
6
+
7
+ # On approximately Oct 2016, ArXiv seems to have converted their entire
8
+ # site to use SSL. Old HTTP links, still work by redirecting to HTTPS.
9
+ #
10
+ # Unfortunately, this change is not yet reflected in their API responses
11
+ # (e.g. their API still returns a non-SSL URL). Thus, if you try to use
12
+ # this URL it will redirect to the new SSL URL. This can create problems
13
+ # if the client is not expecting redirects.
14
+ #
15
+ # Hopefully they will update their API. Until then, this little method
16
+ # forces `url` to use HTTPS rather than HTTP. If `url` is already HTTPS,
17
+ # it will happily return `url` unaltered.
18
+ #
19
+ def self.force_ssl_url(url)
20
+ url.sub(/^http:/, "https:")
21
+ end
6
22
  end
7
23
  end
@@ -1,3 +1,3 @@
1
1
  module Arxiv
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -9,7 +9,7 @@ module Arxiv
9
9
 
10
10
  describe "arxiv_url" do
11
11
  it "should fetch the link to the manuscript's page on arXiv" do
12
- expect(@manuscript.arxiv_url).to eql("http://arxiv.org/abs/1202.0819v1")
12
+ expect(@manuscript.arxiv_url).to eql("https://arxiv.org/abs/1202.0819v1")
13
13
  end
14
14
  end
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arxiv
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
  - Scholastica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-28 00:00:00.000000000 Z
11
+ date: 2016-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: happymapper
@@ -136,8 +136,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project: arxiv
139
- rubygems_version: 2.4.8
139
+ rubygems_version: 2.4.6
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Ruby wrapper accessing the arXiv API
143
- test_files: []
143
+ test_files:
144
+ - spec/arxiv/arxiv_spec.rb
145
+ - spec/arxiv/models/author_spec.rb
146
+ - spec/arxiv/models/category_spec.rb
147
+ - spec/arxiv/models/link_spec.rb
148
+ - spec/arxiv/models/manuscript_spec.rb
149
+ - spec/spec_helper.rb