bolognese 0.9.54 → 0.9.55

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: 729c31ad551095ba9799875c7331b41b0ab431be
4
- data.tar.gz: 49d6ff32d87b910bb8ee9e3470a1d389cd4e49b1
3
+ metadata.gz: 8483d1f8e557767fec495dcfaf83da4d2bfcd750
4
+ data.tar.gz: 8a05b19f4d418fcfa3b771d0e0b2e69de4b3a3a3
5
5
  SHA512:
6
- metadata.gz: dfae9a90f8ae8107d1952844b1f08e89d05d80ba0bd25625153d65ad524d407731a36c3475dadd1b19d11c6eef8dfc2e8e71f12818fe70bd1d9b10d49e6fb9d5
7
- data.tar.gz: c3fd0ebb7bdcfc3219f911db026c2692f6122d190059c2597b7c450c0229898dbb811a719f204f1815d93539488f0f4fb0b8d1d179dc16f59f3c304f99648842
6
+ metadata.gz: eb28085d5f306cf6b0774477380c147f7ef700049df2a49d153b2e613130e0a2d96ffce55f27e224e9f44356bf2ae8ba5372f610b204720da6c71499bb74959e
7
+ data.tar.gz: ef141c6d4ac0709ef609937d44680e763a21a7b49ba53cbfdfc10eb28610edf4bbffe4b4d8c91dbb0726eac0453a7ed5642cf0efbc822ee76f8dcfe1d9ce1e64
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.9.54)
4
+ bolognese (0.9.55)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -60,13 +60,13 @@ GEM
60
60
  tilt
61
61
  hamster (3.0.0)
62
62
  concurrent-ruby (~> 1.0)
63
- hashdiff (0.3.6)
63
+ hashdiff (0.3.7)
64
64
  htmlentities (4.3.4)
65
65
  i18n (0.8.6)
66
66
  json (2.1.0)
67
- json-ld (2.1.5)
67
+ json-ld (2.1.7)
68
68
  multi_json (~> 1.12)
69
- rdf (~> 2.2)
69
+ rdf (~> 2.2, >= 2.2.8)
70
70
  jsonlint (0.2.0)
71
71
  oj (~> 2)
72
72
  trollop (~> 2)
@@ -104,7 +104,7 @@ GEM
104
104
  rack-test (0.7.0)
105
105
  rack (>= 1.0, < 3)
106
106
  rake (12.1.0)
107
- rdf (2.2.9)
107
+ rdf (2.2.11)
108
108
  hamster (~> 3.0)
109
109
  link_header (~> 0.0, >= 0.0.8)
110
110
  rdf-aggregate-repo (2.2.0)
@@ -120,7 +120,7 @@ GEM
120
120
  rdf (~> 2.0)
121
121
  rdf-rdfa (~> 2.0)
122
122
  rdf-xsd (~> 2.0)
123
- rdf-turtle (2.2.0)
123
+ rdf-turtle (2.2.1)
124
124
  ebnf (~> 1.1)
125
125
  rdf (~> 2.2)
126
126
  rdf-xsd (2.2.0)
@@ -159,7 +159,7 @@ GEM
159
159
  unicode (0.4.4.4)
160
160
  unicode_utils (1.4.0)
161
161
  vcr (3.0.3)
162
- webmock (3.0.1)
162
+ webmock (3.1.0)
163
163
  addressable (>= 2.3.6)
164
164
  crack (>= 0.3.2)
165
165
  hashdiff
@@ -106,7 +106,7 @@ module Bolognese
106
106
  end
107
107
 
108
108
  # generate name for method to call dynamically
109
- @metadata = @from.present? ? send("read_" + @from, string: string, sandbox: options[:sandbox], url: options[:url]) : {}
109
+ @metadata = @from.present? ? send("read_" + @from, string: string, sandbox: options[:sandbox], doi: options[:doi], url: options[:url]) : {}
110
110
  @raw = string.present? ? string.strip : nil
111
111
 
112
112
  @should_passthru = (@from == "datacite") && !regenerate
@@ -49,7 +49,12 @@ module Bolognese
49
49
  return { "errors" => errors } if errors.present?
