commonmeta-ruby 3.2.15 → 3.3

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.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/bin/commonmeta +1 -1
  4. data/lib/commonmeta/author_utils.rb +1 -1
  5. data/lib/commonmeta/cli.rb +14 -0
  6. data/lib/commonmeta/crossref_utils.rb +56 -14
  7. data/lib/commonmeta/readers/json_feed_reader.rb +25 -1
  8. data/lib/commonmeta/utils.rb +34 -0
  9. data/lib/commonmeta/version.rb +1 -1
  10. data/spec/cli_spec.rb +12 -3
  11. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/doi_prefix/doi_prefix_by_blog.yml +997 -0
  12. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/doi_prefix/doi_prefix_by_uuid.yml +256 -0
  13. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/encode/by_blog.yml +997 -0
  14. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/encode/by_uuid.yml +256 -0
  15. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_id.yml +997 -0
  16. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_post_uuid.yml +389 -0
  17. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_post_uuid_specific_prefix.yml +389 -0
  18. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item/by_uuid.yml +136 -0
  19. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blog_post_with_non-url_id.yml +136 -0
  20. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_organizational_author.yml +91 -0
  21. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_organizational_author.yml +91 -0
  22. data/spec/readers/json_feed_reader_spec.rb +68 -0
  23. data/spec/utils_spec.rb +8 -0
  24. data/spec/writers/crossref_xml_writer_spec.rb +28 -0
  25. metadata +13 -2
