bolognese 1.7.3 → 1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ac0ee73b69d1bcb02c47710f614f155f29c749dfe11bdbac818543ff7a4d552
4
- data.tar.gz: c887eb61cf622633d71c36437eac5926fa4e40638f5a7fe5ae4c894ed52b39ad
3
+ metadata.gz: 4db42ab310128e14958777f979522287564747fcd8888350b05d0c1447f3b322
4
+ data.tar.gz: 1595844b30af956ab7c1d778b0c1ee13b8fa7bbfdb44d64c96360d1ab6e55262
5
5
  SHA512:
6
- metadata.gz: d617a7cd669a789a7b12a92c2e7c958fb1a1f0ac8953d105218ea2f027d63b635bd973504688ff958f91183a0894111c542410a013bbcdf1c7e2dfa30a580a51
7
- data.tar.gz: 14024d1535562346ca08c236c9bbf7403bcae3b8b06e2db264ef7717e136c7d1e633fa6f96ff859d78b3ddc7d513bf7dc65b944be2dc18e3dffbbf3df0b9c51c
6
+ metadata.gz: c28f7e14d5536470ff45df9d47705fecf70ca29c11ad5e77af7842f38614e664d6bc4b6989c3b5018c3cff64d649ceef1426736d99abb44b5b2f3bf400d04a41
7
+ data.tar.gz: 4eb706157bf726ab4c56282f8826b467414a1bb25df6aae29e7a4eab2780573a5c24406d82ed3ebf00c326a1df28cdc8036a8680001bac02e1a2e021e4b0613e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.7.3)
4
+ bolognese (1.8)
5
5
  activesupport (>= 4.2.5)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
@@ -119,7 +119,7 @@ GEM
119
119
  namae (1.0.1)
120
120
  nokogiri (1.10.10)
121
121
  mini_portile2 (~> 2.4.0)
122
- oj (3.10.6)
122
+ oj (3.10.7)
123
123
  oj_mimic_json (1.0.1)
124
124
  optimist (3.0.1)
125
125
  postrank-uri (1.0.24)
@@ -15,12 +15,13 @@ module Bolognese
15
15
  :format, :funding_references, :state, :geo_locations,
16
16
  :types, :content_url, :related_identifiers, :style, :locale, :date_registered
17
17
 
18
- def initialize(input: nil, from: nil, **options)
19
- id = normalize_id(input, options)
18
+ def initialize(options={})
19
+ options.symbolize_keys!
20
+ id = normalize_id(options[:input], options)
20
21
  ra = nil
21
22
 
22
23
  if id.present?
23
- @from = from || find_from_format(id: id)
24
+ @from = options[:from] || find_from_format(id: id)
24
25
 
25
26
  # mEDRA, KISTI, JaLC and OP DOIs are found in the Crossref index
26
27
  if @from == "medra"
@@ -37,9 +38,9 @@ module Bolognese
37
38
  hsh = @from.present? ? send("get_" + @from, id: id, sandbox: options[:sandbox]) : {}
38
39
  string = hsh.fetch("string", nil)
39
40
 
40
- elsif input.present? && File.exist?(input)
41
- filename = File.basename(input)
42
- ext = File.extname(input)
41
+ elsif options[:input].present? && File.exist?(options[:input])
42
+ filename = File.basename(options[:input])
43
+ ext = File.extname(options[:input])
43
44
  if %w(.bib .ris .xml .json).include?(ext)
44
45
  hsh = {
45
46
  "url" => options[:url],
@@ -49,8 +50,8 @@ module Bolognese
49
50
  "provider_id" => options[:provider_id],
50
51
  "client_id" => options[:client_id],
51
52
  "content_url" => options[:content_url] }
52
- string = IO.read(input)
53
- @from = from || find_from_format(string: string, filename: filename, ext: ext)
53
+ string = IO.read(options[:input])
54
+ @from = options[:from] || find_from_format(string: string, filename: filename, ext: ext)
54
55
  else
55
56
  $stderr.puts "File type #{ext} not supported"
56
57
  exit 1
@@ -69,8 +70,8 @@ module Bolognese
69
70
  "titles" => options[:titles],
70
71
  "publisher" => options[:publisher],
71
72
  "publication_year" => options[:publication_year] }
72
- string = input
73
- @from = from || find_from_format(string: string)
73
+ string = options[:input]
74
+ @from = options[:from] || find_from_format(string: string)
74
75
  end
75
76
 
76
77
  # make sure input is encoded as utf8
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.7.3"
2
+ VERSION = "1.8"
3
3
  end
@@ -153,7 +153,7 @@ describe Bolognese::Metadata, vcr: true do
153
153
  it "missing_comma" do
154
154
  json = IO.read(fixture_path + "datacite_software_missing_comma.json")
155
155
  response = subject.jsonlint(json)
156
- expect(response).to eq(["expected comma, not a string (doi) at line 4, column 11 [parse.c:373]"])
156
+ expect(response).to eq(["expected comma, not a string (after doi) at line 4, column 11 [parse.c:373]"])
157
157
  end
158
158
 
159
159
  it "overlapping_keys" do
@@ -46,7 +46,7 @@ describe Bolognese::Metadata, vcr: true do
46
46
  input = fixture_path + "datacite_software_missing_comma.json"
47
47
  subject = Bolognese::Metadata.new(input: input, from: "datacite_json", show_errors: true)
48
48
  expect(subject.valid?).to be false
49
- expect(subject.errors).to eq(["expected comma, not a string (doi) at line 4, column 11 [parse.c:373]"])
49
+ expect(subject.errors).to eq(["expected comma, not a string (after doi) at line 4, column 11 [parse.c:373]"])
50
50
  expect(subject.codemeta).to be_nil
51
51
  end
52
52
 
@@ -340,7 +340,8 @@ describe Bolognese::Metadata, vcr: true do
340
340
  "funderIdentifier"=>"https://doi.org/10.13039/501100000780",
341
341
  "funderIdentifierType"=>"Crossref Funder ID",
342
342
  "funderName"=>"European Commission"}],
343
- types: { "resourceTypeGeneral" => "Dataset", "schemaOrg" => "Dataset" })
343
+ types: { "resourceTypeGeneral" => "Dataset", "schemaOrg" => "Dataset" },
344
+ "identifiers" => [{ "identifierType"=>"Repository ID", "identifier"=>"123" }])
344
345
 
345
346
  expect(subject.valid?).to be true
346
347
  expect(subject.doi).to eq("10.5281/zenodo.1239")
@@ -359,6 +360,7 @@ describe Bolognese::Metadata, vcr: true do
359
360
  "funderIdentifier"=>"https://doi.org/10.13039/501100000780",
360
361
  "funderIdentifierType"=>"Crossref Funder ID",
361
362
  "funderName"=>"European Commission"}])
363
+ expect(subject.identifiers).to eq([{"identifier"=>"123", "identifierType"=>"Repository ID"}])
362
364
  expect(subject.agency).to eq("DataCite")
363
365
  expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
364
366
  expect(subject.state).to eq("findable")
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: 1.7.3
4
+ version: '1.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-13 00:00:00.000000000 Z
11
+ date: 2020-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma