commonmeta-ruby 3.3.7 → 3.3.9

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.
@@ -174,6 +174,54 @@ describe Commonmeta::Metadata, vcr: true do
174
174
  expect(subject.references.length).to eq(3)
175
175
  expect(subject.references.first).to eq("key" => "ref1", "url" => "https://sauroposeidon.files.wordpress.com/2010/04/foster-and-wedel-2014-haplocanthosaurus-from-snowmass-colorado.pdf")
176
176
  end
177
+
178
+ it "wordpress post with tracking code on url" do
179
+ input = "https://rogue-scholar.org/api/posts/5d95d90d-ff59-4c8b-b7f8-44e6b45fd593"
180
+ subject = described_class.new(input: input)
181
+ puts subject.errors
182
+ # expect(subject.valid?).to be true
183
+ expect(subject.id).to eq("https://doi.org/10.59350/tpa8t-j6292")
184
+ expect(subject.url).to eq("https://www.samuelmoore.org/2023/04/20/how-to-cultivate-good-closures-scaling-small-and-the-limits-of-openness")
185
+ expect(subject.type).to eq("Article")
186
+ expect(subject.creators.length).to eq(1)
187
+ expect(subject.creators.first).to eq("familyName"=>"Moore", "givenName"=>"Samuel", "id"=>"https://orcid.org/0000-0002-0504-2897", "type"=>"Person")
188
+ expect(subject.titles).to eq([{ "title" => "How to cultivate good closures: ‘scaling small’ and the limits of openness" }])
189
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
190
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
191
+ expect(subject.date).to eq("published"=>"2023-04-20", "updated"=>"2023-06-19")
192
+ expect(subject.descriptions.first["description"]).to start_with("Text of a talk given to the COPIM end-of-project conference")
193
+ expect(subject.publisher).to eq("name" => "Samuel Moore")
194
+ expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
195
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
196
+ "subject" => "FOS: Social sciences",
197
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
198
+ expect(subject.language).to eq("en")
199
+ expect(subject.container).to eq("identifier" => "https://www.samuelmoore.org/", "identifierType" => "URL", "title" => "Samuel Moore", "type" => "Periodical")
200
+ expect(subject.references).to be_nil
201
+ end
202
+
203
+ it "ghost post with institutional author" do
204
+ input = "https://rogue-scholar.org/api/posts/2b3cdd27-5123-4167-9482-3c074392e2d2"
205
+ subject = described_class.new(input: input)
206
+ expect(subject.valid?).to be true
207
+ expect(subject.id).to eq("https://blog.oa.works/nature-features-oa-reports-work-putting-oa-policy-into-practice")
208
+ expect(subject.url).to eq("https://blog.oa.works/nature-features-oa-reports-work-putting-oa-policy-into-practice")
209
+ expect(subject.type).to eq("Article")
210
+ expect(subject.creators.length).to eq(1)
211
+ expect(subject.creators.first).to eq("name"=>"OA.Works", "type"=>"Organization")
212
+ expect(subject.titles).to eq([{ "title" => "Nature features OA.Report's work putting OA policy into practice!" }])
213
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
214
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
215
+ expect(subject.date).to eq("published" => "2023-01-24")
216
+ expect(subject.descriptions.first["description"]).to start_with("After a couple of years of working to support institutions implementing their OA policies")
217
+ expect(subject.publisher).to eq("name" => "OA.Works Blog")
218
+ expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
219
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
220
+ "subject" => "FOS: Engineering and technology",
221
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
222
+ expect(subject.language).to eq("en")
223
+ expect(subject.container).to eq("identifier" => "https://blog.oa.works/", "identifierType" => "URL", "title" => "OA.Works Blog", "type" => "Periodical")
224
+ end
177
225
 
178
226
  it "upstream post with references" do
179
227
  input = "https://rogue-scholar.org/api/posts/954f8138-0ecd-4090-87c5-cef1297f1470"
@@ -228,8 +276,7 @@ describe Commonmeta::Metadata, vcr: true do
228
276
  it "ghost post with organizational author" do
229
277
  input = "https://rogue-scholar.org/api/posts/5561f8e4-2ff1-4186-a8d5-8dacb3afe414"
230
278
  subject = described_class.new(input: input)
231
- puts subject.errors
232
- # expect(subject.valid?).to be true
279
+ expect(subject.valid?).to be true
233
280
  expect(subject.id).to eq("https://libscie.org/ku-leuven-supports-researchequals")
234
281
  expect(subject.url).to eq("https://libscie.org/ku-leuven-supports-researchequals")
235
282
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "5561f8e4-2ff1-4186-a8d5-8dacb3afe414", "alternateIdentifierType" => "UUID" }])
@@ -251,6 +298,31 @@ describe Commonmeta::Metadata, vcr: true do
251
298
  expect(subject.references).to be_nil
252
299
  end
253
300
 