@@ -0,0 +1,136 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://rogue-scholar.org/api/posts/1898d2d7-4d87-4487-96c4-3073cf99e9a5
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Connection:
11
+ - close
12
+ Host:
13
+ - rogue-scholar.org
14
+ User-Agent:
15
+ - http.rb/5.1.1
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Age:
22
+ - '0'
23
+ Cache-Control:
24
+ - public, max-age=0, must-revalidate
25
+ Content-Length:
26
+ - '8589'
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Sun, 18 Jun 2023 05:14:41 GMT
31
+ Etag:
32
+ - '"m63byipmbt6mf"'
33
+ Server:
34
+ - Vercel
35
+ Strict-Transport-Security:
36
+ - max-age=63072000
37
+ X-Matched-Path:
38
+ - "/api/posts/[slug]"
39
+ X-Vercel-Cache:
40
+ - MISS
41
+ X-Vercel-Id:
42
+ - fra1::iad1::ww9vj-1687065281458-7b5cddd0bd21
43
+ Connection:
44
+ - close
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":"tag:blogger.com,1999:blog-4948885059517209129.post-2525787567927280589","uuid":"1898d2d7-4d87-4487-96c4-3073cf99e9a5","url":"http://sfmatheson.blogspot.com/2023/01/quintessence-of-dust-2023-restart-why.html","title":"Quintessence
48
+ of Dust 2023 restart: the why","summary":"It''s early January 2023, a little
49
+ before sunset in Tucson. Live image below, showing the glorious Santa Catalina
50
+ mountains (the snow on the upper reaches is more apparent earlier in the day)
51
+ and my dinner preparations (shrimp and veggies on the grill).I''ve decided
52
+ to start writing here at Quintessence of Dust, after another long hiatus.
53
+ Here are some of my reasons.1. I like to write, and I have things to say,
54
+ and I self-identify as an author. For eight years, I have co-organized and
55
+ taught in...","date_published":"2023-01-09T03:03:00Z","date_modified":"2023-04-02T21:17:07Z","date_indexed":"1970-01-01T00:00:00+00:00","authors":[{"url":null,"name":"Stephen
56
+ Matheson"}],"image":null,"content_html":"It''s early January 2023, a little
57
+ before sunset in Tucson. Live image below, showing the glorious Santa Catalina
58
+ mountains (the snow on the upper reaches is more apparent earlier in the day)
59
+ and my dinner preparations (shrimp and veggies on the grill).<div class=\"separator\"
60
+ style=\"clear: both; text-align: center;\"><a href=\"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghgBx9BU21qMDFnLxgHmnsl6TQVfb3QCwOXrC1zcXq7WH9gN8E0TcH3pTslRBG6O8mb5gcuF9JVtDlJ2je6dFcfyzKE4OD38-ftr66nBxddo892_NkyuevrrX65ndSbwmXMaLh3F5yiqU1QIj8JtA8FLkKOcHOEVwVafz0rzh7PejbFzp3XT25nQxc/s4032/Jan%207.jpg\"
61
+ style=\"clear: right; float: right; margin-bottom: 1em; margin-left: 1em;\"><img
62
+ border=\"0\" data-original-height=\"4032\" data-original-width=\"3024\" height=\"320\"
63
+ src=\"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghgBx9BU21qMDFnLxgHmnsl6TQVfb3QCwOXrC1zcXq7WH9gN8E0TcH3pTslRBG6O8mb5gcuF9JVtDlJ2je6dFcfyzKE4OD38-ftr66nBxddo892_NkyuevrrX65ndSbwmXMaLh3F5yiqU1QIj8JtA8FLkKOcHOEVwVafz0rzh7PejbFzp3XT25nQxc/s320/Jan%207.jpg\"
64
+ width=\"240\" /></a></div><br /><div><div>I''ve decided to start writing here
65
+ at <i>Quintessence of Dust</i>, after another long hiatus. Here are some of
66
+ my reasons.</div><div><br /></div><div>1. I like to write, and I have things
67
+ to say, and I self-identify as an author. For eight years, I have co-organized
68
+ and taught in the <a href=\"https://meetings.cshl.edu/courses.aspx?course=C-WRITE&amp;year=23\"
69
+ target=\"_blank\">Scientific Writing Retreat at Cold Spring Harbor Laboratory</a>.
70
+ I''m a writer and I need to write, if only for myself.</div><div><br /></div><div>2.
71
+ I have an idea for a book, along with some introductory work (but no sample
72
+ chapters yet) and writing here will help me develop those thoughts. The idea
73
+ is over twelve years old and has never faded away, which I take to mean that
74
+ I need to get it out of my system somehow.</div><div><br /></div><div>3. I
75
+ have other ideas kicking around in my head and most of them are worth writing
76
+ about. I have one new intellectual passion that is totally worth writing about:
77
+ <a href=\"https://skyislandalliance.org/the-sky-islands/\" target=\"_blank\">the
78
+ Sky Islands</a>&nbsp;that nearly surround us here in Tucson.</div><div><br
79
+ /></div><div>4. I have an exciting new job with great new people at <a href=\"https://plos.org/\"
80
+ target=\"_blank\">an organization</a> that''s all in for <a href=\"https://plos.org/open-science/\"
81
+ target=\"_blank\">open science</a>. I recently turned over the tens digit
82
+ on my age-o-meter. My kids will very soon be all out of college. (One is about
83
+ to start a postdoc!) All of this led, predictably, to a spasm of reflection
84
+ on projects and vision. One clear result is that I''m feeling more inspired.<span><a
85
+ name=''more''></a></span></div><div><br /></div><div>5. The demise of Twitter
86
+ has led to a lot of <a href=\"https://www.theatlantic.com/technology/archive/2022/11/twitter-facebook-social-media-decline/672074/\"
87
+ target=\"_blank\">useful commentary</a> about the nature of social media.
88
+ I left Facebook two years ago and all but left Twitter two months ago. I''m
89
+ on a&nbsp;<a href=\"https://fediscience.org/explore\" target=\"_blank\">good
90
+ server at Mastodon</a>&nbsp;and I like it; maybe microblogging there can satisfy
91
+ my desire for conversation and connection. But <a href=\"https://www.theverge.com/23513418/bring-back-personal-blogging\"
92
+ target=\"_blank\">this recent piece</a> at <i>The Verge</i> by <a href=\"https://moniquejudge.com/\"
93
+ target=\"_blank\">Monique Judge</a> convinced me that blogging could (again)
94
+ have a place in the future.</div><div><br /><div>Here''s her summary, emphasis
95
+ mine:</div><div><blockquote>At the end of the day, we don’t know what is going
96
+ to happen next with Twitter or any of these platforms. We don’t know what
97
+ changes <a href=\"https://www.techtarget.com/whatis/definition/Web-30\" target=\"_blank\">Web
98
+ 3.0</a> is going to bring to the internet. We do know that <b>we will all
99
+ still be here, wanting to share our thoughts, talk about anything and everything,
100
+ and commune with our people</b>. Personal blogging is the simplest and fastest
101
+ way to do all of that.&nbsp;</blockquote></div><div>That''s what I want! A
102
+ place to write, and (if I''m lucky) a place to discuss and \"commune\" with
103
+ people. That used to happen a lot at <i>Quintessence of Dust</i>.<span></span></div></div></div><div><br
104
+ /></div><div>Okay, but why here? This blog is over 15 years old and was started
105
+ when I was a Christian believer. <a href=\"https://sfmatheson.blogspot.com/2007/08/kicking-off-my-blog.html\"
106
+ target=\"_blank\">Its founding themes</a> were anchored in a desire to help
107
+ Christians understand and enjoy biology, to help them shake free of misinformation
108
+ and dishonesty. It has twice languished through long hiatuses and was <a href=\"https://sfmatheson.blogspot.com/p/about.html\"
109
+ target=\"_blank\">remodeled</a> back in 2017 a few years after I deconverted.
110
+ Maybe it''s time to start anew? I think not, for many of those same reasons:
111
+ I''m still a biologist who loves science, still worried about misinformation,
112
+ and still rooted in the power of scientific explanation. I''m still a bardolator
113
+ and a Red Sox fan. <a href=\"https://sfmatheson.blogspot.com/p/about.html\">I''m
114
+ still me</a>, and <i>Quintessence of Dust</i> is still my blog. The new <a
115
+ href=\"https://sfmatheson.blogspot.com/p/about.html\" target=\"_blank\">About
116
+ page</a> is slightly remodeled from 2017, and hints at the next post, which
117
+ will outline some new goals and ongoing projects.</div><div><br /></div><div>A
118
+ final note on inspiration, from Imani Perry, writing in her newsletter (<a
119
+ href=\"https://newsletters.theatlantic.com/unsettled-territory/\" target=\"_blank\">Unsettled
120
+ Territory</a>) at <i>The Atlantic</i>. The piece is \"<a href=\"https://newsletters.theatlantic.com/unsettled-territory/63af3facace609003751bacc/becoming-writer-habit-journalism/\"
121
+ target=\"_blank\">Writing is a Democratic Art</a>.\" It''s for subscribers
122
+ only but here is her challenge:</div><div><blockquote>Thinking and writing
123
+ at a faster pace stretched me and gave me greater confidence. Sometimes I
124
+ changed my mind about what I’d written a day later. But that was okay; a newsletter
125
+ is a moment in time. Writing it each week gave me a lovely rhythm in what
126
+ has otherwise been a difficult and disorienting season in history. Feeling
127
+ stuck can get you stuck. But writing can, and should, inspire deeds.</blockquote></div>","tags":["Introduction"],"language":"en","references":[],"blog_id":"5764g49","blog":{"id":"5764g49","title":"Quintessence
128
+ of Dust","description":"<i>Quintessence of Dust</i> explores science, society,
129
+ and human nature, focusing on genetics, development, evolution, neuroscience,
130
+ systems biology, and topics related to scientific literacy. I occasionally
131
+ discuss intelligent design, creationism, science denial, and other political/social
132
+ influences on scientific literacy. Additional topics: philosophy, baseball,
133
+ scientific culture, and Shakespeare. My main theme is <b><u>scientific explanation</u></b>.","language":"en","favicon":null,"feed_url":"http://sfmatheson.blogspot.com/feeds/posts/default","home_page_url":"http://sfmatheson.blogspot.com/","user_id":"8498eaf6-8c58-4b58-bc15-27eda292b1aa","created_at":"2023-05-31T14:21:27+00:00","indexed_at":"2023-04-18","feed_format":"application/atom+xml","license":"https://creativecommons.org/licenses/by/4.0/legalcode","generator":"Blogger
134
+ 7.00","category":"Social Sciences","prefix":"10.59350","modified_at":"2023-06-06T20:22:00+00:00","version":"https://jsonfeed.org/version/1.1","backlog":true,"authors":null}}'
135
+ recorded_at: Sun, 18 Jun 2023 05:14:41 GMT
136
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,91 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://rogue-scholar.org/api/posts/5561f8e4-2ff1-4186-a8d5-8dacb3afe414
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Connection:
11
+ - close
12
+ Host:
13
+ - rogue-scholar.org
14
+ User-Agent:
15
+ - http.rb/5.1.1
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Age:
22
+ - '0'
23
+ Cache-Control:
24
+ - public, max-age=0, must-revalidate
25
+ Content-Length:
26
+ - '4357'
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Sat, 17 Jun 2023 20:47:27 GMT
31
+ Etag:
32
+ - '"wi68ur4zhx3d1"'
33
+ Server:
34
+ - Vercel
35
+ Strict-Transport-Security:
36
+ - max-age=63072000
37
+ X-Matched-Path:
38
+ - "/api/posts/[slug]"
39
+ X-Vercel-Cache:
40
+ - MISS
41
+ X-Vercel-Id:
42
+ - fra1::iad1::ws6nv-1687034847031-a547db209d0d
43
+ Connection:
44
+ - close
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":"https://libscie.org/ku-leuven-supports-researchequals/","uuid":"5561f8e4-2ff1-4186-a8d5-8dacb3afe414","url":"https://libscie.org/ku-leuven-supports-researchequals/","title":"KU
48
+ Leuven supports ResearchEquals","summary":"KU Leuven is now an inaugural supporting
49
+ member of ResearchEquals, sustaining and governing the development of modular
50
+ publishing.As part of their commitment to Open Science, KU Leuven supports
51
+ sustainable implementations of Open Access and Open Science through the KU
52
+ Leuven Fund for Fair OA. The fund is usually only","date_published":"2023-05-09T06:43:26Z","date_modified":null,"date_indexed":"1970-01-01T00:00:00+00:00","authors":[{"url":"https://ror.org/0342dzm54","name":"Liberate
53
+ Science"}],"image":"https://libscie.org/content/images/2023/04/thank-you-1-.jpg","content_html":"<img
54
+ src=\"https://libscie.org/content/images/2023/04/thank-you-1-.jpg\" alt=\"KU
55
+ Leuven supports ResearchEquals\"><p>KU Leuven is now an inaugural supporting
56
+ member of ResearchEquals, sustaining and governing the development of modular
57
+ publishing.</p><p>As part of their commitment to Open Science, KU Leuven supports
58
+ sustainable implementations of Open Access and Open Science through the <a
59
+ href=\"https://www.kuleuven.be/open-science/what-is-open-science/scholarly-publishing-and-open-access/open-access-kuleuven/OS-services?ref=libscie.org\">KU
60
+ Leuven Fund for Fair OA</a>. The fund is usually only available to non-profits,
61
+ but ResearchEquals&#x2019; governance convinced KU Leuven to support a for-profit
62
+ initiative.</p><p>&#x201C;We don&#x2019;t want to be too rigid in our approach
63
+ and understand that publishing or other research infrastructures can work
64
+ according to different sustainability models. What matters to us is that,
65
+ if profits are made, they are reinvested in the academic community and that
66
+ researchers remain firmly in control.&#x201D; Demmy Verbeke said.</p><p>Supporting
67
+ members help sustain operations and receive additional governance rights for
68
+ <a href=\"https://researchequals.com/?ref=libscie.org\">ResearchEquals</a>.
69
+ These rights include the option to participate in quarterly assemblies, strategy
70
+ and decision making processes, the power to block acquisitions, and to request
71
+ more information around business operations. As a result, supporting members
72
+ shape how ResearchEquals evolves. Individuals can become supporting members
73
+ for 79.99 euro&#x2019;s per year. Institutions can become supporting members
74
+ for a yearly contribution of at least 2500 euro&#x2019;s. </p><p>ResearchEquals
75
+ is an open source, open access publishing platform for research modules. ResearchEquals
76
+ realized the first modular publishing platform (launched February 1st, 2022),
77
+ which revolves around sharing the research process, step by step, instead
78
+ of only the final report.</p><p>&#x201C;It is great to see KU Leuven support
79
+ generative projects, regardless of whether they are for-profit or not&#x201D;
80
+ Chris Hartgerink said.</p><p>KU Leuven is one of the first institutional supporting
81
+ members of ResearchEquals.</p><hr><p>KU Leuven is one of the largest universities
82
+ in Belgium, with a strong commitment to open access and open science. Demmy
83
+ Verbeke and Laura Mesotten manage the Fund for Fair OA of KU Leuven Libraries.</p><p>Liberate
84
+ Science GmbH (est. 2019) cultivates alternative publishing formats that work
85
+ for researchers everywhere. ResearchEquals is a Liberate Science GmbH project.
86
+ For more information view the <a href=\"https://www.researchequals.com/supporting-member?ref=libscie.org\">supporting
87
+ member page</a> or contact CEO Chris Hartgerink (<a href=\"mailto:ceo@libscie.org\">ceo@libscie.org</a>).</p>","tags":["ResearchEquals"],"language":"en","references":null,"blog_id":"h49ct36","blog":{"id":"h49ct36","title":"Liberate
88
+ Science","description":"Research as a commons","language":"en","favicon":"https://libscie.org/favicon.png","feed_url":"https://libscie.org/rss/","home_page_url":"https://libscie.org/","user_id":"8498eaf6-8c58-4b58-bc15-27eda292b1aa","created_at":"2023-05-31T14:08:03+00:00","indexed_at":"2023-01-04","feed_format":"application/rss+xml","license":"https://creativecommons.org/licenses/by/4.0/legalcode","generator":"Ghost
89
+ 5.49","category":"Social Sciences","prefix":null,"modified_at":"2023-06-13T06:48:37+00:00","version":"https://jsonfeed.org/version/1.1","backlog":true,"authors":null}}'
90
+ recorded_at: Sat, 17 Jun 2023 20:47:27 GMT
91
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,91 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://rogue-scholar.org/api/posts/5561f8e4-2ff1-4186-a8d5-8dacb3afe414
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Connection:
11
+ - close
12
+ Host:
13
+ - rogue-scholar.org
14
+ User-Agent:
15
+ - http.rb/5.1.1
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Age:
22
+ - '0'
23
+ Cache-Control:
24
+ - public, max-age=0, must-revalidate
25
+ Content-Length:
26
+ - '4357'
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Sat, 17 Jun 2023 21:53:20 GMT
31
+ Etag:
32
+ - '"wi68ur4zhx3d1"'
33
+ Server:
34
+ - Vercel
35
+ Strict-Transport-Security:
36
+ - max-age=63072000
37
+ X-Matched-Path:
38
+ - "/api/posts/[slug]"
39
+ X-Vercel-Cache:
40
+ - MISS
41
+ X-Vercel-Id:
42
+ - fra1::iad1::m9bzn-1687038797323-61355f142315
43
+ Connection:
44
+ - close
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":"https://libscie.org/ku-leuven-supports-researchequals/","uuid":"5561f8e4-2ff1-4186-a8d5-8dacb3afe414","url":"https://libscie.org/ku-leuven-supports-researchequals/","title":"KU
48
+ Leuven supports ResearchEquals","summary":"KU Leuven is now an inaugural supporting
49
+ member of ResearchEquals, sustaining and governing the development of modular
50
+ publishing.As part of their commitment to Open Science, KU Leuven supports
51
+ sustainable implementations of Open Access and Open Science through the KU
52
+ Leuven Fund for Fair OA. The fund is usually only","date_published":"2023-05-09T06:43:26Z","date_modified":null,"date_indexed":"1970-01-01T00:00:00+00:00","authors":[{"url":"https://ror.org/0342dzm54","name":"Liberate
53
+ Science"}],"image":"https://libscie.org/content/images/2023/04/thank-you-1-.jpg","content_html":"<img
54
+ src=\"https://libscie.org/content/images/2023/04/thank-you-1-.jpg\" alt=\"KU
55
+ Leuven supports ResearchEquals\"><p>KU Leuven is now an inaugural supporting
56
+ member of ResearchEquals, sustaining and governing the development of modular
57
+ publishing.</p><p>As part of their commitment to Open Science, KU Leuven supports
58
+ sustainable implementations of Open Access and Open Science through the <a
59
+ href=\"https://www.kuleuven.be/open-science/what-is-open-science/scholarly-publishing-and-open-access/open-access-kuleuven/OS-services?ref=libscie.org\">KU
60
+ Leuven Fund for Fair OA</a>. The fund is usually only available to non-profits,
61
+ but ResearchEquals&#x2019; governance convinced KU Leuven to support a for-profit
62
+ initiative.</p><p>&#x201C;We don&#x2019;t want to be too rigid in our approach
63
+ and understand that publishing or other research infrastructures can work
64
+ according to different sustainability models. What matters to us is that,
65
+ if profits are made, they are reinvested in the academic community and that
66
+ researchers remain firmly in control.&#x201D; Demmy Verbeke said.</p><p>Supporting
67
+ members help sustain operations and receive additional governance rights for
68
+ <a href=\"https://researchequals.com/?ref=libscie.org\">ResearchEquals</a>.
69
+ These rights include the option to participate in quarterly assemblies, strategy
70
+ and decision making processes, the power to block acquisitions, and to request
71
+ more information around business operations. As a result, supporting members
72
+ shape how ResearchEquals evolves. Individuals can become supporting members
73
+ for 79.99 euro&#x2019;s per year. Institutions can become supporting members
74
+ for a yearly contribution of at least 2500 euro&#x2019;s. </p><p>ResearchEquals
75
+ is an open source, open access publishing platform for research modules. ResearchEquals
76
+ realized the first modular publishing platform (launched February 1st, 2022),
77
+ which revolves around sharing the research process, step by step, instead
78
+ of only the final report.</p><p>&#x201C;It is great to see KU Leuven support
79
+ generative projects, regardless of whether they are for-profit or not&#x201D;
80
+ Chris Hartgerink said.</p><p>KU Leuven is one of the first institutional supporting
81
+ members of ResearchEquals.</p><hr><p>KU Leuven is one of the largest universities
82
+ in Belgium, with a strong commitment to open access and open science. Demmy
83
+ Verbeke and Laura Mesotten manage the Fund for Fair OA of KU Leuven Libraries.</p><p>Liberate
84
+ Science GmbH (est. 2019) cultivates alternative publishing formats that work
85
+ for researchers everywhere. ResearchEquals is a Liberate Science GmbH project.
86
+ For more information view the <a href=\"https://www.researchequals.com/supporting-member?ref=libscie.org\">supporting
87
+ member page</a> or contact CEO Chris Hartgerink (<a href=\"mailto:ceo@libscie.org\">ceo@libscie.org</a>).</p>","tags":["ResearchEquals"],"language":"en","references":null,"blog_id":"h49ct36","blog":{"id":"h49ct36","title":"Liberate
88
+ Science","description":"Research as a commons","language":"en","favicon":"https://libscie.org/favicon.png","feed_url":"https://libscie.org/rss/","home_page_url":"https://libscie.org/","user_id":"8498eaf6-8c58-4b58-bc15-27eda292b1aa","created_at":"2023-05-31T14:08:03+00:00","indexed_at":"2023-01-04","feed_format":"application/rss+xml","license":"https://creativecommons.org/licenses/by/4.0/legalcode","generator":"Ghost
89
+ 5.49","category":"Social Sciences","prefix":null,"modified_at":"2023-06-13T06:48:37+00:00","version":"https://jsonfeed.org/version/1.1","backlog":true,"authors":null}}'
90
+ recorded_at: Sat, 17 Jun 2023 21:53:21 GMT
91
+ recorded_with: VCR 6.1.0
@@ -225,6 +225,57 @@ describe Commonmeta::Metadata, vcr: true do
225
225
  expect(subject.container).to eq("identifier" => "https://citationstyles.org/", "identifierType" => "URL", "title" => "Citation Style Language", "type" => "Periodical")
226
226
  end
227
227
 
228
+ it "ghost post with organizational author" do
229
+ input = "https://rogue-scholar.org/api/posts/5561f8e4-2ff1-4186-a8d5-8dacb3afe414"
230
+ subject = described_class.new(input: input)
231
+ puts subject.errors
232
+ # expect(subject.valid?).to be true
233
+ expect(subject.id).to eq("https://libscie.org/ku-leuven-supports-researchequals")
234
+ expect(subject.url).to eq("https://libscie.org/ku-leuven-supports-researchequals")
235
+ expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "5561f8e4-2ff1-4186-a8d5-8dacb3afe414", "alternateIdentifierType" => "UUID" }])
236
+ expect(subject.type).to eq("Article")
237
+ expect(subject.creators.length).to eq(1)
238
+ expect(subject.creators.first).to eq("id"=>"https://ror.org/0342dzm54", "name"=>"Liberate Science", "type"=>"Organization")
239
+ expect(subject.titles).to eq([{ "title" => "KU Leuven supports ResearchEquals" }])
240
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
241
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
242
+ expect(subject.date).to eq("published" => "2023-05-09")
243
+ expect(subject.descriptions.first["description"]).to start_with("KU Leuven is now an inaugural supporting member of ResearchEquals")
244
+ expect(subject.publisher).to eq("name" => "Liberate Science")
245
+ expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
246
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
247
+ "subject" => "FOS: Social sciences",
248
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
249
+ expect(subject.language).to eq("en")
250
+ expect(subject.container).to eq("identifier" => "https://libscie.org/", "identifierType" => "URL", "title" => "Liberate Science", "type" => "Periodical")
251
+ expect(subject.references).to be_nil
252
+ end
253
+
254
+ it "blog post with non-url id" do
255
+ input = "https://rogue-scholar.org/api/posts/1898d2d7-4d87-4487-96c4-3073cf99e9a5"
256
+ subject = described_class.new(input: input)
257
+ expect(subject.valid?).to be true
258
+ expect(subject.id).to eq("http://sfmatheson.blogspot.com/2023/01/quintessence-of-dust-2023-restart-why.html")
259
+ expect(subject.url).to eq("http://sfmatheson.blogspot.com/2023/01/quintessence-of-dust-2023-restart-why.html")
260
+ expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "1898d2d7-4d87-4487-96c4-3073cf99e9a5", "alternateIdentifierType" => "UUID" }])
261
+ expect(subject.type).to eq("Article")
262
+ expect(subject.creators.length).to eq(1)
263
+ expect(subject.creators.first).to eq("familyName"=>"Matheson", "givenName"=>"Stephen", "type"=>"Person")
264
+ expect(subject.titles).to eq([{ "title" => "Quintessence of Dust 2023 restart: the why" }])
265
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
266
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
267
+ expect(subject.date).to eq("published"=>"2023-01-09", "updated"=>"2023-04-02")
268
+ expect(subject.descriptions.first["description"]).to start_with("It's early January 2023, a little before sunset in Tucson.")
269
+ expect(subject.publisher).to eq("name" => "Quintessence of Dust")
270
+ expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
271
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
272
+ "subject" => "FOS: Social sciences",
273
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
274
+ expect(subject.language).to eq("en")
275
+ expect(subject.container).to eq("identifier" => "http://sfmatheson.blogspot.com/", "identifierType" => "URL", "title" => "Quintessence of Dust", "type" => "Periodical")
276
+ expect(subject.references).to be_nil
277
+ end
278
+
228
279
  it "substack post with broken reference" do