50
50
  end
51
51
 
52
- id = normalize_doi(meta.dig("identifier", "__content__"), sandbox: options[:sandbox])
52
+ if options[:doi]
53
+ id = normalize_doi(options[:doi], sandbox: options[:sandbox])
54
+ else
55
+ id = normalize_doi(meta.dig("identifier", "__content__"), sandbox: options[:sandbox])
56
+ end
57
+
53
58
  doi = doi_from_url(id)
54
59
 
55
60
  if options[:url]
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.9.54"
2
+ VERSION = "0.9.55"
3
3
  end
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: head
5
+ uri: https://doi.org/10.5072/testpub2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Maremma - https://github.com/datacite/maremma
12
+ Accept:
13
+ - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
14
+ response:
15
+ status:
16
+ code: 303
17
+ message: See Other
18
+ headers:
19
+ Server:
20
+ - Apache-Coyote/1.1
21
+ Vary:
22
+ - Accept
23
+ Location:
24
+ - http://www.datacite.org/testprefix
25
+ Expires:
26
+ - Mon, 09 Oct 2017 00:17:32 GMT
27
+ Content-Type:
28
+ - text/html;charset=utf-8
29
+ Content-Length:
30
+ - '153'
31
+ Date:
32
+ - Sun, 08 Oct 2017 23:20:48 GMT
33
+ body:
34
+ encoding: UTF-8
35
+ string: ''
36
+ http_version:
37
+ recorded_at: Sun, 08 Oct 2017 23:20:48 GMT
38
+ recorded_with: VCR 3.0.3
@@ -260,6 +260,24 @@ describe Bolognese::Metadata, vcr: true do
260
260
  expect(subject.provider).to eq("DataCite")
261
261
  end
262
262
 
263
+ it "Schema 4.1 from string with doi in options" do
264
+ input = fixture_path + "datacite-example-complicated-v4.1.xml"
265
+ subject = Bolognese::Metadata.new(input: input, doi: "10.5072/testpub2")
266
+ expect(subject.valid?).to be true
267
+ expect(subject.id).to eq("https://doi.org/10.5072/testpub2")
268
+ expect(subject.type).to eq("ScholarlyArticle")
269
+ expect(subject.additional_type).to eq("Monograph")
270
+ expect(subject.resource_type_general).to eq("Text")
271
+ expect(subject.author).to eq([{"type"=>"Person", "name"=>"John Smith", "givenName"=>"John", "familyName"=>"Smith"}, {"name"=>"つまらないものですが"}])
272
+ expect(subject.title).to eq(["Właściwości rzutowań podprzestrzeniowych", {"title_type"=>"TranslatedTitle", "text"=>"Translation of Polish titles"}])
273
+ expect(subject.alternate_name).to eq("type"=>"ISBN", "name"=>"937-0-4523-12357-6")
274
+ expect(subject.date_published).to eq("2010")
275
+ expect(subject.is_part_of).to eq("type"=>"CreativeWork", "id"=>"https://doi.org/10.5272/oldertestpub")
276
+ expect(subject.license).to eq("id"=>"http://creativecommons.org/licenses/by-nd/2.0", "name"=>"Creative Commons Attribution-NoDerivs 2.0 Generic")
277
+ expect(subject.publisher).to eq("Springer")
278
+ expect(subject.provider).to eq("DataCite")
279
+ end
280
+
263
281
  it "empty subject" do
264
282
  input = "https://doi.org/10.18169/PAPDEOTTX00502"
265
283
  subject = Bolognese::Metadata.new(input: input)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.54
4
+ version: 0.9.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-25 00:00:00.000000000 Z
11
+ date: 2017-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -649,6 +649,7 @@ files:
649
649
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Funding.yml
650
650
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Funding_schema_version_4.yml
651
651
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Schema_4_1_from_string.yml
652
+ - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Schema_4_1_from_string_with_doi_in_options.yml
652
653
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/author_only_full_name.yml
653
654
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/author_with_scheme.yml
654
655
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/author_with_wrong_orcid_scheme.yml