relaton-isbn 1.18.0 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +10 -17
- data/lib/relaton_isbn/isbn.rb +1 -1
- data/lib/relaton_isbn/open_library.rb +4 -4
- data/lib/relaton_isbn/util.rb +1 -4
- data/lib/relaton_isbn/version.rb +1 -1
- data/lib/relaton_isbn.rb +0 -1
- metadata +5 -6
- data/lib/relaton_isbn/config.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06f70a5b69dd360292a5692cd5ea5f1228c9261bdc73fe2cb9e385f1d7683173
|
4
|
+
data.tar.gz: 729a5c5eb601e1ed36f93bf27e3dfce38f0cfcce2819f3a66838ffe6a3cc0ba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 164de6cc7b1e1a2b5dedf3feeddb5cf92384206cfde6052fa20fd4d1798962fd3d8d9712062cea6f6b336fdec1568aa84f4d8887a0b085bfee7eb40b9e756734
|
7
|
+
data.tar.gz: b0ed039de5c4c242c2294adbe332389816d4776f9517ef6a274fd3ba69adeacf36868d548d1032ff8ba0624eda3b7782c4abba66c0e561eeee5deaf89dc7a4c7
|
data/README.adoc
CHANGED
@@ -39,37 +39,26 @@ $ gem install relaton-isbn
|
|
39
39
|
|
40
40
|
== Usage
|
41
41
|
|
42
|
-
===
|
42
|
+
=== Retrieving bibliographic items using OpenLibrary API
|
43
43
|
|
44
|
-
|
44
|
+
To retrieve bibliographic items, use `RelatonIsbn::OpenLibrary.get` method with ISBN-10 or ISBN-13 as an argument. Allowed prefixes are `ISBN`, `isbn:`. Prefix and hyphens are optional. The method returns `RelatonBib::BibliographicItem` object.
|
45
45
|
|
46
46
|
[source,ruby]
|
47
47
|
----
|
48
48
|
require 'relaton_isbn'
|
49
49
|
=> true
|
50
50
|
|
51
|
-
RelatonIsbn.configure do |config|
|
52
|
-
config.logger.level = Logger::DEBUG
|
53
|
-
end
|
54
|
-
----
|
55
|
-
|
56
|
-
=== Retrieving bibliographic items using OpenLibrary API
|
57
|
-
|
58
|
-
To retrieve bibliographic items, use `RelatonIsbn::OpenLibrary.get` method with ISBN-10 or ISBN-13 as an argument. Prefix `ISBN` and hyphens are optional. The method returns `RelatonBib::BibliographicItem` object.
|
59
|
-
|
60
|
-
[source,ruby]
|
61
|
-
----
|
62
51
|
# get document by ISBN-13
|
63
|
-
>
|
52
|
+
> ibitem = RelatonIsbn::OpenLibrary.get "ISBN 978-0-12-064481-0"
|
64
53
|
[relaton-isbn] (ISBN 9780120644810) Fetching from OpenLibrary ...
|
65
54
|
[relaton-isbn] (ISBN 9780120644810) Found: `9780120644810`
|
66
55
|
=> #<RelatonBib::BibliographicItem:0x0000000113889258
|
67
56
|
...
|
68
57
|
|
69
58
|
# get document by ISBN-10
|
70
|
-
> RelatonIsbn::OpenLibrary.get "0120644819"
|
71
|
-
[relaton-isbn] (
|
72
|
-
[relaton-isbn] (
|
59
|
+
> RelatonIsbn::OpenLibrary.get "isbn:0120644819"
|
60
|
+
[relaton-isbn] (isbn:0120644819) Fetching from OpenLibrary ...
|
61
|
+
[relaton-isbn] (isbn:0120644819) Found: `9780120644810`
|
73
62
|
=> #<RelatonBib::BibliographicItem:0x00000001098ac960
|
74
63
|
...
|
75
64
|
----
|
@@ -129,6 +118,10 @@ To retrieve bibliographic items, use `RelatonIsbn::OpenLibrary.get` method with
|
|
129
118
|
"place"=>[{"city"=>"Boston"}, {"city"=>"London"}]}
|
130
119
|
----
|
131
120
|
|
121
|
+
=== Logging
|
122
|
+
|
123
|
+
RelatonIsbn uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
|
124
|
+
|
132
125
|
== Development
|
133
126
|
|
134
127
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
data/lib/relaton_isbn/isbn.rb
CHANGED
@@ -8,22 +8,22 @@ module RelatonIsbn
|
|
8
8
|
ENDPOINT = "http://openlibrary.org/api/volumes/brief/isbn/".freeze
|
9
9
|
|
10
10
|
def get(ref, _date = nil, _opts = {}) # rubocop:disable Metrics/MethodLength
|
11
|
-
Util.
|
11
|
+
Util.info "Fetching from OpenLibrary ...", key: ref
|
12
12
|
|
13
13
|
isbn = Isbn.new(ref).parse
|
14
14
|
unless isbn
|
15
|
-
Util.
|
15
|
+
Util.info "Incorrect ISBN.", key: ref
|
16
16
|
return
|
17
17
|
end
|
18
18
|
|
19
19
|
resp = request_api isbn
|
20
20
|
unless resp
|
21
|
-
Util.
|
21
|
+
Util.info "Not found.", key: ref
|
22
22
|
return
|
23
23
|
end
|
24
24
|
|
25
25
|
bib = Parser.parse resp
|
26
|
-
Util.
|
26
|
+
Util.info "Found: `#{bib.docidentifier.first.id}`", key: ref
|
27
27
|
bib
|
28
28
|
end
|
29
29
|
|
data/lib/relaton_isbn/util.rb
CHANGED
data/lib/relaton_isbn/version.rb
CHANGED
data/lib/relaton_isbn.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-isbn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: relaton-bib
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.19.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.19.0
|
27
27
|
description: 'RelatonIsbn: retrieve publications by ISBN for bibliographic use using
|
28
28
|
the BibliographicItem model'
|
29
29
|
email:
|
@@ -38,7 +38,6 @@ files:
|
|
38
38
|
- README.adoc
|
39
39
|
- Rakefile
|
40
40
|
- lib/relaton_isbn.rb
|
41
|
-
- lib/relaton_isbn/config.rb
|
42
41
|
- lib/relaton_isbn/isbn.rb
|
43
42
|
- lib/relaton_isbn/open_library.rb
|
44
43
|
- lib/relaton_isbn/parser.rb
|
@@ -67,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
66
|
- !ruby/object:Gem::Version
|
68
67
|
version: '0'
|
69
68
|
requirements: []
|
70
|
-
rubygems_version: 3.3.
|
69
|
+
rubygems_version: 3.3.27
|
71
70
|
signing_key:
|
72
71
|
specification_version: 4
|
73
72
|
summary: 'RelatonIsbn: retrieve publications by ISBN for bibliographic use using the
|