229
280
  input = "https://rogue-scholar.org/api/posts/2b105b29-acbc-4eae-9ff1-368803f36a4d"
230
281
  subject = described_class.new(input: input)
@@ -268,4 +319,21 @@ describe Commonmeta::Metadata, vcr: true do
268
319
  expect(response).to eq("3e1278f6-e7c0-43e1-bb54-6829e1344c0d")
269
320
  end
270
321
  end
322
+
323
+ context "get doi_prefix for blog" do
324
+ it "by blog_id" do
325
+ response = subject.get_doi_prefix_by_blog_id("tyfqw20")
326
+ expect(response).to eq("10.59350")
327
+ end
328
+
329
+ it "by blog post uuid" do
330
+ response = subject.get_doi_prefix_by_json_feed_item_uuid("1898d2d7-4d87-4487-96c4-3073cf99e9a5")
331
+ expect(response).to eq("10.59350")
332
+ end
333
+
334
+ it "by blog post uuid specific prefix" do
335
+ response = subject.get_doi_prefix_by_json_feed_item_uuid("2b22bbba-bcba-4072-94cc-3f88442fff88")
336
+ expect(response).to eq("10.54900")
337
+ end
338
+ end
271
339
  end
data/spec/utils_spec.rb CHANGED
@@ -101,6 +101,14 @@ describe Commonmeta::Metadata, vcr: true do
101
101
  end
