commonmeta-ruby 3.7.3 → 3.8.0

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: e3a1f9e1a7b45f6e17fefa1733d0d5e7bf7de101ce8105cd52476807aadcdedc
4
- data.tar.gz: '086ce7969801a3818fa130b91d62f8d4fc87419ceb5bc0080f2ff53dfcc124bb'
3
+ metadata.gz: acaeef11b787265fa53f7997c4d6d8d4942f786eb633b1b32df5e0d09b5752a6
4
+ data.tar.gz: 675258b94dc8cc1bbb327f88f7ae7b86b104af5d27b9c44d74172630d1bf6ed7
5
5
  SHA512:
6
- metadata.gz: 4fc08586e8d3f110cc9c78e846c760021fff2a40cf4f956db5aa6ff22b0601aaf26c83a774188f5563296ab12bb2314c594bde4e524cd4d01dddd180ce301a0e
7
- data.tar.gz: e670c12e402babbbcd01efe1deefbbcf3e61bda8060ae878dd0a90ea77e1895e7ba77b02a403b5537449129dadf380569de749e6c78c022cda2cffdaf3a107fe
6
+ metadata.gz: 1eab3f0ee1f997259b8c9b0e0aa9d3458277ca41b81e67013153fb65bbfaed149b35548866728d8c26d5f9c2b71dc6935a8d69a25c91b62ceca3896445920af0
7
+ data.tar.gz: 2d725b722aee5c0829ec8e5d037f83c3939acf138aa4b312ed3c417772ff8e327ca32ea638493b73151f011417231a49bb91f5d0d176e9544f8a0b4599aa4ea4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- commonmeta-ruby (3.7.3)
4
+ commonmeta-ruby (3.8.0)
5
5
  activesupport (>= 4.2.5, < 8.0)
6
6
  addressable (~> 2.8.1, < 2.8.2)
7
7
  base32-url (>= 0.7.0, < 1)
@@ -44,8 +44,9 @@ GEM
44
44
  uuidtools (~> 2.1, >= 2.1.5)
45
45
  base64 (0.2.0)
46
46
  bcp47_spec (0.2.1)
47
- bibtex-ruby (6.0.0)
47
+ bibtex-ruby (6.1.0)
48
48
  latex-decode (~> 0.0)
49
+ racc (~> 1.7)
49
50
  bigdecimal (3.1.5)
50
51
  builder (3.2.4)
51
52
  citeproc (1.0.10)
@@ -67,7 +68,7 @@ GEM
67
68
  csl (~> 2.0)
68
69
  diff-lcs (1.5.0)
69
70
  docile (1.4.0)
70
- domain_name (0.6.20231109)
71
+ domain_name (0.6.20240107)
71
72
  drb (2.2.0)
72
73
  ruby2_keywords
73
74
  ebnf (2.5.0)
@@ -135,13 +136,13 @@ GEM
135
136
  multi_json (1.15.0)
136
137
  mutex_m (0.2.0)
137
138
  namae (1.1.1)
138
- nokogiri (1.15.5-arm64-darwin)
139
+ nokogiri (1.16.0-arm64-darwin)
139
140
  racc (~> 1.4)
140
141
  oj (3.16.3)
141
142
  bigdecimal (>= 3.0)
142
143
  optimist (3.1.0)
143
144
  parallel (1.24.0)
144
- parser (3.2.2.4)
145
+ parser (3.3.0.2)
145
146
  ast (~> 2.4.1)
146
147
  racc
147
148
  postrank-uri (1.1)
@@ -171,7 +172,7 @@ GEM
171
172
  rdf-xsd (3.3.0)
172
173
  rdf (~> 3.3)
173
174
  rexml (~> 3.2)
174
- regexp_parser (2.8.3)
175
+ regexp_parser (2.9.0)
175
176
  rexml (3.2.6)
176
177
  rspec (3.12.0)
177
178
  rspec-core (~> 3.12.0)
@@ -202,16 +203,16 @@ GEM
202
203
  unicode-display_width (>= 2.4.0, < 3.0)
203
204
  rubocop-ast (1.30.0)
204
205
  parser (>= 3.2.1.0)
205
- rubocop-capybara (2.19.0)
206
+ rubocop-capybara (2.20.0)
206
207
  rubocop (~> 1.41)
207
- rubocop-factory_bot (2.24.0)
208
- rubocop (~> 1.33)
209
- rubocop-performance (1.20.1)
208
+ rubocop-factory_bot (2.25.1)
209
+ rubocop (~> 1.41)
210
+ rubocop-performance (1.20.2)
210
211
  rubocop (>= 1.48.1, < 2.0)
211
212
  rubocop-ast (>= 1.30.0, < 2.0)
212
213
  rubocop-rake (0.6.0)
213
214
  rubocop (~> 1.0)
214
- rubocop-rspec (2.25.0)
215
+ rubocop-rspec (2.26.1)
215
216
  rubocop (~> 1.40)
216
217
  rubocop-capybara (~> 2.17)
217
218
  rubocop-factory_bot (~> 2.22)
@@ -342,11 +342,17 @@ module Commonmeta
342
342
  return xml if doi_from_url(id).blank? || url.blank?
343
343
 
344
344
  xml.doi_data do
345
- xml.doi(doi_from_url(id).downcase)
345
+ doi = doi_from_url(id).downcase
346
+ xml.doi(doi)
346
347
  xml.resource(url)
347
348
  xml.collection("property" => "text-mining") do
348
349
  xml.item do
