arxiv 0.1.4 → 0.1.7

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: 6b3c270215d3c9b3813d3c92d9c10d2c170a3881
4
- data.tar.gz: a739179d013070d32ad37e6f78a6c413858c85c2
3
+ metadata.gz: 1edec782b776e7b7c0b094d5ac28080d019fe9dc
4
+ data.tar.gz: b1267323afeb55920bbf7c06d7201c5124af98cd
5
5
  SHA512:
6
- metadata.gz: f6c947d476518316af35c3ae69e80dde43d382803c8848db0a2eeddbe88a72302d00d63a9b7045db9775241592e9dfe85e100a5a15de098cb9958b159ebe7892
7
- data.tar.gz: 31ede1191b470074922d30d6e3281cb2e06867d3990c0e1dd7b9ab52c3e34284645a65beb66d0d0c0b722d2e268610c1287d851951f44277a1dd07672f6fe8bf
6
+ metadata.gz: b633003bd20f55dcc3440776906b29bd5f1713b979e31b5688b7546115f12c64fc2c35143309b17fb361affb1e95638e96f3218aaae0189dd590b7f2e4e72f8a
7
+ data.tar.gz: a2daa99ad08adc5d28a25293d997940d8e799b6cb10a633a31d9cb86ff4b9094bdbcadafdab109fed9e5aec86c47ef89df8bb08d540ba79ac30fa2142449eea6
@@ -0,0 +1,34 @@
1
+ name: ci
2
+ on:
3
+ push:
4
+ jobs:
5
+ test:
6
+ runs-on: ubuntu-latest
7
+
8
+ steps:
9
+ - uses: actions/checkout@v3
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
12
+ - name: Install dependencies
13
+ run: bundle install
14
+ - name: Run tests
15
+ run: rspec .
16
+
17
+ deploy:
18
+ name: Build and publish gem
19
+ # if: github.ref == 'refs/heads/main' && needs.test.result == 'success'
20
+ needs: test
21
+ runs-on: ubuntu-latest
22
+
23
+ steps:
24
+ - uses: actions/checkout@v3
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
27
+ - name: Publish to GPR
28
+ run: |
29
+ curl -u $RUBYGEMS_USERNAME:$RUBYGEMS_PASSWORD https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials
30
+ gem build arxiv.gemspec
31
+ gem push `ls | grep *.gem`
32
+ env:
33
+ RUBYGEMS_USERNAME: "${{ secrets.RUBYGEMS_USERNAME }}"
34
+ RUBYGEMS_PASSWORD: "${{ secrets.RUBYGEMS_PASSWORD }}"
data/README.md CHANGED
@@ -37,4 +37,5 @@ Look at a manuscript's categories:
37
37
  manuscript.primary_category.description # => "Physics - Instrumentation and Methods for Astrophysics"
38
38
 
39
39
  ### License
40
- This is an open source project built by {Scholastica}[https://scholasticahq.com] under the {MIT-LICENSE}[https://github.com/scholastica/timber/blob/master/MIT-LICENSE].
40
+ This is an open source project built by [Scholastica](https://scholasticahq.com) under the [MIT-LICENSE](https://github.com/scholastica/timber/blob/master/MIT-LICENSE).
41
+
data/arxiv.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  # specify any dependencies here; for example:
22
22
  s.add_runtime_dependency "happymapper", '~> 0.4', '>= 0.4.1'
23
23
  s.add_runtime_dependency "nokogiri", '~> 1.6', '>= 1.6.6.2'
24
+ s.add_runtime_dependency "full-name-splitter", '~> 0.1.2'
24
25
 
25
26
  s.add_development_dependency "rspec", '~> 3.3', '>= 3.3.0'
26
27
  s.add_development_dependency "pry", '~> 0.10.2'
@@ -3,5 +3,25 @@ module Arxiv
3
3
  include HappyMapper
4
4
  element :name, StringScrubber, parser: :scrub
5
5
  has_many :affiliations, StringScrubber, parser: :scrub, tag: 'affiliation'
6
+
7
+ # Unfortunately, the ArXiv API does not provide separate attributes for
8
+ # `author.first_name` and `author.last_name`; it only provides a single
9
+ # `author.name` attribute.
10
+ #
11
+ # Yet most standards within academic publishing (e.g. JATS XML) prefer to
12
+ # differentiate first name and last name of authors. To support that
13
+ # expectation, we've split the name value (leveraging a third-party gem).
14
+ # Ideally, ArXiv would provide this data directly. But until then, this
15
+ # solution should be suitable.
16
+ #
17
+ def first_name
18
+ FullNameSplitter.split(name).first
19
+ end
20
+
21
+ # See code comment for `first_name`.
22
+ #
23
+ def last_name
24
+ FullNameSplitter.split(name).last
25
+ end
6
26
  end
7
27
  end
@@ -51,6 +51,7 @@ module Arxiv
51
51
  def pdf_url
52
52
  if available_in_pdf?
53
53
  url = links.find { |l| l.content_type == "application/pdf" }.url
54
+ url = StringScrubber.force_ssl_url(url)
54
55
  "#{url}.pdf" unless url =~ /\.pdf$/
55
56
  end
56
57
  end
data/lib/arxiv/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arxiv
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.7"
3
3
  end
data/lib/arxiv.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'open-uri'
2
2
  require 'nokogiri'
3
3
  require 'happymapper'
4
+ require 'full-name-splitter'
4
5
 
5
6
  require 'arxiv/version'
6
7
  require 'arxiv/string_scrubber'
data/package-lock.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "arxiv",
3
+ "lockfileVersion": 2,
4
+ "requires": true,
5
+ "packages": {}
6
+ }
@@ -10,6 +10,18 @@ module Arxiv
10
10
  end
11
11
  end
12
12
 
13
+ describe "first_name" do
14
+ it "should return the author's first name" do
15
+ expect(@author.first_name).to eql("Michael T.")
16
+ end
17
+ end
18
+
19
+ describe "last_name" do
20
+ it "should return the author's last name" do
21
+ expect(@author.last_name).to eql("Murphy")
22
+ end
23
+ end
24
+
13
25
  describe "affiliations" do
14
26
  it "should return an array of the author's affiliations" do
15
27
  expect(@author.affiliations).to include("Swinburne University of Technology")
@@ -93,7 +93,7 @@ module Arxiv
93
93
 
94
94
  describe "pdf_url" do
95
95
  it "should return the url to download the manuscript in PDF format" do
96
- expect(@manuscript.pdf_url).to eql('http://arxiv.org/pdf/1202.0819v1.pdf')
96
+ expect(@manuscript.pdf_url).to eql('https://arxiv.org/pdf/1202.0819v1.pdf')
97
97
  end
98
98
  end
99
99
 
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.4
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scholastica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-04 00:00:00.000000000 Z
11
+ date: 2022-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: happymapper
@@ -50,6 +50,20 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 1.6.6.2
53
+ - !ruby/object:Gem::Dependency
54
+ name: full-name-splitter
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 0.1.2
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: 0.1.2
53
67
  - !ruby/object:Gem::Dependency
54
68
  name: rspec
55
69
  requirement: !ruby/object:Gem::Requirement
@@ -92,6 +106,7 @@ executables: []
92
106
  extensions: []
93
107
  extra_rdoc_files: []
94
108
  files:
109
+ - ".github/workflows/ci.yml"
95
110
  - ".gitignore"
96
111
  - ".rspec"
97
112
  - ".ruby-gemset"
@@ -101,7 +116,6 @@ files:
101
116
  - README.md
102
117
  - Rakefile
103
118
  - arxiv.gemspec
104
- - circle.yml
105
119
  - lib/arxiv.rb
106
120
  - lib/arxiv/data/category_abbreviation_to_label_mapping.xml
107
121
  - lib/arxiv/models/author.rb
@@ -110,6 +124,7 @@ files:
110
124
  - lib/arxiv/models/manuscript.rb
111
125
  - lib/arxiv/string_scrubber.rb
112
126
  - lib/arxiv/version.rb
127
+ - package-lock.json
113
128
  - spec/arxiv/arxiv_spec.rb
114
129
  - spec/arxiv/models/author_spec.rb
115
130
  - spec/arxiv/models/category_spec.rb
@@ -136,14 +151,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
151
  version: '0'
137
152
  requirements: []
138
153
  rubyforge_project: arxiv
139
- rubygems_version: 2.4.6
154
+ rubygems_version: 2.4.5.5
140
155
  signing_key:
141
156
  specification_version: 4
142
157
  summary: Ruby wrapper accessing the arXiv API
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
158
+ test_files: []
data/circle.yml DELETED
@@ -1,10 +0,0 @@
1
- dependencies:
2
- pre:
3
- - "echo -e '---\n:rubygems_api_key: '$RUBYGEMS_API_KEY > ~/.gem/credentials"
4
- - chmod 0600 ~/.gem/credentials
5
- deployment:
6
- production:
7
- branch: master
8
- commands:
9
- - gem build arxiv.gemspec
10
- - gem push `ls | grep *.gem`