Skip to content

Commit

Permalink
use new posts updated api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mfenner committed Nov 8, 2023
1 parent 6dcb4a0 commit e64afb2
Show file tree
Hide file tree
Showing 12 changed files with 391 additions and 93 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
commonmeta-ruby (3.7.1)
commonmeta-ruby (3.7.2)
activesupport (>= 4.2.5, < 8.0)
addressable (~> 2.8.1, < 2.8.2)
base32-url (>= 0.7.0, < 1)
Expand Down Expand Up @@ -42,7 +42,7 @@ GEM
ast (2.4.2)
base32-url (0.7.0)
uuidtools (~> 2.1, >= 2.1.5)
base64 (0.1.1)
base64 (0.2.0)
bcp47_spec (0.2.1)
bibtex-ruby (6.0.0)
latex-decode (~> 0.0)
Expand All @@ -69,7 +69,7 @@ GEM
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
drb (2.1.1)
drb (2.2.0)
ruby2_keywords
ebnf (2.4.0)
htmlentities (~> 4.3)
Expand Down Expand Up @@ -134,7 +134,7 @@ GEM
matrix (0.4.2)
minitest (5.20.0)
multi_json (1.15.0)
mutex_m (0.1.2)
mutex_m (0.2.0)
namae (1.1.1)
nokogiri (1.15.4-arm64-darwin)
racc (~> 1.4)
Expand Down
2 changes: 1 addition & 1 deletion bin/commonmeta
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require File.expand_path("../../lib/commonmeta", __FILE__)

if (ARGV & %w(--version -v help --help encode decode encode_id decode_id encode_by_blog encode_by_id json_feed_not_indexed json_feed_unregistered json_feed_by_blog json_feed_blog_id update_ghost_post generate_ghost_api_token)).empty?
if (ARGV & %w(--version -v help --help encode decode encode_id decode_id encode_by_blog encode_by_id json_feed_updated json_feed_unregistered json_feed_by_blog json_feed_blog_id update_ghost_post generate_ghost_api_token)).empty?
Commonmeta::CLI.start(ARGV.dup.unshift("convert"))
else
Commonmeta::CLI.start
Expand Down
6 changes: 3 additions & 3 deletions lib/commonmeta/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ def json_feed_unregistered
puts get_json_feed_unregistered
end

desc "", "json_feed_not_indexed"
desc "", "json_feed_updated"

def json_feed_not_indexed
puts get_json_feed_not_indexed
def json_feed_updated
puts get_json_feed_updated
end

desc "", "json_feed_by_blog"
Expand Down
4 changes: 2 additions & 2 deletions lib/commonmeta/readers/json_feed_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ def get_json_feed_unregistered
posts.map { |post| post["id"] }.first
end

def get_json_feed_not_indexed
def get_json_feed_updated
# get JSON Feed items not indexed in Crossref since they have been last updated

url = json_feed_not_indexed_url
url = json_feed_updated_url
response = HTTP.get(url)
return { "string" => nil, "state" => "not_found" } unless response.status.success?

Expand Down
4 changes: 2 additions & 2 deletions lib/commonmeta/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1453,8 +1453,8 @@ def decode_container_id(id)
Base32::URL.decode(id)
end

def json_feed_not_indexed_url
"https://api.rogue-scholar.org/posts/not_indexed"
def json_feed_updated_url
"https://api.rogue-scholar.org/posts/updated"
end

def json_feed_unregistered_url
Expand Down
2 changes: 1 addition & 1 deletion lib/commonmeta/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Commonmeta
VERSION = '3.7.1'
VERSION = '3.7.2'
end
6 changes: 3 additions & 3 deletions spec/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@
expect { subject.json_feed_unregistered }.to output(/17d0e31c-bc41-42b8-b873-d3dacee61f5c/).to_stdout
end

# it "json_feed_not_indexed" do
# expect { subject.json_feed_not_indexed }.to output(/r294649-6f79289-8cw1w/).to_stdout
# end
it "json_feed_updated" do
expect { subject.json_feed_updated }.to output(/bb8932b9-2820-42f8-b22f-f191aaf00e32/).to_stdout
end

it "json_feed_by_blog" do
input = "iphylo"
Expand Down

This file was deleted.

Large diffs are not rendered by default.

This file was deleted.

Loading

0 comments on commit e64afb2

Please sign in to comment.