bolognese 1.2.7 → 1.2.8

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: 55774ec0ed1eb3602226c5c699f292bd7a23d643233634351f43df72601f0787
4
- data.tar.gz: ff8633e4df123a7be9fd300e6ab46423ac62e23b01bde7d9e1a90f76c133dd38
3
+ metadata.gz: 962a79f6b7562d45143e718b7057a630893c488885978bd1decf29aec7f00ce0
4
+ data.tar.gz: b118c8132ad84349d208c5e90968762bc4a8685ab3faaccb20754bd92aee1b5a
5
5
  SHA512:
6
- metadata.gz: 8fa0219ea279cc2c6d515a6fd48f142469c6c81020bb18c714069f69ef17eb7b4d6e4713e3b8ac4df4fa708161b3085499e2080f5034932c2865200c1eaf802c
7
- data.tar.gz: 6912ba676c016ec5106e3f3c024a3274d6e87b9cc9e243a84b95b8f899cbe764ca80d9bd6f227cf847e688f5a5c7d011dd2bd99db087c5d8dec93b4c341c7e47
6
+ metadata.gz: 8fe1c2e677353073de6ba8498ab600e97470dfe0ae6e34157f967a20a5827f9d06188055ca70a9a78861a6b2a7c9572254b4ada6f7eeca1d90deb7fdc10f015b
7
+ data.tar.gz: 99ff048c10423d05a2d685efd26a2d7776290d14653e30a5936a3b514bd49b419cea542fe3ed7c38cffed1039bdd2f9d7bad485cc1c9237bcc7567702f491d49
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.2.7)
4
+ bolognese (1.2.8)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -72,6 +72,9 @@ module Bolognese
72
72
  publisher = bibliographic_metadata.dig("institution", "institution_name")
73
73
  when "sa_component"
74
74
  bibliographic_metadata = meta.dig("crossref", "sa_component", "component_list", "component").to_h
75
+ when "database"
76
+ bibliographic_metadata = meta.dig("crossref", "database", "dataset").to_h
77
+ resource_type = "dataset"
75
78
  end
76
79
 
77
80
  resource_type = (resource_type || model).to_s.underscore.camelcase.presence
@@ -95,12 +98,13 @@ module Bolognese
95
98
  end
96
99
  end.compact
97
100
 
101
+ date_created = Array.wrap(query.to_h["crm_item"]).find { |cr| cr["name"] == "created" }
98
102
  date_updated = Array.wrap(query.to_h["crm_item"]).find { |cr| cr["name"] == "last-update" }
99
103
  date_updated = { "date" => date_updated.fetch("__content__", nil), "dateType" => "Updated" } if date_updated.present?
100
104
  dates = [
101
- { "date" => crossref_date_published(bibliographic_metadata), "dateType" => "Issued" }, date_updated
105
+ { "date" => crossref_date_published(bibliographic_metadata) || date_created.to_h.fetch("__content__", "")[0..9].presence, "dateType" => "Issued" }, date_updated
102
106
  ].compact
103
- publication_year = crossref_date_published(bibliographic_metadata).present? ? crossref_date_published(bibliographic_metadata)[0..3] : nil
107
+ publication_year = crossref_date_published(bibliographic_metadata).present? ? crossref_date_published(bibliographic_metadata)[0..3] : date_created.to_h.fetch("__content__", "")[0..3].presence
104
108
  state = meta.present? || read_options.present? ? "findable" : "not_found"
105
109
 
106
110
  related_identifiers = Array.wrap(crossref_is_part_of(journal_metadata)) + Array.wrap(crossref_references(bibliographic_metadata))
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.2.7"
2
+ VERSION = "1.2.8"
3
3
  end
@@ -0,0 +1,129 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://doi.org/ra/10.2737
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Mozilla/5.0 (compatible; Maremma/4.2.6; mailto:info@datacite.org)
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: 200
17
+ message: ''
18
+ headers:
19
+ Date:
20
+ - Sat, 06 Jul 2019 10:52:18 GMT
21
+ Content-Type:
22
+ - application/json;charset=UTF-8
23
+ Content-Length:
24
+ - '54'
25
+ Connection:
26
+ - keep-alive
27
+ Set-Cookie:
28
+ - __cfduid=dcec61dea5110a3d9d0a929a92b24b6a61562410338; expires=Sun, 05-Jul-20
29
+ 10:52:18 GMT; path=/; domain=.doi.org; HttpOnly
30
+ Expect-Ct:
31
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
32
+ Server:
33
+ - cloudflare
34
+ Cf-Ray:
35
+ - 4f2107485e6397c6-FRA
36
+ body:
37
+ encoding: ASCII-8BIT
38
+ string: |-
39
+ [
40
+ {
41
+ "DOI": "10.2737",
42
+ "RA": "Crossref"
43
+ }
44
+ ]
45
+ http_version:
46
+ recorded_at: Sat, 06 Jul 2019 10:52:18 GMT
47
+ - request:
48
+ method: get
49
+ uri: https://api.crossref.org/works/10.2737/rds-2018-0001/transform/application/vnd.crossref.unixsd+xml
50
+ body:
51
+ encoding: US-ASCII
52
+ string: ''
53
+ headers:
54
+ User-Agent:
55
+ - Mozilla/5.0 (compatible; Maremma/4.2.6; mailto:info@datacite.org)
56
+ Accept:
57
+ - text/xml
58
+ response:
59
+ status:
60
+ code: 200
61
+ message: OK
62
+ headers:
63
+ Link:
64
+ - <http://dx.doi.org/10.2737/rds-2018-0001>; rel="canonical", <http://orcid.org/0000-0003-2583-1778>;
65
+ title="Christine A. Ribic"; rel="author", <http://orcid.org/0000-0003-4606-044X>;
66
+ title="Pamela J. Pietz"; rel="author"
67
+ Access-Control-Allow-Origin:
68
+ - "*"
69
+ Access-Control-Allow-Headers:
70
+ - X-Requested-With
71
+ Content-Length:
72
+ - '3627'
73
+ Server:
74
+ - http-kit
75
+ Date:
76
+ - Sat, 06 Jul 2019 10:52:19 GMT
77
+ X-Rate-Limit-Limit:
78
+ - '50'
79
+ X-Rate-Limit-Interval:
80
+ - 1s
81
+ Connection:
82
+ - close
83
+ body:
84
+ encoding: ASCII-8BIT
85
+ string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<crossref_result xmlns=\"http://www.crossref.org/qrschema/3.0\"
86
+ version=\"3.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.crossref.org/qrschema/3.0
87
+ http://www.crossref.org/schemas/crossref_query_output3.0.xsd\">\r\n <query_result>\r\n
88
+ \ <head>\r\n <doi_batch_id>none</doi_batch_id>\r\n </head>\r\n <body>\r\n
89
+ \ <query status=\"resolved\">\r\n <doi type=\"dataset\">10.2737/RDS-2018-0001</doi>\r\n
90
+ \ <crm-item name=\"publisher-name\" type=\"string\">USDA Forest Service</crm-item>\r\n
91
+ \ <crm-item name=\"prefix-name\" type=\"string\">USDA Forest Service,
92
+ Research &amp; Development</crm-item>\r\n <crm-item name=\"member-id\"
93
+ type=\"number\">1450</crm-item>\r\n <crm-item name=\"citation-id\"
94
+ type=\"number\">92231967</crm-item>\r\n <crm-item name=\"book-id\"
95
+ type=\"number\">2005400</crm-item>\r\n <crm-item name=\"deposit-timestamp\"
96
+ type=\"number\">201807131330</crm-item>\r\n <crm-item name=\"owner-prefix\"
97
+ type=\"string\">10.2737</crm-item>\r\n <crm-item name=\"last-update\"
98
+ type=\"date\">2018-07-13T19:35:20Z</crm-item>\r\n <crm-item name=\"created\"
99
+ type=\"date\">2017-08-09T19:44:20Z</crm-item>\r\n <crm-item name=\"citedby-count\"
100
+ type=\"number\">1</crm-item>\r\n <doi_record>\r\n <crossref
101
+ xmlns=\"http://www.crossref.org/xschema/1.1\" xsi:schemaLocation=\"http://www.crossref.org/xschema/1.1
102
+ http://doi.crossref.org/schemas/unixref1.1.xsd\">\r\n <database>\r\n
103
+ \ <database_metadata language=\"en\">\r\n <titles>\r\n
104
+ \ <title>Forest Service Research Data Archive</title>\r\n
105
+ \ </titles>\r\n </database_metadata>\r\n <dataset
106
+ dataset_type=\"collection\">\r\n <contributors>\r\n <person_name
107
+ contributor_role=\"author\" sequence=\"first\">\r\n <given_name>Christine
108
+ A.</given_name>\r\n <surname>Ribic</surname>\r\n <affiliation>U.S.
109
+ Geological Survey</affiliation>\r\n <ORCID authenticated=\"true\">http://orcid.org/0000-0003-2583-1778</ORCID>\r\n
110
+ \ </person_name>\r\n <person_name contributor_role=\"author\"
111
+ sequence=\"additional\">\r\n <given_name>Pamela J.</given_name>\r\n
112
+ \ <surname>Pietz</surname>\r\n <affiliation>U.S.
113
+ Geological Survey</affiliation>\r\n <ORCID authenticated=\"true\">https://orcid.org/0000-0003-4606-044X</ORCID>\r\n
114
+ \ </person_name>\r\n <person_name contributor_role=\"author\"
115
+ sequence=\"additional\">\r\n <given_name>Nicola</given_name>\r\n
116
+ \ <surname>Koper</surname>\r\n <affiliation>University
117
+ of Manitoba</affiliation>\r\n </person_name>\r\n <person_name
118
+ contributor_role=\"author\" sequence=\"additional\">\r\n <given_name>Christoph
119
+ S.</given_name>\r\n <surname>Ng</surname>\r\n <affiliation>University
120
+ of Manitoba</affiliation>\r\n </person_name>\r\n </contributors>\r\n
121
+ \ <titles>\r\n <title>Fledging times of grassland
122
+ birds</title>\r\n </titles>\r\n <doi_data>\r\n
123
+ \ <doi>10.2737/RDS-2018-0001</doi>\r\n <resource>https://www.fs.usda.gov/rds/archive/Product/RDS-2018-0001</resource>\r\n
124
+ \ </doi_data>\r\n </dataset>\r\n </database>\r\n
125
+ \ </crossref>\r\n </doi_record>\r\n </query>\r\n </body>\r\n
126
+ \ </query_result>\r\n</crossref_result>"
127
+ http_version:
128
+ recorded_at: Sat, 06 Jul 2019 10:52:19 GMT
129
+ recorded_with: VCR 3.0.3
@@ -179,6 +179,23 @@ describe Bolognese::Metadata, vcr: true do
179
179
  expect(subject.agency).to eq("Crossref")
180
180
  end
181
181
 
182
+ it "dataset usda" do
183
+ input = "https://doi.org/10.2737/RDS-2018-0001"
184
+ subject = Bolognese::Metadata.new(input: input)
185
+ #expect(subject.valid?).to be true
186
+ expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.2737/rds-2018-0001", "identifierType"=>"DOI"}])
187
+ expect(subject.url).to eq("https://www.fs.usda.gov/rds/archive/Product/RDS-2018-0001")
188
+ expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceType"=>"Dataset", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
189
+ expect(subject.creators.length).to eq(4)
190
+ expect(subject.creators.first).to eq("familyName" => "Ribic","givenName" => "Christine A.","name" => "Ribic, Christine A.","nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-2583-1778", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}],"nameType" => "Personal")
191
+ expect(subject.titles).to eq([{"title"=>"Fledging times of grassland birds"}])
192
+ expect(subject.descriptions).to be_empty
193
+ expect(subject.dates).to eq([{"date"=>"2017-08-09", "dateType"=>"Issued"}, {"date"=>"2018-07-13T19:35:20Z", "dateType"=>"Updated"}])
194
+ expect(subject.publication_year).to eq("2017")
195
+ expect(subject.publisher).to eq("USDA Forest Service")
196
+ expect(subject.agency).to eq("Crossref")
197
+ end
198
+
182
199
  it "book chapter" do
183
200
  input = "https://doi.org/10.1007/978-3-662-46370-3_13"
184
201
  subject = Bolognese::Metadata.new(input: input)
@@ -260,7 +277,7 @@ describe Bolognese::Metadata, vcr: true do
260
277
  it "JaLC" do
261
278
  input = "https://doi.org/10.1241/johokanri.39.979"
262
279
  subject = Bolognese::Metadata.new(input: input)
263
- #expect(subject.valid?).to be true
280
+ expect(subject.valid?).to be true
264
281
  expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.1241/johokanri.39.979", "identifierType"=>"DOI"}])
265
282
  expect(subject.url).to eq("http://joi.jlc.jst.go.jp/JST.JSTAGE/johokanri/39.979?from=CrossRef")
266
283
  expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
@@ -832,6 +832,7 @@ files:
832
832
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/another_book_chapter.yml
833
833
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/book_chapter.yml
834
834
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/dataset.yml
835
+ - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/dataset_usda.yml
835
836
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/date_in_future.yml
836
837
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/journal_article.yml
837
838
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/journal_article_with.yml