commonmeta-ruby 3.0.10 → 3.2.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 +4 -4
- data/Gemfile.lock +37 -36
- data/commonmeta.gemspec +1 -1
- data/lib/commonmeta/metadata_utils.rb +2 -0
- data/lib/commonmeta/readers/json_post_reader.rb +78 -0
- data/lib/commonmeta/utils.rb +19 -0
- data/lib/commonmeta/version.rb +1 -1
- data/spec/author_utils_spec.rb +10 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_item_metadata/blogger_post.yml +94 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_item_metadata/ghost_post.yml +117 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_item_metadata/ghost_post_with_doi.yml +117 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_item_metadata/jekyll_post.yml +170 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_item_metadata/wordpress_post.yml +163 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_post_metadata/blogger_post.yml +94 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_post_metadata/ghost_post_with_doi.yml +117 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_post_metadata/jekyll_post.yml +87 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_post_metadata/wordpress_post.yml +163 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_link/license.yml +221 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_link/url.yml +221 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_item_from_rogue_scholar_with_doi.yml +163 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_item_from_upstream_blog.yml +243 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_post_from_rogue_scholar_with_doi.yml +163 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_post_from_upstream_blog.yml +243 -0
- data/spec/readers/json_post_reader_spec.rb +89 -0
- data/spec/utils_spec.rb +330 -314
- data/spec/writers/crossref_xml_writer_spec.rb +183 -137
- metadata +22 -5
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Commonmeta::Metadata, vcr: true do
|
6
|
+
subject { described_class.new(input: input, from: 'json_feed') }
|
7
|
+
|
8
|
+
context 'get json_post metadata' do
|
9
|
+
it 'blogger post' do
|
10
|
+
input = 'https://rogue-scholar.org/api/posts/1jgo59el'
|
11
|
+
subject = described_class.new(input: input)
|
12
|
+
expect(subject.valid?).to be true
|
13
|
+
expect(subject.id).to eq('https://iphylo.blogspot.com/2023/05/ten-years-and-million-links.html')
|
14
|
+
expect(subject.url).to eq('https://iphylo.blogspot.com/2023/05/ten-years-and-million-links.html')
|
15
|
+
expect(subject.type).to eq('Article')
|
16
|
+
expect(subject.creators.length).to eq(1)
|
17
|
+
expect(subject.creators.first).to eq("familyName"=>"Page", "givenName"=>"Roderic", "type"=>"Person")
|
18
|
+
expect(subject.titles).to eq([{"title"=>"Ten years and a million links"}])
|
19
|
+
expect(subject.license).to eq('id' => 'CC-BY-4.0',
|
20
|
+
'url' => 'https://creativecommons.org/licenses/by/4.0/legalcode')
|
21
|
+
expect(subject.date).to eq('published' => '2023-05-31')
|
22
|
+
expect(subject.descriptions).to eq([{"description"=>"As trailed on a Twitter thread last week I’ve been working on a manuscript describing the efforts to map taxonomic names to their original descriptions in the taxonomic literature. Putting together a...", "descriptionType"=>"Abstract"}])
|
23
|
+
expect(subject.publisher).to eq('name' => 'iPhylo')
|
24
|
+
expect(subject.subjects).to be_nil
|
25
|
+
expect(subject.language).to eq('en')
|
26
|
+
expect(subject.container).to eq("identifier"=>"https://iphylo.blogspot.com/", "identifierType"=>"URL", "title"=>"iPhylo", "type"=>"Periodical")
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'ghost post with doi' do
|
30
|
+
input = 'https://rogue-scholar.org/api/posts/1jgo8yel'
|
31
|
+
subject = described_class.new(input: input)
|
32
|
+
expect(subject.valid?).to be true
|
33
|
+
expect(subject.id).to eq('https://doi.org/10.53731/4nwxn-frt36')
|
34
|
+
expect(subject.url).to eq('https://blog.front-matter.io/posts/does-it-compose')
|
35
|
+
expect(subject.type).to eq('Article')
|
36
|
+
expect(subject.creators.length).to eq(1)
|
37
|
+
expect(subject.creators.first).to eq("id" => "https://orcid.org/0000-0003-1419-2405", "familyName"=>"Fenner", "givenName"=>"Martin", "type"=>"Person")
|
38
|
+
expect(subject.titles).to eq([{"title"=>"Does it compose?"}])
|
39
|
+
expect(subject.license).to eq('id' => 'CC-BY-4.0',
|
40
|
+
'url' => 'https://creativecommons.org/licenses/by/4.0/legalcode')
|
41
|
+
expect(subject.date).to eq('published' => '2023-05-16', 'updated' => '2023-05-16')
|
42
|
+
expect(subject.descriptions).to eq([{"description"=>"One question I have increasingly asked myself in the past few years. Meaning Can I run this open source software using Docker containers and a Docker Compose file?As the Docker project turned ten this...", "descriptionType"=>"Abstract"}])
|
43
|
+
expect(subject.publisher).to eq('name' => 'Front Matter')
|
44
|
+
expect(subject.subjects).to eq([{"subject"=>"news"}])
|
45
|
+
expect(subject.language).to eq('en')
|
46
|
+
expect(subject.container).to eq("identifier"=>"https://blog.front-matter.io/", "identifierType"=>"URL", "title"=>"Front Matter", "type"=>"Periodical")
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'wordpress post' do
|
50
|
+
input = 'https://rogue-scholar.org/api/posts/zkevlyd3'
|
51
|
+
subject = described_class.new(input: input)
|
52
|
+
expect(subject.valid?).to be true
|
53
|
+
expect(subject.id).to eq('https://wisspub.net/2023/05/23/eu-mitgliedstaaten-betonen-die-rolle-von-wissenschaftsgeleiteten-open-access-modellen-jenseits-von-apcs')
|
54
|
+
expect(subject.url).to eq('https://wisspub.net/2023/05/23/eu-mitgliedstaaten-betonen-die-rolle-von-wissenschaftsgeleiteten-open-access-modellen-jenseits-von-apcs')
|
55
|
+
expect(subject.type).to eq('Article')
|
56
|
+
expect(subject.creators.length).to eq(1)
|
57
|
+
expect(subject.creators.first).to eq("familyName"=>"Pampel", "givenName"=>"Heinz", "id"=>"https://orcid.org/0000-0003-3334-2771", "type"=>"Person")
|
58
|
+
expect(subject.titles).to eq([{"title"=>"EU-Mitgliedstaaten betonen die Rolle von wissenschaftsgeleiteten Open-Access-Modellen jenseits von APCs"}])
|
59
|
+
expect(subject.license).to eq('id' => 'CC-BY-4.0',
|
60
|
+
'url' => 'https://creativecommons.org/licenses/by/4.0/legalcode')
|
61
|
+
expect(subject.date).to eq('published' => '2023-05-23', 'updated' => '2023-05-23')
|
62
|
+
expect(subject.descriptions).to eq([{"description"=>"Die EU-Wissenschaftsministerien haben sich auf ihrer heutigen Sitzung in Brüssel unter dem Titel “Council conclusions on high-quality, transparent, open, trustworthy and equitable scholarly publishing” (PDF...", "descriptionType"=>"Abstract"}])
|
63
|
+
expect(subject.publisher).to eq('name' => 'wisspub.net')
|
64
|
+
expect(subject.subjects).to eq([{"subject"=>"open access"}, {"subject"=>"open access transformation"}, {"subject"=>"open science"}, {"subject"=>"eu"}])
|
65
|
+
expect(subject.language).to eq('de')
|
66
|
+
expect(subject.container).to eq("identifier"=>"https://wisspub.net/", "identifierType"=>"URL", "title"=>"wisspub.net", "type"=>"Periodical")
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'jekyll post' do
|
70
|
+
input = 'https://rogue-scholar.org/api/posts/1jdkwod5'
|
71
|
+
subject = described_class.new(input: input)
|
72
|
+
expect(subject.valid?).to be true
|
73
|
+
expect(subject.id).to eq('https://citationstyles.org/2020/07/11/seeking-public-comment-on-CSL-1-0-2')
|
74
|
+
expect(subject.url).to eq('https://citationstyles.org/2020/07/11/seeking-public-comment-on-CSL-1-0-2')
|
75
|
+
expect(subject.type).to eq('Article')
|
76
|
+
expect(subject.creators.length).to eq(1)
|
77
|
+
expect(subject.creators.first).to eq("familyName"=>"Karcher", "givenName"=>"Sebastian", "type"=>"Person")
|
78
|
+
expect(subject.titles).to eq([{"title"=>"Seeking Public Comment on CSL 1.0.2 Release"}])
|
79
|
+
expect(subject.license).to eq('id' => 'CC-BY-4.0',
|
80
|
+
'url' => 'https://creativecommons.org/licenses/by/4.0/legalcode')
|
81
|
+
expect(subject.date).to eq('published' => '2020-07-11', 'updated' => '2020-07-11')
|
82
|
+
expect(subject.descriptions).to eq([{"description"=>"Over the past few months, Citation Style Language developers have worked to address a backlog of feature requests. This work will be reflected in two upcoming releases. The first of these, 1.0.2, is slated...", "descriptionType"=>"Abstract"}])
|
83
|
+
expect(subject.publisher).to eq('name' => 'Citation Style Language')
|
84
|
+
expect(subject.subjects).to be_nil
|
85
|
+
expect(subject.language).to eq('en')
|
86
|
+
expect(subject.container).to eq("identifier"=>"https://citationstyles.org/", "identifierType"=>"URL", "title"=>"Citation Style Language", "type"=>"Periodical")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|