301
+ it "jekyll post with anonymous author" do
302
+ input = "https://rogue-scholar.org/api/posts/a163e340-5b3c-4736-9ab0-8c54fdff6a3c"
303
+ subject = described_class.new(input: input)
304
+ expect(subject.valid?).to be true
305
+ expect(subject.id).to eq("https://doi.org/10.59350/g6bth-b6f85")
306
+ expect(subject.url).to eq("https://lab.sub.uni-goettingen.de/welcome.html")
307
+ expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "a163e340-5b3c-4736-9ab0-8c54fdff6a3c", "alternateIdentifierType" => "UUID" }])
308
+ expect(subject.type).to eq("Article")
309
+ expect(subject.creators.length).to eq(1)
310
+ expect(subject.creators.first).to eq("affiliation"=>[{"id"=>"https://ror.org/05745n787"}], "type"=>"Person")
311
+ expect(subject.titles).to eq([{ "title" => "Welcome to the Lab" }])
312
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
313
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
314
+ expect(subject.date).to eq("published"=>"2017-01-01", "updated"=>"2017-01-01")
315
+ expect(subject.descriptions.first["description"]).to start_with("Welcome everyone!")
316
+ expect(subject.publisher).to eq("name" => "lab.sub - Articles")
317
+ expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
318
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
319
+ "subject" => "FOS: Engineering and technology",
320
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
321
+ expect(subject.language).to eq("en")
322
+ expect(subject.container).to eq("identifier" => "https://lab.sub.uni-goettingen.de/", "identifierType" => "URL", "title" => "lab.sub - Articles", "type" => "Periodical")
323
+ expect(subject.references).to be_nil
324
+ end
325
+
254
326
  it "blog post with non-url id" do
255
327
  input = "https://rogue-scholar.org/api/posts/1898d2d7-4d87-4487-96c4-3073cf99e9a5"
256
328
  subject = described_class.new(input: input)
@@ -50,7 +50,7 @@ describe Commonmeta::Metadata, vcr: true do
50
50
  expect(subject.state).to eq('not_found')
51
51
  expect(subject.id).to eq('https://doi.org/10.7554/elife.01567')
52
52
  expect(subject.type).to eq('Dissertation')
53
- expect(subject.creators).to eq([{ 'name' => 'Toparlar,Y.' }])
53
+ expect(subject.creators).to eq([{"familyName"=>"Toparlar", "givenName"=>"Y.", "type"=>"Person"}])
54
54
  expect(subject.titles).to eq([{ 'title' => 'A multiscale analysis of the urban heat island effect' }])
55
55
  expect(subject.descriptions.first['description']).to start_with('Designing the climates of cities')
56
56
  expect(subject.date).to eq('created' => '2018-04-25', 'published' => '2018-04-25')
@@ -153,9 +153,7 @@ describe Commonmeta::Metadata, vcr: true do
153
153
  expect(subject.titles).to eq([{ 'title' => 'Summary data ankylosing spondylitis GWAS' }])
154
154
  expect(subject.container).to eq('identifier' => 'https://dataverse.harvard.edu',
155
155
  'identifierType' => 'URL', 'title' => 'Harvard Dataverse', 'type' => 'DataRepository')
156
- expect(subject.creators).to eq([{
157
- 'name' => 'International Genetics of Ankylosing Spondylitis Consortium (IGAS)'
158
- }])
156
+ expect(subject.creators).to eq([{"name"=>"International Genetics of Ankylosing Spondylitis Consortium (IGAS)", "type"=>"Organization"}])
159
157
  expect(subject.subjects).to eq([{ 'subject' => 'Medicine, health and life sciences' },
160
158
  { 'subject' => 'genome-wide association studies' },
161
159
  { 'subject' => 'Ankylosing spondylitis' }])
@@ -279,11 +279,44 @@ describe Commonmeta::Metadata, vcr: true do
279
279
  crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
280
280
  expect(Array.wrap(crossref_xml.dig("contributors", "organization")).length).to eq(1)
281
281
  expect(Array.wrap(crossref_xml.dig("contributors",
282
- "organization")).first).to eq("contributor_role"=>"author", "name"=>"Liberate Science", "sequence"=>"first")
282
+ "organization")).first).to eq("__content__"=>"Liberate Science", "contributor_role"=>"author", "sequence"=>"first")
283
283
  expect(crossref_xml.dig("titles",
284
284
  "title")).to eq("KU Leuven supports ResearchEquals")
285
285
  expect(crossref_xml.dig('item_number')).to eq("__content__"=>"5561f8e42ff14186a8d58dacb3afe414", "item_number_type"=>"uuid")
286
286
  expect(crossref_xml.dig('group_title')).to eq('Social sciences')
287
287
  end