349
350
  xml.resource(url, "mime_type" => "text/html")
351
+ if is_rogue_scholar_doi?(doi)
352
+ Array.wrap(files).each do |file|
353
+ xml.resource(file["url"], "mime_type" => file["mimeType"])
354
+ end
355
+ end
350
356
  end
351
357
  end
352
358
  end
@@ -77,5 +77,10 @@ module Commonmeta
77
77
 
78
78
  { 'id' => "https://api.crossref.org/members/#{member_id}", 'name' => name }
79
79
  end
80
+
81
+ def is_rogue_scholar_doi?(doi)
82
+ prefix = validate_prefix(doi)
83
+ %w[10.34732 10.53731 10.54900 10.57689 10.59348 10.59349 10.59350].include?(prefix)
84
+ end
80
85
  end
81
86
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: truefiles
2
2
 
3
- require_relative 'metadata_utils'
3
+ require_relative "metadata_utils"
4
4
 
5
5
  module Commonmeta
6
6
  class Metadata
@@ -10,7 +10,11 @@ module Commonmeta
10
10
  :email, :registrant
11
11
  attr_reader :doc, :page_start, :page_end
12
12
  attr_writer :id, :provider_id, :client_id, :doi, :alternate_identifiers, :contributors,
13
- :titles, :publisher, :license, :date, :volume, :url, :version, :subjects, :descriptions, :language, :sizes, :formats, :schema_version, :meta, :container, :provider, :format, :funding_references, :state, :geo_locations, :type, :additional_type, :files, :references, :related_identifiers, :related_items, :style, :locale, :archive_locations
13
+ :titles, :publisher, :license, :date, :volume, :url, :version, :subjects,
14
+ :descriptions, :language, :sizes, :formats, :schema_version, :meta, :container,
15
+ :provider, :format, :funding_references, :state, :geo_locations, :type,
16
+ :additional_type, :files, :references, :related_identifiers, :related_items,
17
+ :style, :locale, :archive_locations
14
18
 
15
19
  def initialize(options = {})
16
20
  options.symbolize_keys!
@@ -23,29 +27,29 @@ module Commonmeta
23
27
 
24
28
  # mEDRA, KISTI, JaLC and OP DOIs are found in the Crossref index
25
29
  case @from
26
- when 'medra'
27
- ra = 'mEDRA'
28
- when 'kisti'
29
- ra = 'KISTI'
30
- when 'jalc'
31
- ra = 'JaLC'
32
- when 'op'
33
- ra = 'OP'
30
+ when "medra"
31
+ ra = "mEDRA"
32
+ when "kisti"
33
+ ra = "KISTI"
34
+ when "jalc"
35
+ ra = "JaLC"
36
+ when "op"
37
+ ra = "OP"
34
38
  end
35
39
 
36
40
  # generate name for method to call dynamically
37
41
  hsh = @from.present? ? send("get_#{@from}", id: id, **options) : {}
38
- string = hsh.fetch('string', nil)
42
+ string = hsh.fetch("string", nil)
39
43
  elsif options[:input].present? && File.exist?(options[:input])
40
44
  filename = File.basename(options[:input])
41
45
  ext = File.extname(options[:input])
42
46
  if %w[.bib .ris .xml .json .cff].include?(ext)
43
47
  hsh = {
44
- 'url' => options[:url],
45
- 'state' => options[:state],
46
- 'provider_id' => options[:provider_id],
47
- 'client_id' => options[:client_id],
48
- 'files' => options[:files]
48
+ "url" => options[:url],
49
+ "state" => options[:state],
50
+ "provider_id" => options[:provider_id],
51
+ "client_id" => options[:client_id],
52
+ "files" => options[:files],
49
53
  }
50
54
  string = File.read(options[:input])
51
55
  @from = options[:from] || find_from_format(string: string, ext: ext)
@@ -55,14 +59,14 @@ module Commonmeta
55
59
  end
56
60
  else
57
61
  hsh = {
58
- 'url' => options[:url],
59
- 'state' => options[:state],
60
- 'provider_id' => options[:provider_id],
61
- 'client_id' => options[:client_id],
62
- 'files' => options[:files],
63
- 'contributors' => options[:contributors],
64
- 'titles' => options[:titles],
65
- 'publisher' => options[:publisher]
62
+ "url" => options[:url],
63
+ "state" => options[:state],
64
+ "provider_id" => options[:provider_id],
65
+ "client_id" => options[:client_id],
66
+ "files" => options[:files],
67
+ "contributors" => options[:contributors],
68
+ "titles" => options[:titles],
69
+ "publisher" => options[:publisher],
66
70
  }
67
71
  string = options[:input]
68
72
  @from = options[:from] || find_from_format(string: string)
@@ -70,7 +74,7 @@ module Commonmeta
70
74
 
71
75
  # make sure input is encoded as utf8
72
76
  if string.present? && string.is_a?(String)
73
- dup_string = string.dup.force_encoding('UTF-8').encode!
77
+ dup_string = string.dup.force_encoding("UTF-8").encode!
74
78
  end
75
79
  @string = dup_string
76
80
 
@@ -81,11 +85,11 @@ module Commonmeta
81
85
  @sandbox = options[:sandbox]
82
86
 
83
87
  # options that come from the datacite database
