commonmeta-ruby 3.2.0 → 3.2.2
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 +1 -1
- data/bin/commonmeta +1 -1
- data/lib/commonmeta/cli.rb +7 -0
- data/lib/commonmeta/metadata_utils.rb +2 -2
- data/lib/commonmeta/readers/{json_post_reader.rb → json_feed_reader.rb} +16 -4
- data/lib/commonmeta/utils.rb +6 -2
- data/lib/commonmeta/version.rb +1 -1
- data/spec/cli_spec.rb +8 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/json_feed/blog_post.yml +360 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/citation_style_language.yml +360 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/citation_style_language_blog.yml +360 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/front-matter_blog.yml +1034 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/upstream.yml +2438 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/upstream_blog.yml +2438 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blogger_post.yml +94 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_doi.yml +117 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post.yml +87 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post.yml +163 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_metadata/blogger_post.yml +141 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_metadata/ghost_post_with_doi.yml +164 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_metadata/jekyll_post.yml +134 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_metadata/wordpress_post.yml +210 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_post_metadata/blogger_post.yml +47 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_post_metadata/ghost_post_with_doi.yml +47 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_post_metadata/jekyll_post.yml +47 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_post_metadata/wordpress_post.yml +47 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/json_feed_url/front-matter_blog.yml +221 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_doi.yml +163 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_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 +47 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_post_from_upstream_blog.yml +47 -0
- data/spec/readers/{json_post_reader_spec.rb → json_feed_reader_spec.rb} +23 -2
- data/spec/utils_spec.rb +8 -0
- data/spec/writers/crossref_xml_writer_spec.rb +2 -2
- metadata +20 -3
|
@@ -160,4 +160,51 @@ http_interactions:
|
|
|
160
160
|
Transformation","Open Science","EU"],"language":"de","blog_id":"34zkv26","blog":{"id":"34zkv26","title":"wisspub.net","language":"de","favicon":null,"feed_url":"https://wisspub.net/feed/atom/","home_page_url":"https://wisspub.net/","license":"https://creativecommons.org/licenses/by/4.0/legalcode","category":"Engineering
|
|
161
161
|
and Technology"}}'
|
|
162
162
|
recorded_at: Sun, 04 Jun 2023 11:24:16 GMT
|
|
163
|
+
- request:
|
|
164
|
+
method: get
|
|
165
|
+
uri: https://rogue-scholar.org/api/blogs/https://rogue-scholar.org/api/posts/zkevlyd3
|
|
166
|
+
body:
|
|
167
|
+
encoding: UTF-8
|
|
168
|
+
string: ''
|
|
169
|
+
headers:
|
|
170
|
+
Connection:
|
|
171
|
+
- close
|
|
172
|
+
Host:
|
|
173
|
+
- rogue-scholar.org
|
|
174
|
+
User-Agent:
|
|
175
|
+
- http.rb/5.1.1
|
|
176
|
+
response:
|
|
177
|
+
status:
|
|
178
|
+
code: 308
|
|
179
|
+
message: Permanent Redirect
|
|
180
|
+
headers:
|
|
181
|
+
Cache-Control:
|
|
182
|
+
- public, max-age=0, must-revalidate
|
|
183
|
+
Content-Type:
|
|
184
|
+
- text/plain
|
|
185
|
+
Date:
|
|
186
|
+
- Sun, 04 Jun 2023 13:17:12 GMT
|
|
187
|
+
Location:
|
|
188
|
+
- "/api/blogs/https:/rogue-scholar.org/api/posts/zkevlyd3"
|
|
189
|
+
Refresh:
|
|
190
|
+
- 0;url=/api/blogs/https:/rogue-scholar.org/api/posts/zkevlyd3
|
|
191
|
+
Server:
|
|
192
|
+
- Vercel
|
|
193
|
+
Strict-Transport-Security:
|
|
194
|
+
- max-age=63072000
|
|
195
|
+
X-Vercel-Cache:
|
|
196
|
+
- MISS
|
|
197
|
+
X-Vercel-Id:
|
|
198
|
+
- fra1::qr2sb-1685884632978-8eaf788f74e2
|
|
199
|
+
Connection:
|
|
200
|
+
- close
|
|
201
|
+
Transfer-Encoding:
|
|
202
|
+
- chunked
|
|
203
|
+
body:
|
|
204
|
+
encoding: ASCII-8BIT
|
|
205
|
+
string: 'Redirecting to /api/blogs/https:/rogue-scholar.org/api/posts/zkevlyd3
|
|
206
|
+
(308)
|
|
207
|
+
|
|
208
|
+
'
|
|
209
|
+
recorded_at: Sun, 04 Jun 2023 13:17:12 GMT
|
|
163
210
|
recorded_with: VCR 6.1.0
|
|
@@ -240,4 +240,51 @@ http_interactions:
|
|
|
240
240
|
learning and become familiar with some of the available techniques.</p><p></p>
|
|
241
241
|
","tags":["Original Research"],"language":"en","blog_id":"pm0p222","blog":{"id":"pm0p222","title":"Upstream","language":"en","favicon":"https://upstream.force11.org/favicon.png","feed_url":"https://upstream.force11.org/atom/","home_page_url":"https://upstream.force11.org","license":"https://creativecommons.org/licenses/by/4.0/legalcode","category":"Humanities"}}'
|
|
242
242
|
recorded_at: Sun, 04 Jun 2023 11:24:15 GMT
|
|
243
|
+
- request:
|
|
244
|
+
method: get
|
|
245
|
+
uri: https://rogue-scholar.org/api/blogs/https://rogue-scholar.org/api/posts/wve6rep4
|
|
246
|
+
body:
|
|
247
|
+
encoding: UTF-8
|
|
248
|
+
string: ''
|
|
249
|
+
headers:
|
|
250
|
+
Connection:
|
|
251
|
+
- close
|
|
252
|
+
Host:
|
|
253
|
+
- rogue-scholar.org
|
|
254
|
+
User-Agent:
|
|
255
|
+
- http.rb/5.1.1
|
|
256
|
+
response:
|
|
257
|
+
status:
|
|
258
|
+
code: 308
|
|
259
|
+
message: Permanent Redirect
|
|
260
|
+
headers:
|
|
261
|
+
Cache-Control:
|
|
262
|
+
- public, max-age=0, must-revalidate
|
|
263
|
+
Content-Type:
|
|
264
|
+
- text/plain
|
|
265
|
+
Date:
|
|
266
|
+
- Sun, 04 Jun 2023 13:17:12 GMT
|
|
267
|
+
Location:
|
|
268
|
+
- "/api/blogs/https:/rogue-scholar.org/api/posts/wve6rep4"
|
|
269
|
+
Refresh:
|
|
270
|
+
- 0;url=/api/blogs/https:/rogue-scholar.org/api/posts/wve6rep4
|
|
271
|
+
Server:
|
|
272
|
+
- Vercel
|
|
273
|
+
Strict-Transport-Security:
|
|
274
|
+
- max-age=63072000
|
|
275
|
+
X-Vercel-Cache:
|
|
276
|
+
- MISS
|
|
277
|
+
X-Vercel-Id:
|
|
278
|
+
- fra1::zpxrc-1685884632711-2572b6e572f4
|
|
279
|
+
Connection:
|
|
280
|
+
- close
|
|
281
|
+
Transfer-Encoding:
|
|
282
|
+
- chunked
|
|
283
|
+
body:
|
|
284
|
+
encoding: ASCII-8BIT
|
|
285
|
+
string: 'Redirecting to /api/blogs/https:/rogue-scholar.org/api/posts/wve6rep4
|
|
286
|
+
(308)
|
|
287
|
+
|
|
288
|
+
'
|
|
289
|
+
recorded_at: Sun, 04 Jun 2023 13:17:12 GMT
|
|
243
290
|
recorded_with: VCR 6.1.0
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
5
|
describe Commonmeta::Metadata, vcr: true do
|
|
6
|
-
subject { described_class.new
|
|
6
|
+
subject { described_class.new }
|
|
7
7
|
|
|
8
|
-
context 'get
|
|
8
|
+
context 'get json_feed_item metadata' do
|
|
9
9
|
it 'blogger post' do
|
|
10
10
|
input = 'https://rogue-scholar.org/api/posts/1jgo59el'
|
|
11
11
|
subject = described_class.new(input: input)
|
|
@@ -69,6 +69,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
|
69
69
|
it 'jekyll post' do
|
|
70
70
|
input = 'https://rogue-scholar.org/api/posts/1jdkwod5'
|
|
71
71
|
subject = described_class.new(input: input)
|
|
72
|
+
puts subject.errors
|
|
72
73
|
expect(subject.valid?).to be true
|
|
73
74
|
expect(subject.id).to eq('https://citationstyles.org/2020/07/11/seeking-public-comment-on-CSL-1-0-2')
|
|
74
75
|
expect(subject.url).to eq('https://citationstyles.org/2020/07/11/seeking-public-comment-on-CSL-1-0-2')
|
|
@@ -86,4 +87,24 @@ describe Commonmeta::Metadata, vcr: true do
|
|
|
86
87
|
expect(subject.container).to eq("identifier"=>"https://citationstyles.org/", "identifierType"=>"URL", "title"=>"Citation Style Language", "type"=>"Periodical")
|
|
87
88
|
end
|
|
88
89
|
end
|
|
90
|
+
|
|
91
|
+
context 'get json_feed' do
|
|
92
|
+
it 'front-matter blog' do
|
|
93
|
+
id = 'f0m0e38'
|
|
94
|
+
response = subject.get_json_feed(id)
|
|
95
|
+
expect(response).to be_nil
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'upstream' do
|
|
99
|
+
id = 'pm0p222'
|
|
100
|
+
response = subject.get_json_feed(id)
|
|
101
|
+
expect(response).to be_nil
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it 'citation style language' do
|
|
105
|
+
id = 'prmb582'
|
|
106
|
+
response = subject.get_json_feed(id)
|
|
107
|
+
expect(response).to eq("1jdkoe52")
|
|
108
|
+
end
|
|
109
|
+
end
|
|
89
110
|
end
|
data/spec/utils_spec.rb
CHANGED
|
@@ -664,4 +664,12 @@ describe Commonmeta::Metadata, vcr: true do
|
|
|
664
664
|
expect(response).to eq(17_986_615_561)
|
|
665
665
|
end
|
|
666
666
|
end
|
|
667
|
+
|
|
668
|
+
context 'json_feed_url' do
|
|
669
|
+
it 'front-matter blog' do
|
|
670
|
+
id = 'f0m0e38'
|
|
671
|
+
response = subject.json_feed_url(id)
|
|
672
|
+
expect(response).to eq("https://rogue-scholar.org/api/blogs/f0m0e38")
|
|
673
|
+
end
|
|
674
|
+
end
|
|
667
675
|
end
|
|
@@ -170,7 +170,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
|
170
170
|
"title")).to eq("Deep dive into ethics of Contributor Roles: report of a FORCE11 workshop")
|
|
171
171
|
end
|
|
172
172
|
|
|
173
|
-
it "
|
|
173
|
+
it "json_feed_item from upstream blog" do
|
|
174
174
|
input = "https://rogue-scholar.org/api/posts/wve6rep4"
|
|
175
175
|
subject = described_class.new(input: input)
|
|
176
176
|
|
|
@@ -193,7 +193,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
|
193
193
|
"title")).to eq("Attempts at automating journal subject classification")
|
|
194
194
|
end
|
|
195
195
|
|
|
196
|
-
it "
|
|
196
|
+
it "json_feed_item from rogue scholar with doi" do
|
|
197
197
|
input = "https://rogue-scholar.org/api/posts/zkevlyd3"
|
|
198
198
|
subject = described_class.new(input: input, doi: "10.59350/9ry27-7cz42")
|
|
199
199
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: commonmeta-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.2.
|
|
4
|
+
version: 3.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Fenner
|
|
@@ -596,7 +596,7 @@ files:
|
|
|
596
596
|
- lib/commonmeta/readers/crossref_xml_reader.rb
|
|
597
597
|
- lib/commonmeta/readers/csl_reader.rb
|
|
598
598
|
- lib/commonmeta/readers/datacite_reader.rb
|
|
599
|
-
- lib/commonmeta/readers/
|
|
599
|
+
- lib/commonmeta/readers/json_feed_reader.rb
|
|
600
600
|
- lib/commonmeta/readers/npm_reader.rb
|
|
601
601
|
- lib/commonmeta/readers/ris_reader.rb
|
|
602
602
|
- lib/commonmeta/readers/schema_org_reader.rb
|
|
@@ -1063,6 +1063,7 @@ files:
|
|
|
1063
1063
|
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/kisti.yml
|
|
1064
1064
|
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/medra.yml
|
|
1065
1065
|
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/op.yml
|
|
1066
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/json_feed/blog_post.yml
|
|
1066
1067
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/change_metadata_as_datacite_xml/with_data_citation.yml
|
|
1067
1068
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/doi_registration_agency/crossref.yml
|
|
1068
1069
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/doi_registration_agency/datacite.yml
|
|
@@ -1150,6 +1151,19 @@ files:
|
|
|
1150
1151
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/nil.yml
|
|
1151
1152
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/past.yml
|
|
1152
1153
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/present.yml
|
|
1154
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/citation_style_language.yml
|
|
1155
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/citation_style_language_blog.yml
|
|
1156
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/front-matter_blog.yml
|
|
1157
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/upstream.yml
|
|
1158
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/upstream_blog.yml
|
|
1159
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blogger_post.yml
|
|
1160
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_doi.yml
|
|
1161
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post.yml
|
|
1162
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post.yml
|
|
1163
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_metadata/blogger_post.yml
|
|
1164
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_metadata/ghost_post_with_doi.yml
|
|
1165
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_metadata/jekyll_post.yml
|
|
1166
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_metadata/wordpress_post.yml
|
|
1153
1167
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_item_metadata/blogger_post.yml
|
|
1154
1168
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_item_metadata/ghost_post.yml
|
|
1155
1169
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_item_metadata/ghost_post_with_doi.yml
|
|
@@ -1183,6 +1197,7 @@ files:
|
|
|
1183
1197
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/github/github_from_url_file.yml
|
|
1184
1198
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/handle_input/DOI_RA_not_Crossref_or_DataCite.yml
|
|
1185
1199
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/handle_input/unknown_DOI_prefix.yml
|
|
1200
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/json_feed_url/front-matter_blog.yml
|
|
1186
1201
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/json_schema_errors/is_valid.yml
|
|
1187
1202
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_cc_url/not_found.yml
|
|
1188
1203
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_cc_url/with_trailing_slash.yml
|
|
@@ -1268,6 +1283,8 @@ files:
|
|
|
1268
1283
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/another_schema_org_from_front-matter.yml
|
|
1269
1284
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article.yml
|
|
1270
1285
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_from_datacite.yml
|
|
1286
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_doi.yml
|
|
1287
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_upstream_blog.yml
|
|
1271
1288
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_item_from_rogue_scholar_with_doi.yml
|
|
1272
1289
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_item_from_upstream_blog.yml
|
|
1273
1290
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_post_from_rogue_scholar_with_doi.yml
|
|
@@ -1354,7 +1371,7 @@ files:
|
|
|
1354
1371
|
- spec/readers/crossref_xml_reader_spec.rb
|
|
1355
1372
|
- spec/readers/csl_reader_spec.rb
|
|
1356
1373
|
- spec/readers/datacite_reader_spec.rb
|
|
1357
|
-
- spec/readers/
|
|
1374
|
+
- spec/readers/json_feed_reader_spec.rb
|
|
1358
1375
|
- spec/readers/npm_reader_spec.rb
|
|
1359
1376
|
- spec/readers/ris_reader_spec.rb
|
|
1360
1377
|
- spec/readers/schema_org_reader_spec.rb
|