102
102
  end
103
103
 
104
+ context "validate_ror" do
105
+ it "validate_ror" do
106
+ ror = "https://ror.org/0342dzm54"
107
+ response = subject.validate_ror(ror)
108
+ expect(response).to eq("0342dzm54")
109
+ end
110
+ end
111
+
104
112
  context "validate_orcid_scheme" do
105
113
  it "validate_orcid_scheme" do
106
114
  orcid = "http://orcid.org"
@@ -257,5 +257,33 @@ describe Commonmeta::Metadata, vcr: true do
257
257
  expect(crossref_xml.dig('item_number')).to eq("__content__"=>"1c57855813244493b8af84c49eabc52f", "item_number_type"=>"uuid")
258
258
  expect(crossref_xml.dig('group_title')).to eq('Engineering and technology')
259
259
  end
260
+
261
+ it "json_feed_item from rogue scholar with organizational author" do
262
+ input = "https://rogue-scholar.org/api/posts/5561f8e4-2ff1-4186-a8d5-8dacb3afe414"
263
+ subject = described_class.new(input: input, doi: "10.59350/9ry27-7cz42")
264
+
265
+ expect(subject.valid?).to be true
266
+ expect(subject.id).to eq("https://doi.org/10.59350/9ry27-7cz42")
267
+ expect(subject.url).to eq("https://libscie.org/ku-leuven-supports-researchequals")
268
+ expect(subject.type).to eq("Article")
269
+ expect(subject.titles).to eq([{ "title" => "KU Leuven supports ResearchEquals" }])
270
+ expect(subject.creators.length).to eq(1)
271
+ expect(subject.creators.first).to eq("id"=>"https://ror.org/0342dzm54", "name"=>"Liberate Science", "type"=>"Organization")
272
+ expect(subject.subjects).to eq([{"subject"=>"Social sciences"},
273
+ {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
274
+ "subject"=>"FOS: Social sciences",
275
+ "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
276
+ expect(subject.language).to eq("en")
277
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
278
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
279
+ crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
280
+ expect(Array.wrap(crossref_xml.dig("contributors", "organization")).length).to eq(1)
281
+ expect(Array.wrap(crossref_xml.dig("contributors",
282
+ "organization")).first).to eq("contributor_role"=>"author", "name"=>"Liberate Science", "sequence"=>"first")
283
+ expect(crossref_xml.dig("titles",
284
+ "title")).to eq("KU Leuven supports ResearchEquals")
285
+ expect(crossref_xml.dig('item_number')).to eq("__content__"=>"5561f8e42ff14186a8d58dacb3afe414", "item_number_type"=>"uuid")
286
+ expect(crossref_xml.dig('group_title')).to eq('Social sciences')
287
+ end
260
288
  end
261
289
  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.2.15
4
+ version: '3.3'
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-17 00:00:00.000000000 Z
11
+ date: 2023-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -1071,6 +1071,10 @@ files:
1071
1071
  - spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/schema_org/to_crossref_xml.yml
1072
1072
  - spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/schema_org/to_datacite.yml
1073
1073
  - spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/schema_org/to_schema_org.yml
1074
+ - spec/fixtures/vcr_cassettes/Commonmeta_CLI/doi_prefix/doi_prefix_by_blog.yml
1075
+ - spec/fixtures/vcr_cassettes/Commonmeta_CLI/doi_prefix/doi_prefix_by_uuid.yml
1076
+ - spec/fixtures/vcr_cassettes/Commonmeta_CLI/encode/by_blog.yml
1077
+ - spec/fixtures/vcr_cassettes/Commonmeta_CLI/encode/by_uuid.yml
1074
1078
  - spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/crossref.yml
1075
1079
  - spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/datacite.yml
1076
1080
  - spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/jalc.yml
@@ -1170,6 +1174,9 @@ files:
1170
1174
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/nil.yml
1171
1175
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/past.yml
1172
1176
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/present.yml
1177
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_id.yml
1178
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_post_uuid.yml
1179
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_post_uuid_specific_prefix.yml
1173
1180
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/all_posts.yml
1174
1181
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/behind_the_science.yml
1175
1182
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/by_blog_id.yml
@@ -1180,9 +1187,12 @@ files:
1180
1187
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/unregistered_posts.yml
1181
1188
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/upstream.yml
1182
1189
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/upstream_blog.yml
1190
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item/by_uuid.yml
1191
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blog_post_with_non-url_id.yml
1183
1192
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blogger_post.yml
1184
1193
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_author_name_suffix.yml
1185
1194
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_doi.yml
1195
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_organizational_author.yml
1186
1196
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_without_doi.yml
1187
1197
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post.yml
1188
1198
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/substack_post_with_broken_reference.yml
@@ -1301,6 +1311,7 @@ files:
1301
1311
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article.yml
1302
1312
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_from_datacite.yml
1303
1313
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_doi.yml
1314
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_organizational_author.yml
1304
1315
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_upstream_blog.yml
1305
1316
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_with_references.yml
1306
1317
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/posted_content.yml