84
- @url = hsh.to_h['url'].presence || options[:url].presence
85
- @state = hsh.to_h['state'].presence
86
- @provider_id = hsh.to_h['provider_id'].presence
87
- @client_id = hsh.to_h['client_id'].presence
88
- @files = hsh.to_h['files'].presence
88
+ @url = hsh.to_h["url"].presence || options[:url].presence
89
+ @state = hsh.to_h["state"].presence
90
+ @provider_id = hsh.to_h["provider_id"].presence
91
+ @client_id = hsh.to_h["client_id"].presence
92
+ @files = hsh.to_h["files"].presence
89
93
 
90
94
  # options that come from the cli, needed
91
95
  # for crossref doi registration
@@ -125,23 +129,23 @@ module Commonmeta
125
129
  end
126
130
 
127
131
  def id
128
- @id ||= meta.fetch('id', nil)
132
+ @id ||= meta.fetch("id", nil)
129
133
  end
130
134
 
131
135
  def doi
132
- @doi ||= meta.fetch('doi', nil)
136
+ @doi ||= meta.fetch("doi", nil)
133
137
  end
134
138
 
135
139
  def provider_id
136
- @provider_id ||= meta.fetch('provider_id', nil)
140
+ @provider_id ||= meta.fetch("provider_id", nil)
137
141
  end
138
142
 
139
143
  def client_id
140
- @client_id ||= meta.fetch('client_id', nil)
144
+ @client_id ||= meta.fetch("client_id", nil)
141
145
  end
142
146
 
143
147
  def exists?
144
- (@state || meta.fetch('state', nil)) != 'not_found'
148
+ (@state || meta.fetch("state", nil)) != "not_found"
145
149
  end
146
150
 
147
151
  def valid?
@@ -151,111 +155,111 @@ module Commonmeta
151
155
  # Catch errors in the reader
152
156
  # Then validate against JSON schema for Commonmeta
153
157
  def errors
154
- meta.fetch('errors', nil) || json_schema_errors
158
+ meta.fetch("errors", nil) || json_schema_errors
155
159
  end
156
160
 
157
161
  def descriptions
158
- @descriptions ||= meta.fetch('descriptions', nil)
162
+ @descriptions ||= meta.fetch("descriptions", nil)
159
163
  end
160
164
 
161
165
  def license
162
- @license ||= meta.fetch('license', nil)
166
+ @license ||= meta.fetch("license", nil)
163
167
  end
164
168
 
165
169
  def subjects
166
- @subjects ||= meta.fetch('subjects', nil)
170
+ @subjects ||= meta.fetch("subjects", nil)
167
171
  end
168
172
 
169
173
  def language
170
- @language ||= meta.fetch('language', nil)
174
+ @language ||= meta.fetch("language", nil)
171
175
  end
172
176
 
173
177
  def sizes
174
- @sizes ||= meta.fetch('sizes', nil)
178
+ @sizes ||= meta.fetch("sizes", nil)
175
179
  end
176
180
 
177
181
  def formats
178
- @formats ||= meta.fetch('formats', nil)
182
+ @formats ||= meta.fetch("formats", nil)
179
183
  end
180
184
 
181
185
  def schema_version
182
- @schema_version ||= meta.fetch('schema_version', nil)
186
+ @schema_version ||= meta.fetch("schema_version", nil)
183
187
  end
184
188
 
185
189
  def funding_references
186
- @funding_references ||= meta.fetch('funding_references', nil)
190
+ @funding_references ||= meta.fetch("funding_references", nil)
187
191
  end
188
192
 
189
193
  def references
190
- @references ||= meta.fetch('references', nil)
194
+ @references ||= meta.fetch("references", nil)
191
195
  end
192
196
 
193
197
  def related_identifiers
194
- @related_identifiers ||= meta.fetch('related_identifiers', nil)
198
+ @related_identifiers ||= meta.fetch("related_identifiers", nil)
195
199
  end
196
200
 
197
201
  def related_items
198
- @related_items ||= meta.fetch('related_items', nil)
202
+ @related_items ||= meta.fetch("related_items", nil)
199
203
  end
200
204
 
201
205
  def url
202
- @url ||= meta.fetch('url', nil)
206
+ @url ||= meta.fetch("url", nil)
203
207
  end
204
208
 
205
209
  def version
206
- @version ||= meta.fetch('version', nil)
210
+ @version ||= meta.fetch("version", nil)
207
211
  end
208
212
 
209
213
  def container
210
- @container ||= meta.fetch('container', nil)
214
+ @container ||= meta.fetch("container", nil)
211
215
  end
212
216
 
213
217
  def geo_locations
214
- @geo_locations ||= meta.fetch('geo_locations', nil)
218
+ @geo_locations ||= meta.fetch("geo_locations", nil)
215
219
  end
216
220
 
217
221
  def date
218
- @date ||= meta.fetch('date', nil)
222
+ @date ||= meta.fetch("date", nil)
219
223
  end
220
224
 
221
225
  def publisher
222
- @publisher ||= meta.fetch('publisher', nil)
226
+ @publisher ||= meta.fetch("publisher", nil)
223
227
  end
224
228
 
225
229
  def alternate_identifiers
226
- @alternate_identifiers ||= meta.fetch('alternate_identifiers', nil)
230
+ @alternate_identifiers ||= meta.fetch("alternate_identifiers", nil)
227
231
  end
228
232
 
229
233
  def files
230
- @files ||= meta.fetch('files', nil)
234
+ @files ||= meta.fetch("files", nil)
231
235
  end
232
236
 
233
237
  def provider
234
- @provider ||= meta.fetch('provider', nil)
238
+ @provider ||= meta.fetch("provider", nil)
235
239
  end
236
240
 
