bolognese 1.0.13 → 1.0.15

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: 1bc5619b1c9dc7435a062e1e9e143c190594087d80e7cb7dac27df816804cd88
4
- data.tar.gz: 0bc05be427ae2be8b3e9adcebd2eb25d2660409425da9d15c98c319f936fa3a0
3
+ metadata.gz: 61bf91a4667cb93a203138920b4d7bea7aa2efa141cc651be0d1202080913c52
4
+ data.tar.gz: a85fde2e4cb5bc8c62fac70504194f0ce87df31d04f142f4c22a86516600aced
5
5
  SHA512:
6
- metadata.gz: 9115ce5569d2d3a3e2a9b189fa0e2901bb72837704ff8174b742ed05cd4cbb8ad84a7a79e8f0e7635469f0aec480e750d823a80f8f0fe57750dc69de27db54cd
7
- data.tar.gz: 9238067f30a00dba50cd61a22b4c64b9d3e04f155a2531a3edb2b58cda1d906741bf664f019e4029dbe9e221f881c21e2d0a8e9d6dcc1ceb8a1f59fff6c4abbc
6
+ metadata.gz: 98c224d7eb0b8bfa93acff99c80ae7eb84e53de3d46fe4e11e498aa2429788c41f4e427c8df4babeb4799ff9903c25fcd5d8649d5b08ecc86e03f0ae798da624
7
+ data.tar.gz: 17563660463f282bd2f2c049a4199adf7e4a65b978ebe03f4ff794100d1759ae4bb0151b985afd9bdca7e713d1778cc6254b123772d3209eddfcdf4800239415
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.0.13)
4
+ bolognese (1.0.15)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -125,7 +125,7 @@ module Bolognese
125
125
  "issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : nil,
126
126
  "submitted" => Array.wrap(dates).find { |d| d["dateType"] == "Submitted" }.to_h.fetch("__content__", nil),
127
127
  "abstract" => parse_attributes(descriptions, content: "description", first: true),
128
- "container-title" => periodical && periodical["title"],
128
+ "container-title" => periodical.present? ? periodical["title"] : publisher,
129
129
  "DOI" => doi,
130
130
  "issue" => issue,
131
131
  "page" => [first_page, last_page].compact.join("-").presence,
@@ -76,7 +76,7 @@ module Bolognese
76
76
  end
77
77
  id = normalize_id(meta.fetch("id", nil))
78
78
  state = id.present? ? "findable" : "not_found"
79
- subjects = Array.wrap(meta.fetch("categories")).map do |s|
79
+ subjects = Array.wrap(meta.fetch("categories", nil)).map do |s|
80
80
  { "subject" => s }
81
81
  end
82
82
 
@@ -391,6 +391,8 @@ module Bolognese
391
391
  elsif BibTeX.parse(string).first
392
392
  "bibtex"
393
393
  end
394
+ rescue BibTeX::ParseError => error
395
+ nil
394
396
  end
395
397
 
396
398
  def orcid_from_url(url)
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.0.13"
2
+ VERSION = "1.0.15"
3
3
  end
@@ -0,0 +1,21 @@
1
+ {
2
+ "type": "post-weblog",
3
+ "id": "https://doi.org/10.5072/4k3m-nyvg",
4
+ "DOI": "10.5072/4k3m-nyvg",
5
+ "URL": "https://blog.datacite.org/eating-your-own-dog-food",
6
+ "title": "Eating your own Dog Food",
7
+ "container-title": "DataCite Blog",
8
+ "publisher": "DataCite",
9
+ "abstract": "Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...",
10
+ "issued": {
11
+ "date-parts": [
12
+ [
13
+ 2016, 12, 20
14
+ ]
15
+ ]
16
+ },
17
+ "author": [{
18
+ "family": "Fenner",
19
+ "given": "Martin"
20
+ }]
21
+ }
@@ -26,4 +26,20 @@ describe Bolognese::Metadata, vcr: true do
26
26
  expect(subject.publication_year).to eq("2016")
27
27
  end
28
28
  end
29
+
30
+ context "get citeproc no categories" do
31
+ it "BlogPosting" do
32
+ input = fixture_path + "citeproc-no-categories.json"
33
+ subject = Bolognese::Metadata.new(input: input)
34
+ expect(subject.valid?).to be true
35
+ expect(subject.identifier).to eq("https://doi.org/10.5072/4k3m-nyvg")
36
+ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
37
+ expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
38
+ expect(subject.creator).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Martin Fenner", "type"=>"Person"}])
39
+ expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}])
40
+ expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food")
41
+ expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Issued"}])
42
+ expect(subject.publication_year).to eq("2016")
43
+ end
44
+ end
29
45
  end
@@ -23,7 +23,7 @@ describe Bolognese::Metadata, vcr: true do
23
23
  it "Dataset" do
24
24
  input = "https://doi.org/10.5061/DRYAD.8515"
25
25
  subject = Bolognese::Metadata.new(input: input, from: "datacite")
26
- expect(subject.citation).to eq("Ollomo, B., Durand, P., Prugnolle, F., Douzery, E. J. P., Arnathau, C., Nkoghe, D., … Renaud, F. (2011). <i>Data from: A new malaria agent in African hominids.</i> (Version 1) [Data set]. Dryad Digital Repository. https://doi.org/10.5061/dryad.8515")
26
+ expect(subject.citation).to eq("Ollomo, B., Durand, P., Prugnolle, F., Douzery, E. J. P., Arnathau, C., Nkoghe, D., … Renaud, F. (2011). <i>Data from: A new malaria agent in African hominids.</i> (Version 1) [Data set]. <i>Dryad Digital Repository</i>. Dryad Digital Repository. https://doi.org/10.5061/dryad.8515")
27
27
  end
28
28
  end
29
29
  end
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.0.13
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-18 00:00:00.000000000 Z
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -660,6 +660,7 @@ files:
660
660
  - spec/datacite_utils_spec.rb
661
661
  - spec/doi_utils_spec.rb
662
662
  - spec/find_from_format_spec.rb
663
+ - spec/fixtures/citeproc-no-categories.json
663
664
  - spec/fixtures/citeproc.json
664
665
  - spec/fixtures/codemeta.json
665
666
  - spec/fixtures/crosscite.json