arx 1.2.0 → 1.2.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
  SHA256:
3
- metadata.gz: 9276c200c40eae1213c2d0c7222586ecdf5a398ee5df259c9f2d6791603ad7ac
4
- data.tar.gz: 711a0abadcc65ce14b7fd6ce3bb7380fb20435b951b2461250606540f52b44ab
3
+ metadata.gz: 1dae69d65fb2846820e6c457a10c5249a210ddfb551bd9cf7311562b1071da08
4
+ data.tar.gz: d32adc9bf13a8e6d6cf0a1394d76f2a03b0406530f58b6a68604b66dda71a312
5
5
  SHA512:
6
- metadata.gz: c367c950ada3d0dc3f5c3ab3bc720632bcdf63dc2484be4ca4c2795292118db5ed787b5908cbd2026b3c0623ef00ea5d4cc9c7e8928c693da8923790088af8bf
7
- data.tar.gz: 9fe5a7b20e69ff159df7ce897cd55335a6b4d35982732eb0fb307ee018e2490fbdbb7cde639850aae1767506737d6286e37cead7f99baea581e1dfedd4e2158b
6
+ metadata.gz: 8f2af67fbe94f57dbfc5883dccd0bd74e023cfe400e4a8caecf95de0034646c3544e3f07b21787f0cd6fcc1eb7accb49328d60b8922a3b0d2cbacbc094106cbb
7
+ data.tar.gz: 3e73cc8f30205c8077c945221f719186fc4c1ee6945a8cc9d5e1d8221d8075083eebc79b74c698559c98355b0513a76888b8e1bef65b424ca5be2eb4d1d82561
@@ -1,3 +1,21 @@
1
+ # 1.2.1
2
+
3
+ #### Major changes
4
+
5
+ - Add support for saving PDFs with `Paper#save` (see #81). ([#90](https://github.com/eonu/arx/pull/90))
6
+ - Change gem Ruby version specifier from `~> 2.5` to `>= 2.5`. ([#86](https://github.com/eonu/arx/pull/86))
7
+
8
+ #### Minor changes
9
+
10
+ - Remove arXiv logo from `README.md`. ([#87](https://github.com/eonu/arx/pull/87))
11
+ - Use `URI.open` instead of `Kernel.open` (see #82). ([#86](https://github.com/eonu/arx/pull/86))
12
+ - Add CI rubies `2.7` and `3.0` (see #84). ([#86](https://github.com/eonu/arx/pull/86))
13
+ - Remove unnecessary arXiv information from `README.md` (see #83). ([#86](https://github.com/eonu/arx/pull/86))
14
+ - Remove system gem update directive in `.travis.yml`. ([#78](https://github.com/eonu/arx/pull/78))
15
+ - Remove version specifier for `bundler` gem in `arx.gemspec`. ([#77](https://github.com/eonu/arx/pull/77))
16
+ - Update specs using paper `1710.02185` to account for revision and acceptance by journal (_congratulations!_). ([#76](https://github.com/eonu/arx/pull/76))
17
+ - Update email address in `LICENSE.md`. ([#73](https://github.com/eonu/arx/pull/73))
18
+
1
19
  # 1.2.0
2
20
 
3
21
  #### Major changes
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019 Edwin Onuonga <ed@mail.eonu.net>
3
+ Copyright (c) 2019 Edwin Onuonga <ed@eonu.net>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Arx
2
2
 
3
- <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/ArXiv_web.svg/1200px-ArXiv_web.svg.png" width="15%" align="right"></img>
4
-
5
- [![Ruby Version](https://img.shields.io/badge/ruby-~%3E%202.5-red.svg)](https://github.com/eonu/arx/blob/503a1c95ac450dbc20623491060c3fc32d213627/arx.gemspec#L19)
3
+ [![Ruby Version](https://img.shields.io/badge/ruby-%3E=%202.5-red.svg)](https://github.com/eonu/arx/blob/503a1c95ac450dbc20623491060c3fc32d213627/arx.gemspec#L19)
6
4
  [![Gem](https://img.shields.io/gem/v/arx.svg)](https://rubygems.org/gems/arx)
7
5
  [![License](https://img.shields.io/github/license/eonu/arx.svg)](https://github.com/eonu/arx/blob/master/LICENSE)
8
6
 
@@ -12,48 +10,52 @@
12
10
 
13
11
  **A Ruby interface for querying academic papers on the arXiv search API.**
14
12
 
15
- <img src="https://i.ibb.co/19Djpzk/arxiv.png" width="25%" align="left"></img>
16
-
17
- > arXiv is an e-print service in the fields of physics, mathematics, non-linear science, computer science, quantitative biology, quantitative finance and statistics.
13
+ [arXiv](https://arxiv.org/) provides an advanced search utility on their website, as well as an extensive [search API](https://arxiv.org/help/api) that allows for the external querying of academic papers hosted on their website.
18
14
 
19
- ---
15
+ Although [Scholastica](https://github.com/scholastica) offer a great [Ruby gem](https://github.com/scholastica/arxiv) for retrieving papers from arXiv through the search API, this gem only allows for the retrieval of one paper at a time, and only supports searching for paper by ID.
20
16
 
21
- [arXiv](https://arxiv.org/) provides an advanced search utility (shown left) on their website, as well as an extensive [search API](https://arxiv.org/help/api) that allows for the external querying of academic papers hosted on their website.
17
+ > Arx is a gem that allows for quick and easy querying of the arXiv search API, without having to worry about manually writing your own search query strings or parsing the resulting XML query response to find the data you need.
22
18
 
23
- Although [Scholastica](https://github.com/scholastica) offer a great [Ruby gem](https://github.com/scholastica/arxiv) for retrieving papers from arXiv through the search API, this gem is only intended for retrieving one paper at a time, and only supports searching for paper by ID.
19
+ ## Examples
24
20
 
25
- *Arx is a gem that allows for quick and easy querying of the arXiv search API, without having to worry about manually writing your own search query strings or parse the resulting XML query response to find the data you need.*
21
+ 1. Suppose we wish to search for papers in the `cs.FL` (Formal Languages and Automata Theory) category whose title contains `"Buchi Automata"`, not authored by `Tomáš Babiak`, sorted by submission date (latest first).
26
22
 
27
- ## Example
23
+ ```ruby
24
+ require 'arx'
28
25
 
29
- Suppose we wish to search for:
26
+ papers = Arx(sort_by: :date_submitted) do |query|
27
+ query.category('cs.FL')
28
+ query.title('Buchi Automata').and_not.author('Tomáš Babiak')
29
+ end
30
+ ```
30
31
 
31
- > Papers in the `cs.FL` (Formal Languages and Automata Theory) category whose title contains `"Buchi Automata"`, not authored by `Tomáš Babiak`, sorted by submission date (latest first).
32
+ 2. Suppose we wish to retrieve the main category of the paper with arXiv ID `1809.09415`, the name of the first author and the date it was published.
32
33
 
33
- This query can be executed with the following code:
34
+ ```ruby
35
+ require 'arx'
34
36
 
35
- ```ruby
36
- require 'arx'
37
-
38
- papers = Arx(sort_by: :date_submitted) do |query|
39
- query.category('cs.FL')
40
- query.title('Buchi Automata').and_not.author('Tomáš Babiak')
41
- end
42
- ```
37
+ paper = Arx('1809.09415')
38
+ paper.authors.first.name
39
+ #=> "Christof Löding"
40
+ paper.categories.first.full_name # or paper.primary_category.full_name
41
+ #=> "Formal Languages and Automata Theory"
42
+ paper.published_at
43
+ #=> #<DateTime: 2018-09-25T11:40:39+00:00 ((2458387j,42039s,0n),+0s,2299161j)>
44
+ ```
43
45
 
44
46
  ## Features
45
47
 
46
48
  - Ruby classes `Arx::Paper`, `Arx::Author` and `Arx::Category` that wrap the resulting Atom XML query result from the search API.
47
49
  - Supports querying by a paper's ID, title, author(s), abstract, subject category, comment, journal reference, or report number.
48
- - Provides a small embedded DSL for writing queries.
50
+ - Provides a small DSL for writing queries.
49
51
  - Supports searching fields by exact match.
50
52
 
51
53
  ## Installation
52
54
 
53
55
  To install Arx, run the following in your terminal:
54
56
 
55
- ```bash
56
- $ gem install arx
57
+ ```console
58
+ gem install arx
57
59
  ```
58
60
 
59
61
  ## Documentation
@@ -84,7 +86,7 @@ Obviously writing out queries like this can quickly become time-consuming and te
84
86
 
85
87
  ---
86
88
 
87
- The `Arx::Query` class provides a small embedded DSL for writing these query strings.
89
+ The `Arx::Query` class provides a small DSL for writing these query strings.
88
90
 
89
91
  #### Sorting criteria and order
90
92
 
@@ -16,13 +16,13 @@ Gem::Specification.new do |spec|
16
16
  Gemfile LICENSE CHANGELOG.md README.md Rakefile arx.gemspec
17
17
  ]
18
18
 
19
- spec.required_ruby_version = '~> 2.5'
19
+ spec.required_ruby_version = '>= 2.5'
20
20
 
21
21
  spec.add_runtime_dependency 'nokogiri', '~> 1.10'
22
22
  spec.add_runtime_dependency 'nokogiri-happymapper', '~> 0.8'
23
23
 
24
- spec.add_development_dependency 'bundler', '>= 1.17'
25
- spec.add_development_dependency 'rake', '~> 12.3'
24
+ spec.add_development_dependency 'bundler'
25
+ spec.add_development_dependency 'rake', '~> 13.0'
26
26
  spec.add_development_dependency 'thor', '~> 0.20.3'
27
27
  spec.add_development_dependency 'rspec', '~> 3.7'
28
28
  spec.add_development_dependency 'coveralls', '0.8.23'
data/lib/arx.rb CHANGED
@@ -59,7 +59,7 @@ module Arx
59
59
 
60
60
  yield query if block_given?
61
61
 
62
- document = Nokogiri::XML(open ENDPOINT + query.to_s + '&max_results=10000').remove_namespaces!
62
+ document = Nokogiri::XML(URI.open ENDPOINT + query.to_s + '&max_results=10000').remove_namespaces!
63
63
  results = Paper.parse(document, single: ids.size == 1)
64
64
 
65
65
  if results.is_a? Paper
@@ -234,6 +234,19 @@ module Arx
234
234
  end
235
235
  end
236
236
 
237
+ # Downloads the paper and saves it in PDF format at the specified path.
238
+ #
239
+ # @param path [String] The file path to store the PDF at.
240
+ def save(path)
241
+ begin
242
+ pdf_content = URI.open(pdf_url).read
243
+ File.open(path, 'wb') {|f| f.write pdf_content}
244
+ rescue
245
+ File.delete(path) if File.file? path
246
+ raise
247
+ end
248
+ end
249
+
237
250
  inspector *ATTRIBUTES
238
251
  end
239
252
  end
@@ -6,7 +6,7 @@ module Arx
6
6
  VERSION = {
7
7
  major: 1,
8
8
  minor: 2,
9
- patch: 0,
9
+ patch: 1,
10
10
  meta: nil,
11
11
  }.compact.values.join('.').freeze
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edwin Onuonga
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-03 00:00:00.000000000 Z
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.17'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.17'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '12.3'
61
+ version: '13.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '12.3'
68
+ version: '13.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +128,7 @@ dependencies:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: 0.9.10
131
- description:
131
+ description:
132
132
  email:
133
133
  - ed@eonu.net
134
134
  executables: []
@@ -162,13 +162,13 @@ metadata:
162
162
  documentation_uri: https://www.rubydoc.info/github/eonu/arx/master/toplevel
163
163
  bug_tracker_uri: https://github.com/eonu/arx/issues
164
164
  changelog_uri: https://github.com/eonu/arx/blob/master/CHANGELOG.md
165
- post_install_message:
165
+ post_install_message:
166
166
  rdoc_options: []
167
167
  require_paths:
168
168
  - lib
169
169
  required_ruby_version: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: '2.5'
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -177,8 +177,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  requirements: []
180
- rubygems_version: 3.0.3
181
- signing_key:
180
+ rubygems_version: 3.1.2
181
+ signing_key:
182
182
  specification_version: 4
183
183
  summary: A Ruby interface for querying academic papers on the arXiv search API.
184
184
  test_files: []