237
241
  def state
238
- @state ||= meta.fetch('state', nil)
242
+ @state ||= meta.fetch("state", nil)
239
243
  end
240
244
 
241
245
  def type
242
- @type ||= meta.fetch('type', nil)
246
+ @type ||= meta.fetch("type", nil)
243
247
  end
244
248
 
245
249
  def additional_type
246
- @additional_type ||= meta.fetch('additional_type', nil)
250
+ @additional_type ||= meta.fetch("additional_type", nil)
247
251
  end
248
252
 
249
253
  def titles
250
- @titles ||= meta.fetch('titles', nil)
254
+ @titles ||= meta.fetch("titles", nil)
251
255
  end
252
256
 
253
257
  def contributors
254
- @contributors ||= meta.fetch('contributors', nil)
258
+ @contributors ||= meta.fetch("contributors", nil)
255
259
  end
256
260
 
257
261
  def archive_locations
258
- @archive_locations ||= meta.fetch('archive_locations', nil)
262
+ @archive_locations ||= meta.fetch("archive_locations", nil)
259
263
  end
260
264
  end
261
265
  end
@@ -69,7 +69,7 @@ module Commonmeta
69
69
  funding_references = get_funding_references(meta)
70
70
  related_identifiers = get_related_identifiers(meta)
71
71
  alternate_identifiers = [{ "alternateIdentifier" => meta["id"], "alternateIdentifierType" => "UUID" }]
72
-
72
+ files = get_files(id)
73
73
  archive_url = meta.fetch("archive_url", nil)
74
74
 
75
75
  if archive_url
@@ -99,10 +99,20 @@ module Commonmeta
99
99
  "funding_references" => funding_references.presence,
100
100
  "related_identifiers" => related_identifiers.presence,
101
101
  "alternate_identifiers" => alternate_identifiers,
102
+ "files" => files.presence,
102
103
  "archive_locations" => archive_locations,
103
104
  "state" => state }.compact.merge(read_options)
104
105
  end
105
106
 
107
+ def get_files(id)
108
+ doi = doi_from_url(id)
109
+ return nil unless is_rogue_scholar_doi?(doi)
110
+
111
+ [{ "mimeType" => "text/markdown", "url" => "https://api.rogue-scholar.org/posts/#{doi}.md" },
112
+ { "mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/#{doi}.pdf" },
113
+ { "mimeType" => "application/epub+zip", "url" => "https://api.rogue-scholar.org/posts/#{doi}.epub" }]
114
+ end
115
+
106
116
  def get_references(meta)
107
117
  # check that references resolve
108
118
  Array.wrap(meta["reference"]).reduce([]) do |sum, reference|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commonmeta
4
- VERSION = '3.7.3'
4
+ VERSION = '3.8.0'
5
5
  end
@@ -315,4 +315,18 @@ describe Commonmeta::Metadata, vcr: true do
315
315
  expect(response).to eq('10.5061')
316
316
  end
317
317
  end
318
+
319
+ context 'is_rogue_scholar_doi' do
320
+ it 'rogue scholar doi' do
321
+ doi = '10.53731/cjx855h-hn5jtq8'
322
+ response = subject.is_rogue_scholar_doi?(doi)
323
+ expect(response).to be true
324
+ end
325
+
326
+ it 'not a rogue scholar doi' do
327
+ doi = '10.1371/journal.pone.0000030'
328
+ response = subject.is_rogue_scholar_doi?(doi)
329
+ expect(response).to be false
330
+ end
331
+ end
318
332
  end
@@ -36,6 +36,8 @@ describe Commonmeta::Metadata, vcr: true do
36
36
  # expect(subject.valid?).to be true
37
37
  expect(subject.id).to eq("https://doi.org/10.53731/4nwxn-frt36")
38
38
  expect(subject.url).to eq("https://blog.front-matter.io/posts/does-it-compose")
39
+ expect(subject.files.length).to eq(3)
40
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.53731/4nwxn-frt36.pdf")
39
41
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "5bb66e92-5cb9-4659-8aca-20e486b695c9", "alternateIdentifierType" => "UUID" }])
40
42
  expect(subject.type).to eq("Article")
41
43
  expect(subject.contributors.length).to eq(1)
@@ -60,6 +62,8 @@ describe Commonmeta::Metadata, vcr: true do
60
62
  # expect(subject.valid?).to be true
61
63
  expect(subject.id).to eq("https://doi.org/10.53731/r79v4e1-97aq74v-ag578")
62
64
  expect(subject.url).to eq("https://blog.front-matter.io/posts/differences-between-orcid-and-datacite-metadata")
65
+ expect(subject.files.length).to eq(3)
66
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.53731/r79v4e1-97aq74v-ag578.pdf")
63
67
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "8a4de443-3347-4b82-b57d-e3c82b6485fc", "alternateIdentifierType" => "UUID" }])
64
68
  expect(subject.type).to eq("Article")
65
69
  expect(subject.contributors.length).to eq(1)
@@ -85,6 +89,8 @@ describe Commonmeta::Metadata, vcr: true do
85
89
  # expect(subject.valid?).to be true
86
90
  expect(subject.id).to eq("https://doi.org/10.53731/r294649-6f79289-8cw18")
87
91
  expect(subject.url).to eq("https://blog.front-matter.io/posts/nine-simple-ways-to-make-it-easier-to-re-use-your-data")
