commonmeta-ruby 3.2.12 → 3.2.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb3a97138b6b57a503b29202613fd81d5124c66ef2523ba9ef7cccccb78d7ff8
4
- data.tar.gz: 0b9f6d3b310604ff2bb567b0ae13ae025d9c954c77669d9adec2f3e1bd36f307
3
+ metadata.gz: bac0bef429dfb0d6b215f3e9224dea78c3bae41ecc96dc9aa8c74fb45f14adc9
4
+ data.tar.gz: fe9f8e4628fb8ea120f858d24fc803e8183693104be98ffc96c3b608c76ef2ea
5
5
  SHA512:
6
- metadata.gz: 8262107294fc3be73c4b39ed45a662f1cd0e6a98702deb5bbc65fe91b8e9a31e890d33e38246c5852232be35746ce40d3cc9c77a9314a979dbf7c659b8826b56
7
- data.tar.gz: 5d68d6084d2a0257147346cc68837ed64955691141dcef7568fa7de3f5fffcd9b7573201ab9b4e26bbd0c6fcb7aee6cc4abadaf766c9344da5383e42dcbf2223
6
+ metadata.gz: 14422b80a42b7c9093f9ca564486005248f9b2cfcde00a3d7a8f880844e50a62501bf0a516a83fff0a05ee123fe5aa7a990d3f2bc7c1f2d6b1fe25742b0c6dd4
7
+ data.tar.gz: 2ed255c095195200bbf1ca9c9c5d9207541a3196df57c3e951c11610ce3e56d19ca2d1f19f446481f66beda29bc7cf5b1a25f6ac611f0102b16f0f02e29c3cbd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- commonmeta-ruby (3.2.12)
4
+ commonmeta-ruby (3.2.13)
5
5
  activesupport (>= 4.2.5, < 8.0)
6
6
  addressable (~> 2.8.1, < 2.8.2)
7
7
  base32-url (>= 0.7.0, < 1)
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 json_feed_updated json_feed_unregistered json_feed_by_blog)).empty?
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
@@ -86,10 +86,10 @@ module Commonmeta
86
86
  puts get_json_feed_unregistered
87
87
  end
88
88
 
89
- desc "", "json_feed_updated"
89
+ desc "", "json_feed_not_indexed"
90
90
 
91
- def json_feed_updated
92
- puts get_json_feed_updated
91
+ def json_feed_not_indexed(date_indexed)
92
+ puts get_json_feed_not_indexed(date_indexed)
93
93
  end
94
94
 
95
95
  desc "", "json_feed_by_blog"
@@ -96,18 +96,18 @@ module Commonmeta
96
96
  return { "string" => nil, "state" => "not_found" } unless response.status.success?
97
97
 
98
98
  posts = JSON.parse(response.body.to_s)
99
- posts.map { |post| post["uuid"] }.join('\n')
99
+ posts.map { |post| post["uuid"] }.first
100
100
  end
101
101
 
102
- def get_json_feed_updated
103
- # get JSON Feed items updated since last check
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 = json_feed_updated_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
 
109
109
  posts = JSON.parse(response.body.to_s)
110
- posts.map { |post| post["uuid"] }.join('\n')
110
+ posts.map { |post| post["uuid"] }.first
111
111
  end
112
112
 
113
113
  def get_json_feed_by_blog(blog_id)
@@ -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"] }.join('\n')
121
+ blog["items"].map { |item| item["uuid"] }.first
122
122
  end
123
123
  end
124
124
  end
@@ -1401,8 +1401,8 @@ module Commonmeta
1401
1401
  Base32::URL.decode(id)
1402
1402
  end
1403
1403
 
1404
- def json_feed_updated_url
1405
- "https://rogue-scholar.org/api/posts/updated"
1404
+ def json_feed_not_indexed_url(date_indexed)
1405
+ "https://rogue-scholar.org/api/posts/not_indexed/#{date_indexed}"
1406
1406
  end
1407
1407
 
1408
1408
  def json_feed_unregistered_url
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commonmeta
4
- VERSION = '3.2.12'
4
+ VERSION = '3.2.13'
5
5
  end
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