commonmeta-ruby 3.2.11 → 3.2.13
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 +8 -2
- data/lib/commonmeta/readers/json_feed_reader.rb +4 -4
- data/lib/commonmeta/utils.rb +4 -0
- data/lib/commonmeta/version.rb +1 -1
- data/spec/cli_spec.rb +9 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/json_feed/json_feed_by_blog.yml +1791 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/json_feed/json_feed_not_indexed.yml +2155 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/json_feed/json_feed_unregistered.yml +2010 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/by_blog_id.yml +1791 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/not_indexed_posts.yml +2155 -0
- data/spec/readers/json_feed_reader_spec.rb +7 -3
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bac0bef429dfb0d6b215f3e9224dea78c3bae41ecc96dc9aa8c74fb45f14adc9
|
4
|
+
data.tar.gz: fe9f8e4628fb8ea120f858d24fc803e8183693104be98ffc96c3b608c76ef2ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14422b80a42b7c9093f9ca564486005248f9b2cfcde00a3d7a8f880844e50a62501bf0a516a83fff0a05ee123fe5aa7a990d3f2bc7c1f2d6b1fe25742b0c6dd4
|
7
|
+
data.tar.gz: 2ed255c095195200bbf1ca9c9c5d9207541a3196df57c3e951c11610ce3e56d19ca2d1f19f446481f66beda29bc7cf5b1a25f6ac611f0102b16f0f02e29c3cbd
|
data/Gemfile.lock
CHANGED
data/bin/commonmeta
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.expand_path("../../lib/commonmeta", __FILE__)
|
4
4
|
|
5
|
-
if (ARGV & %w(--version -v help --help encode decode encode_id decode_id
|
5
|
+
if (ARGV & %w(--version -v help --help encode decode encode_id decode_id json_feed_not_indexed json_feed_unregistered json_feed_by_blog)).empty?
|
6
6
|
Commonmeta::CLI.start(ARGV.dup.unshift("convert"))
|
7
7
|
else
|
8
8
|
Commonmeta::CLI.start
|
data/lib/commonmeta/cli.rb
CHANGED
@@ -80,13 +80,19 @@ module Commonmeta
|
|
80
80
|
puts decode_container_id(id)
|
81
81
|
end
|
82
82
|
|
83
|
-
desc "", "
|
83
|
+
desc "", "json_feed_unregistered"
|
84
84
|
|
85
85
|
def json_feed_unregistered
|
86
86
|
puts get_json_feed_unregistered
|
87
87
|
end
|
88
88
|
|
89
|
-
desc "", "
|
89
|
+
desc "", "json_feed_not_indexed"
|
90
|
+
|
91
|
+
def json_feed_not_indexed(date_indexed)
|
92
|
+
puts get_json_feed_not_indexed(date_indexed)
|
93
|
+
end
|
94
|
+
|
95
|
+
desc "", "json_feed_by_blog"
|
90
96
|
|
91
97
|
def json_feed_by_blog(id)
|
92
98
|
puts get_json_feed_by_blog(id)
|
@@ -99,10 +99,10 @@ module Commonmeta
|
|
99
99
|
posts.map { |post| post["uuid"] }.first
|
100
100
|
end
|
101
101
|
|
102
|
-
def
|
103
|
-
# get JSON Feed items
|
102
|
+
def get_json_feed_not_indexed(date_indexed)
|
103
|
+
# get JSON Feed items not indexed in Crossref since a particular date
|
104
104
|
|
105
|
-
url =
|
105
|
+
url = json_feed_not_indexed_url(date_indexed)
|
106
106
|
response = HTTP.get(url)
|
107
107
|
return { "string" => nil, "state" => "not_found" } unless response.status.success?
|
108
108
|
|
@@ -118,7 +118,7 @@ module Commonmeta
|
|
118
118
|
return { "string" => nil, "state" => "not_found" } unless response.status.success?
|
119
119
|
|
120
120
|
blog = JSON.parse(response.body.to_s)
|
121
|
-
blog["items"].map { |item| item["uuid"] }.
|
121
|
+
blog["items"].map { |item| item["uuid"] }.first
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
data/lib/commonmeta/utils.rb
CHANGED
@@ -1401,6 +1401,10 @@ module Commonmeta
|
|
1401
1401
|
Base32::URL.decode(id)
|
1402
1402
|
end
|
1403
1403
|
|
1404
|
+
def json_feed_not_indexed_url(date_indexed)
|
1405
|
+
"https://rogue-scholar.org/api/posts/not_indexed/#{date_indexed}"
|
1406
|
+
end
|
1407
|
+
|
1404
1408
|
def json_feed_unregistered_url
|
1405
1409
|
"https://rogue-scholar.org/api/posts/unregistered"
|
1406
1410
|
end
|
data/lib/commonmeta/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -342,6 +342,15 @@ describe Commonmeta::CLI do
|
|
342
342
|
end
|
343
343
|
|
344
344
|
describe "json_feed", vcr: true do
|
345
|
+
it "json_feed_unregistered" do
|
346
|
+
expect { subject.json_feed_unregistered }.to output(/031faba3-3a6e-49d1-a540-26523be2fd09/).to_stdout
|
347
|
+
end
|
348
|
+
|
349
|
+
it "json_feed_not_indexed" do
|
350
|
+
input = "2023-01-01"
|
351
|
+
expect { subject.json_feed_not_indexed input }.to output(/ab58e412-06eb-42b7-b81a-d340825b9d48/).to_stdout
|
352
|
+
end
|
353
|
+
|
345
354
|
it "json_feed_by_blog" do
|
346
355
|
input = "tyfqw20"
|
347
356
|
expect { subject.json_feed_by_blog input }.to output(/3e1278f6-e7c0-43e1-bb54-6829e1344c0d/).to_stdout
|