92
+ expect(subject.files.length).to eq(3)
93
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.53731/r294649-6f79289-8cw18.pdf")
88
94
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "2bdebfc5-e02e-42c2-90c5-e873e2d0435d", "alternateIdentifierType" => "UUID" }])
89
95
  expect(subject.type).to eq("Article")
90
96
  expect(subject.contributors.length).to eq(1)
@@ -110,6 +116,8 @@ describe Commonmeta::Metadata, vcr: true do
110
116
  # expect(subject.valid?).to be true
111
117
  expect(subject.id).to eq("https://doi.org/10.53731/r79s4nh-97aq74v-ag4t1")
112
118
  expect(subject.url).to eq("https://blog.front-matter.io/posts/tracking-the-growth-of-the-pid-graph")
119
+ expect(subject.files.length).to eq(3)
120
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.53731/r79s4nh-97aq74v-ag4t1.pdf")
113
121
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "e58dc9c8-b870-4db2-8896-238b3246c551", "alternateIdentifierType" => "UUID" }])
114
122
  expect(subject.type).to eq("Article")
115
123
  expect(subject.contributors.length).to eq(1)
@@ -187,6 +195,8 @@ describe Commonmeta::Metadata, vcr: true do
187
195
  # expect(subject.valid?).to be true
188
196
  expect(subject.id).to eq("https://doi.org/10.53731/ffbx660-083tnag")
189
197
  expect(subject.url).to eq("https://syldavia-gazette.org/guinea-worms-chatgpt-neanderthals")
198
+ expect(subject.files.length).to eq(3)
199
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.53731/ffbx660-083tnag.pdf")
190
200
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "0022b9ef-525a-4a79-81ad-13411697f58a", "alternateIdentifierType" => "UUID" }])
191
201
  expect(subject.type).to eq("Article")
192
202
  expect(subject.contributors.length).to eq(1)
@@ -210,6 +220,8 @@ describe Commonmeta::Metadata, vcr: true do
210
220
  # expect(subject.valid?).to be true
211
221
  expect(subject.id).to eq("https://doi.org/10.59350/kz04m-s8z58")
212
222
  expect(subject.url).to eq("https://wisspub.net/2023/05/23/eu-mitgliedstaaten-betonen-die-rolle-von-wissenschaftsgeleiteten-open-access-modellen-jenseits-von-apcs")
223
+ expect(subject.files.length).to eq(3)
224
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/kz04m-s8z58.pdf")
213
225
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "1c578558-1324-4493-b8af-84c49eabc52f", "alternateIdentifierType" => "UUID" }])
214
226
  expect(subject.type).to eq("Article")
215
227
  expect(subject.contributors.length).to eq(1)
@@ -234,14 +246,16 @@ describe Commonmeta::Metadata, vcr: true do
234
246
  # expect(subject.valid?).to be true
235
247
  expect(subject.id).to eq("https://doi.org/10.59350/faeph-x4x84")
236
248
  expect(subject.url).to eq("https://wayback.archive-it.org/22143/20231103191454/https://project-thor.eu/2016/08/10/orcid-integration-in-pangaea")
249
+ expect(subject.files.length).to eq(3)
250
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/faeph-x4x84.pdf")
237
251
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "570c8129-e867-49e6-8517-bd783627e76e", "alternateIdentifierType" => "UUID" }])
238
252
  expect(subject.type).to eq("Article")
239
253
  expect(subject.contributors.length).to eq(1)
240
254
  expect(subject.contributors.first).to eq("contributorRoles" => ["Author"],
241
- "type" => "Person",
242
- "familyName" => "Stocker",
243
- "givenName" => "Markus",
244
- "id" => "https://orcid.org/0000-0001-5492-3212")
255
+ "type" => "Person",
256
+ "familyName" => "Stocker",
257
+ "givenName" => "Markus",
258
+ "id" => "https://orcid.org/0000-0001-5492-3212")
245
259
  expect(subject.titles).to eq([{ "title" => "ORCID Integration Series: PANGAEA" }])
246
260
  expect(subject.license).to eq("id" => "CC-BY-4.0",
247
261
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
@@ -253,7 +267,7 @@ describe Commonmeta::Metadata, vcr: true do
253
267
  "subject" => "FOS: Computer and information sciences",
254
268
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
255
269
  expect(subject.language).to eq("en")
256
- expect(subject.funding_references).to eq([{ "awardNumber" => "654039", "funderIdentifier" => "https://doi.org/10.13039/501100007601", "funderIdentifierType"=>"Crossref Funder ID", "funderName" => "European Union’s Horizon 2020 research and innovation programme" }])
270
+ expect(subject.funding_references).to eq([{ "awardNumber" => "654039", "funderIdentifier" => "https://doi.org/10.13039/501100007601", "funderIdentifierType" => "Crossref Funder ID", "funderName" => "European Union’s Horizon 2020 research and innovation programme" }])
257
271
  expect(subject.container).to eq("identifier" => "https://project-thor.eu", "identifierType" => "URL", "title" => "Project THOR", "type" => "Periodical")
258
272
  expect(subject.archive_locations).to eq(["Internet Archive"])
259
273
  end
@@ -264,10 +278,12 @@ describe Commonmeta::Metadata, vcr: true do
264
278
  # expect(subject.valid?).to be true
265
279
  expect(subject.id).to eq("https://doi.org/10.59350/hke8v-d1e66")
266
280
  expect(subject.url).to eq("https://svpow.com/2023/06/09/new-paper-curtice-et-al-2023-on-the-first-haplocanthosaurus-from-dry-mesa")
281
+ expect(subject.files.length).to eq(3)
282
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/hke8v-d1e66.pdf")
267
283
  expect(subject.type).to eq("Article")
268
284
  expect(subject.contributors.length).to eq(1)
269
285
  expect(subject.contributors.first).to eq("familyName" => "Wedel", "givenName" => "Matt", "type" => "Person", "contributorRoles" => ["Author"])
270
- expect(subject.titles).to eq([{ "title" => "New paper: Curtice et al. (2023) on the first <i>Haplocanthosaurus</i> from Dry Mesa"}])
286
+ expect(subject.titles).to eq([{ "title" => "New paper: Curtice et al. (2023) on the first <i>Haplocanthosaurus</i> from Dry Mesa" }])
271
287
  expect(subject.license).to eq("id" => "CC-BY-4.0",
272
288
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
273
289
  expect(subject.date).to eq("published" => "2023-06-09", "updated" => "2023-06-09")
@@ -289,6 +305,8 @@ describe Commonmeta::Metadata, vcr: true do
289
305
  # expect(subject.valid?).to be true
290
306
  expect(subject.id).to eq("https://doi.org/10.59350/tpa8t-j6292")
291
307
  expect(subject.url).to eq("https://www.samuelmoore.org/2023/04/20/how-to-cultivate-good-closures-scaling-small-and-the-limits-of-openness")
308
+ expect(subject.files.length).to eq(3)
309
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/tpa8t-j6292.pdf")
292
310
  expect(subject.type).to eq("Article")
293
311
  expect(subject.contributors.length).to eq(1)
294
312
  expect(subject.contributors.first).to eq("familyName" => "Moore", "givenName" => "Samuel", "type" => "Person", "contributorRoles" => ["Author"])
@@ -313,6 +331,8 @@ describe Commonmeta::Metadata, vcr: true do
313
331
  # expect(subject.valid?).to be true
314
332
  expect(subject.id).to eq("https://doi.org/10.59350/tfahc-rp566")
315
333
  expect(subject.url).to eq("https://blog.oa.works/nature-features-oa-reports-work-putting-oa-policy-into-practice")
334
+ expect(subject.files.length).to eq(3)
335
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/tfahc-rp566.pdf")
316
336
  expect(subject.type).to eq("Article")
317
337
  expect(subject.contributors.length).to eq(1)
318
338
  expect(subject.contributors.first).to eq("name" => "OA.Works", "type" => "Organization", "contributorRoles" => ["Author"])
@@ -362,6 +382,8 @@ describe Commonmeta::Metadata, vcr: true do
362
382
  # expect(subject.valid?).to be true
363
383
  expect(subject.id).to eq("https://doi.org/10.59350/zwdq7-waa43")
364
384
  expect(subject.url).to eq("https://citationstyles.org/2020/07/11/seeking-public-comment-on-CSL-1-0-2")
385
+ expect(subject.files.length).to eq(3)
386
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/zwdq7-waa43.pdf")
365
387
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "efdacb04-bcec-49d7-b689-ab3eab0634bf", "alternateIdentifierType" => "UUID" }])
366
388
  expect(subject.type).to eq("Article")
367
389
  expect(subject.contributors.length).to eq(0)
@@ -387,6 +409,8 @@ describe Commonmeta::Metadata, vcr: true do
387
409
  # expect(subject.valid?).to be true
388
410
  expect(subject.id).to eq("https://doi.org/10.59350/2shz7-ehx26")
389
411
  expect(subject.url).to eq("https://libscie.org/ku-leuven-supports-researchequals")
412
+ expect(subject.files.length).to eq(3)
413
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/2shz7-ehx26.pdf")
390
414
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "5561f8e4-2ff1-4186-a8d5-8dacb3afe414", "alternateIdentifierType" => "UUID" }])
391
415
  expect(subject.type).to eq("Article")
392
416
  expect(subject.contributors.length).to eq(1)
@@ -412,6 +436,8 @@ describe Commonmeta::Metadata, vcr: true do
412
436
  # expect(subject.valid?).to be true
413
437
  expect(subject.id).to eq("https://doi.org/10.59350/33es7-fqz31")
414
438
  expect(subject.url).to eq("https://lab.sub.uni-goettingen.de/welcome.html")
439
+ expect(subject.files.length).to eq(3)
440
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/33es7-fqz31.pdf")
415
441
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "a163e340-5b3c-4736-9ab0-8c54fdff6a3c", "alternateIdentifierType" => "UUID" }])
416
442
  expect(subject.type).to eq("Article")
417
443
  expect(subject.contributors.length).to eq(1)
@@ -437,6 +463,8 @@ describe Commonmeta::Metadata, vcr: true do
437
463
  # expect(subject.valid?).to be true
438
464
  expect(subject.id).to eq("https://doi.org/10.59350/63055-a8604")
439
465
  expect(subject.url).to eq("http://sfmatheson.blogspot.com/2023/01/quintessence-of-dust-2023-restart-why.html")
466
+ expect(subject.files.length).to eq(3)
467
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/63055-a8604.pdf")
440
468
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "1898d2d7-4d87-4487-96c4-3073cf99e9a5", "alternateIdentifierType" => "UUID" }])
441
469
  expect(subject.type).to eq("Article")
442
470
  expect(subject.contributors.length).to eq(1)
@@ -462,6 +490,8 @@ describe Commonmeta::Metadata, vcr: true do
462
490
  # expect(subject.valid?).to be true
463
491
  expect(subject.id).to eq("https://doi.org/10.59350/9gfjs-pey70")