288
+
289
+ it "json_feed_item from rogue scholar with anonymous author" do
290
+ input = "https://rogue-scholar.org/api/posts/a163e340-5b3c-4736-9ab0-8c54fdff6a3c"
291
+ subject = described_class.new(input: input, doi: "10.59350/9ry27-7cz42")
292
+
293
+ expect(subject.id).to eq("https://doi.org/10.59350/9ry27-7cz42")
294
+ expect(subject.url).to eq("https://lab.sub.uni-goettingen.de/welcome.html")
295
+ expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "a163e340-5b3c-4736-9ab0-8c54fdff6a3c", "alternateIdentifierType" => "UUID" }])
296
+ expect(subject.type).to eq("Article")
297
+ expect(subject.creators.length).to eq(1)
298
+ expect(subject.creators.first).to eq("affiliation"=>[{"id"=>"https://ror.org/05745n787"}], "type"=>"Person")
299
+ expect(subject.titles).to eq([{ "title" => "Welcome to the Lab" }])
300
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
301
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
302
+ expect(subject.date).to eq("published"=>"2017-01-01", "updated"=>"2017-01-01")
303
+ expect(subject.descriptions.first["description"]).to start_with("Welcome everyone!")
304
+ expect(subject.publisher).to eq("name" => "lab.sub - Articles")
305
+ expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
306
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
307
+ "subject" => "FOS: Engineering and technology",
308
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
309
+ expect(subject.language).to eq("en")
310
+ expect(subject.container).to eq("identifier" => "https://lab.sub.uni-goettingen.de/", "identifierType" => "URL", "title" => "lab.sub - Articles", "type" => "Periodical")
311
+ expect(subject.references).to be_nil
312
+ crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
313
+ expect(Array.wrap(crossref_xml.dig("contributors", "anonymous")).length).to eq(1)
314
+ expect(Array.wrap(crossref_xml.dig("contributors",
315
+ "anonymous")).first).to eq("affiliations"=>{"institution"=>{"institution_id"=>{"__content__"=>"https://ror.org/05745n787", "type"=>"ror"}}}, "contributor_role"=>"author", "sequence"=>"first")
316
+ expect(crossref_xml.dig("titles",
317
+ "title")).to eq("Welcome to the Lab")
318
+ expect(crossref_xml.dig('item_number')).to eq("__content__"=>"a163e3405b3c47369ab08c54fdff6a3c", "item_number_type"=>"uuid")
319
+ expect(crossref_xml.dig('group_title')).to eq('Engineering and technology')
320
+ end
288
321
  end
289
322
  end
@@ -177,7 +177,7 @@ describe Commonmeta::Metadata, vcr: true do
177
177
  expect(json['@id']).to eq('https://doi.org/10.23725/8na3-9s47')
178
178
  expect(json['@type']).to eq('Dataset')
179
179
  expect(json['name']).to eq('NWD165827.recab.cram')
180
- expect(json['author']).to eq('name' => 'TOPMed')
180
+ expect(json['author']).to eq("@type"=>"Organization", "name"=>"TOPMed")
181
181
  expect(json['includedInDataCatalog']).to be_empty
182
182
  expect(json['identifier']).to eq(
183
183
  [{ '@type' => 'PropertyValue',
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.3.7
4
+ version: 3.3.9
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-06-18 00:00:00.000000000 Z
11
+ date: 2023-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -655,7 +655,7 @@ files:
655
655
  - lib/commonmeta/xml_converter.rb
656
656
  - resources/2008/09/xsd.xsl
657
657
  - resources/cff.json
658
- - resources/commonmeta_v0.9.1.json
658
+ - resources/commonmeta_v0.9.2.json
659
659
  - resources/crossref/AccessIndicators.xsd
660
660
  - resources/crossref/JATS-journalpublishing1-3d2-mathml3-elements.xsd
661
661
  - resources/crossref/JATS-journalpublishing1-3d2-mathml3.xsd
@@ -870,14 +870,18 @@ files:
870
870
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blogger_post.yml
871
871
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_author_name_suffix.yml
872
872
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_doi.yml
873
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_institutional_author.yml
873
874
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_organizational_author.yml
874
875
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_without_doi.yml
875
876
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post.yml
877
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post_with_anonymous_author.yml
876
878
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/substack_post_with_broken_reference.yml
877
879
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/syldavia_gazette_post_with_references.yml
878
880
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/upstream_post_with_references.yml
879
881
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post.yml
880
882
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post_with_references.yml
883
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post_with_tracking_code_on_url.yml
884
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/affiliation_is_space.yml
881
885
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/has_familyName.yml
882
886
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/has_name_in_display-order_with_ORCID.yml
883
887
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/name_with_affiliation_crossref.yml
@@ -917,6 +921,7 @@ files:
917
921
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/another_schema_org_from_front-matter.yml
918
922
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article.yml
919
923
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_from_datacite.yml
924
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_anonymous_author.yml
920
925
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_doi.yml
921
926
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_organizational_author.yml
922
927
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_upstream_blog.yml