464
492
  expect(subject.url).to eq("https://flavoursofopen.science/grundlagen-fur-die-entwicklung-einer-open-scholarship-strategie")
493
+ expect(subject.files.length).to eq(3)
494
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/9gfjs-pey70.pdf")
465
495
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "f3dc29da-0481-4f3b-8110-4c07260fca67", "alternateIdentifierType" => "UUID" }])
466
496
  expect(subject.type).to eq("Article")
467
497
  expect(subject.contributors.length).to eq(1)
@@ -488,6 +518,8 @@ describe Commonmeta::Metadata, vcr: true do
488
518
  # expect(subject.valid?).to be true
489
519
  expect(subject.id).to eq("https://doi.org/10.59350/bbcsr-r4b59")
490
520
  expect(subject.url).to eq("https://markrubin.substack.com/p/the-preregistration-prescriptiveness")
521
+ expect(subject.files.length).to eq(3)
522
+ expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/bbcsr-r4b59.pdf")
491
523
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "2b105b29-acbc-4eae-9ff1-368803f36a4d", "alternateIdentifierType" => "UUID" }])
492
524
  expect(subject.type).to eq("Article")
493
525
  expect(subject.contributors.length).to eq(1)
@@ -57,7 +57,7 @@ describe Commonmeta::Metadata, vcr: true do
57
57
  "journal_article")
58
58
  expect(Array.wrap(crossref_xml.dig("contributors", "person_name")).length).to eq(6)
59
59
  expect(Array.wrap(crossref_xml.dig("contributors",
60
- "person_name")).first).to eq("contributor_role"=>"author", "given_name"=>"Markus", "sequence"=>"first", "surname"=>"Ralser")
60
+ "person_name")).first).to eq("contributor_role" => "author", "given_name" => "Markus", "sequence" => "first", "surname" => "Ralser")
61
61
  expect(crossref_xml.dig("titles",
62
62
  "title")).to eq("Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization–Not Catalytic Inactivity–of the Mutant Enzymes")
63
63
  end
@@ -232,6 +232,9 @@ describe Commonmeta::Metadata, vcr: true do
232
232
  "title")).to eq("Attempts at automating journal subject classification")
233
233
  expect(crossref_xml.dig("item_number")).to eq("__content__" => "5d14ffacb9ac4e20bdc0d9248df4e80d", "item_number_type" => "uuid")
234
234
  expect(crossref_xml.dig("group_title")).to eq("Humanities")
235
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource").length).to eq(4)
236
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource", 2)).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.54900/n6dnt-xpq48.pdf", "mime_type" => "application/pdf")
237
+
235
238
  end
236
239
 
237
240
  it "json_feed_item with references" do
@@ -264,6 +267,8 @@ describe Commonmeta::Metadata, vcr: true do
264
267
  expect(crossref_xml.dig("citation_list", "citation").last).to eq("article_title" => "The Research Software Alliance (ReSA) and the community landscape", "cYear" => "2020", "doi" => "10.5281/zenodo.3699950", "key" => "ref11")
265
268
  expect(crossref_xml.dig("item_number")).to eq("__content__" => "954f81380ecd409087c5cef1297f1470", "item_number_type" => "uuid")
266
269
  expect(crossref_xml.dig("group_title")).to eq("Humanities")
270
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource").length).to eq(4)
271
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource", 2)).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.54900/zwm7q-vet94.pdf", "mime_type" => "application/pdf")
267
272
  end
268
273
 
269
274
  it "json_feed_item from rogue scholar with doi" do
@@ -277,7 +282,7 @@ describe Commonmeta::Metadata, vcr: true do
277
282
  expect(subject.titles).to eq([{ "title" => "EU-Mitgliedstaaten betonen die Rolle von wissenschaftsgeleiteten Open-Access-Modellen jenseits von APCs" }])
278
283
  expect(subject.contributors.length).to eq(1)
279
284
  expect(subject.contributors.first).to eq("familyName" => "Pampel", "givenName" => "Heinz", "id" => "https://orcid.org/0000-0003-3334-2771", "type" => "Person", "contributorRoles" => ["Author"])
280
- expect(subject.publisher).to eq("name"=>"wisspub.net")
285
+ expect(subject.publisher).to eq("name" => "wisspub.net")
281
286
  expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
282
287
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
283
288
  "subject" => "FOS: Social sciences",
@@ -293,6 +298,8 @@ describe Commonmeta::Metadata, vcr: true do
293
298
  "title")).to eq("EU-Mitgliedstaaten betonen die Rolle von wissenschaftsgeleiteten Open-Access-Modellen jenseits von APCs")
294
299
  expect(crossref_xml.dig("item_number")).to eq("__content__" => "1c57855813244493b8af84c49eabc52f", "item_number_type" => "uuid")
295
300
  expect(crossref_xml.dig("group_title")).to eq("Social sciences")
301
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource").length).to eq(4)
302
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource", 2)).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.59350/9ry27-7cz42.pdf", "mime_type" => "application/pdf")
296
303
  end
297
304
 
298
305
  it "json_feed_item from rogue scholar with organizational author" do
@@ -321,6 +328,8 @@ describe Commonmeta::Metadata, vcr: true do
321
328
  "title")).to eq("KU Leuven supports ResearchEquals")
322
329
  expect(crossref_xml.dig("item_number")).to eq("__content__" => "5561f8e42ff14186a8d58dacb3afe414", "item_number_type" => "uuid")
323
330
  expect(crossref_xml.dig("group_title")).to eq("Social sciences")
331
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource").length).to eq(4)
332
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource", 2)).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.59350/9ry27-7cz42.pdf", "mime_type" => "application/pdf")
324
333
  end
325
334
 
326
335
  it "json_feed_item from rogue scholar with archived content" do
@@ -333,10 +342,10 @@ describe Commonmeta::Metadata, vcr: true do
333
342
  expect(subject.type).to eq("Article")
334
343
  expect(subject.contributors.length).to eq(1)
335
344
  expect(subject.contributors.first).to eq("contributorRoles" => ["Author"],
336
- "type" => "Person",
337
- "familyName" => "Stocker",
338
- "givenName" => "Markus",
339
- "id" => "https://orcid.org/0000-0001-5492-3212")
345
+ "type" => "Person",
346
+ "familyName" => "Stocker",
347
+ "givenName" => "Markus",
348
+ "id" => "https://orcid.org/0000-0001-5492-3212")
340
349
  expect(subject.titles).to eq([{ "title" => "ORCID Integration Series: PANGAEA" }])
341
350
  expect(subject.license).to eq("id" => "CC-BY-4.0",
342
351
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
@@ -348,18 +357,20 @@ describe Commonmeta::Metadata, vcr: true do
348
357
  "subject" => "FOS: Computer and information sciences",
349
358
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
350
359
  expect(subject.language).to eq("en")
351
- expect(subject.funding_references).to eq([{ "awardNumber" => "654039", "funderIdentifier" => "https://doi.org/10.13039/501100007601", "funderIdentifierType"=>"Crossref Funder ID", "funderName" => "European Union’s Horizon 2020 research and innovation programme" }])
360
+ expect(subject.funding_references).to eq([{ "awardNumber" => "654039", "funderIdentifier" => "https://doi.org/10.13039/501100007601", "funderIdentifierType" => "Crossref Funder ID", "funderName" => "European Union’s Horizon 2020 research and innovation programme" }])
352
361
  expect(subject.container).to eq("identifier" => "https://project-thor.eu", "identifierType" => "URL", "title" => "Project THOR", "type" => "Periodical")
353
362
  expect(subject.archive_locations).to eq(["Internet Archive"])
354
363
  # puts subject.crossref_xml
355
364
  crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
356
365
  expect(Array.wrap(crossref_xml.dig("contributors", "person_name")).length).to eq(1)
357
366
  expect(Array.wrap(crossref_xml.dig("contributors",
358
- "person_name")).first).to eq("ORCID"=>"https://orcid.org/0000-0001-5492-3212", "contributor_role"=>"author", "given_name"=>"Markus", "sequence"=>"first", "surname"=>"Stocker")
367
+ "person_name")).first).to eq("ORCID" => "https://orcid.org/0000-0001-5492-3212", "contributor_role" => "author", "given_name" => "Markus", "sequence" => "first", "surname" => "Stocker")
359
368
  expect(crossref_xml.dig("titles",
360
369
  "title")).to eq("ORCID Integration Series: PANGAEA")
361
370
  expect(crossref_xml.dig("item_number")).to eq("__content__" => "570c8129e86749e68517bd783627e76e", "item_number_type" => "uuid")
362
371
  expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
372
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource").length).to eq(4)
373
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource", 2)).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.59350/faeph-x4x84.pdf", "mime_type" => "application/pdf")
363
374
  end
364
375
 
365
376
  it "json_feed_item from rogue scholar with relations" do
@@ -397,6 +408,8 @@ describe Commonmeta::Metadata, vcr: true do
397
408
  "title")).to eq("Differences between ORCID and DataCite Metadata")
398
409
  expect(crossref_xml.dig("item_number")).to eq("__content__" => "8a4de44333474b82b57de3c82b6485fc", "item_number_type" => "uuid")
399
410
  expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
411
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource").length).to eq(4)
412
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource", 2)).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.53731/r79v4e1-97aq74v-ag578.pdf", "mime_type" => "application/pdf")
400
413
  end
401
414
 
402
415
  it "json_feed_item from rogue scholar with relations and funding" do
@@ -433,6 +446,8 @@ describe Commonmeta::Metadata, vcr: true do
433
446
  "title")).to eq("Tracking the Growth of the PID Graph")
434
447
  expect(crossref_xml.dig("item_number")).to eq("__content__" => "e58dc9c8b8704db28896238b3246c551", "item_number_type" => "uuid")
435
448
  expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
449
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource").length).to eq(4)
450
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource", 2)).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.53731/r79s4nh-97aq74v-ag4t1.pdf", "mime_type" => "application/pdf")
436
451
  end
437
452
 
438
453
  it "json_feed_item from rogue scholar with anonymous author" do
@@ -466,6 +481,8 @@ describe Commonmeta::Metadata, vcr: true do
466
481
  "title")).to eq("Welcome to the Lab")
467
482
  expect(crossref_xml.dig("item_number")).to eq("__content__" => "a163e3405b3c47369ab08c54fdff6a3c", "item_number_type" => "uuid")
468
483
  expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
484
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource").length).to eq(4)
485
+ expect(crossref_xml.dig("doi_data", "collection", "item", "resource", 2)).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.59350/9ry27-7cz42.pdf", "mime_type" => "application/pdf")
469
486
  end
470
487
  end
471
488
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonmeta-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.3
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-25 00:00:00.000000000 Z
11
+ date: 2024-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport