Skip to content

Commit

Permalink
use orcid api 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jun 5, 2021
1 parent 18674cd commit 5a1aa88
Show file tree
Hide file tree
Showing 32 changed files with 361 additions and 1,568 deletions.
842 changes: 230 additions & 612 deletions .rubocop.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ gem "flipper-ui"
gem "nilify_blanks", "~> 1.3"
gem "oj", ">= 2.8.3"
gem "oj_mimic_json", "~> 1.0", ">= 1.0.1"
gem "orcid_client", "~> 0.5", ">= 0.8"
gem "orcid_client", "~> 0.5", ">= 0.9.3"
gem "postrank-uri", "~> 1.0", ">= 1.0.24"
gem "pwqgen.rb", "~> 0.1.0"
gem "rake", "~> 12.0"
Expand Down
52 changes: 27 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ GEM
arel (9.0.0)
ast (2.4.2)
aws-eventstream (1.1.1)
aws-partitions (1.452.0)
aws-sdk-core (3.114.0)
aws-partitions (1.465.0)
aws-sdk-core (3.114.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.43.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.94.1)
aws-sdk-s3 (1.96.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-sdk-sqs (1.38.0)
aws-sdk-sqs (1.39.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.2.3)
Expand Down Expand Up @@ -101,7 +101,7 @@ GEM
latex-decode (~> 0.0)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
bolognese (1.9.2)
bolognese (1.9.7)
activesupport (>= 4.2.5)
benchmark_methods (~> 0.7)
bibtex-ruby (>= 5.1.0)
Expand All @@ -119,7 +119,7 @@ GEM
loofah (~> 2.0, >= 2.0.3)
maremma (>= 4.7, < 5)
namae (~> 1.0)
nokogiri (~> 1.10.4)
nokogiri (~> 1.11.2)
oj (~> 3.10)
oj_mimic_json (~> 1.0, >= 1.0.1)
postrank-uri (~> 1.0, >= 1.0.18)
Expand Down Expand Up @@ -177,7 +177,7 @@ GEM
crass (1.0.6)
csl (1.5.2)
namae (~> 1.0)
csl-styles (1.0.1.10)
csl-styles (1.0.1.11)
csl (~> 1.0)
cuprite (0.13)
capybara (>= 2.1, < 4)
Expand All @@ -198,7 +198,7 @@ GEM
responders
warden (~> 1.2.3)
diff-lcs (1.4.4)
docile (1.3.5)
docile (1.4.0)
docopt (0.6.1)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
Expand All @@ -209,7 +209,7 @@ GEM
dry-container (0.7.2)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.5.0)
dry-core (0.6.0)
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
dry-inflector (0.2.0)
Expand Down Expand Up @@ -268,7 +268,7 @@ GEM
mail (~> 2.7)
erubi (1.10.0)
excon (0.71.1)
execjs (2.7.0)
execjs (2.8.1)
factory_bot (4.11.1)
activesupport (>= 3.0.0)
factory_bot_rails (4.11.1)
Expand All @@ -290,7 +290,7 @@ GEM
cliver (~> 0.3)
concurrent-ruby (~> 1.1)
websocket-driver (>= 0.6, < 0.8)
ffi (1.15.0)
ffi (1.15.1)
flipper (0.17.2)
flipper-active_support_cache_store (0.17.2)
activesupport (>= 4.2, < 7)
Expand All @@ -313,7 +313,7 @@ GEM
globalid (0.4.2)
activesupport (>= 4.2.0)
google-protobuf (3.10.0.rc.1)
graphql (1.12.9)
graphql (1.12.12)
graphql-batch (0.4.3)
graphql (>= 1.3, < 2)
promise.rb (~> 0.7.2)
Expand Down Expand Up @@ -392,15 +392,15 @@ GEM
mailgun-ruby (1.2.4)
rest-client (>= 2.0.2)
marcel (1.0.1)
maremma (4.7.2)
maremma (4.7.4)
activesupport (>= 4.2.5)
addressable (>= 2.3.6)
builder (~> 3.2, >= 3.2.2)
excon (~> 0.71.0)
faraday (~> 0.17.3)
faraday-encoding (~> 0.0.4)
faraday_middleware (~> 0.14.0)
nokogiri (~> 1.10.4)
nokogiri (~> 1.11.2)
oj (>= 2.8.3)
oj_mimic_json (~> 1.0, >= 1.0.1)
method_source (1.0.0)
Expand All @@ -409,7 +409,7 @@ GEM
mime-types-data (3.2021.0225)
mini_magick (4.11.0)
mini_mime (1.1.0)
mini_portile2 (2.4.0)
mini_portile2 (2.5.3)
minitest (5.14.4)
msgpack (1.4.2)
multi_json (1.15.0)
Expand All @@ -422,8 +422,9 @@ GEM
activerecord (>= 4.0.0)
activesupport (>= 4.0.0)
nio4r (2.5.7)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogiri (1.11.7)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
oauth2 (1.4.7)
faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
Expand Down Expand Up @@ -453,14 +454,14 @@ GEM
actionpack (>= 4.2)
omniauth (~> 2.0)
optimist (3.0.1)
orcid_client (0.8)
orcid_client (0.9.3)
activesupport (>= 4.2.5, < 6)
bolognese (~> 1.3, >= 1.3.19)
builder (~> 3.2, >= 3.2.2)
dotenv (~> 2.1, >= 2.1.1)
maremma (>= 4.4)
namae (~> 1.0.1)
nokogiri (~> 1.10.4)
nokogiri (>= 1.10.4, < 1.12.0)
orm_adapter (0.5.0)
pandoc-ruby (2.1.4)
parallel (1.20.1)
Expand All @@ -475,6 +476,7 @@ GEM
pwqgen.rb (0.1.0)
docopt (~> 0.5)
sysrandom
racc (1.5.2)
rack (2.2.3)
rack-cors (1.1.1)
rack (>= 2.0.0)
Expand Down Expand Up @@ -517,7 +519,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rchardet (1.8.0)
rdf (3.1.13)
rdf (3.1.14)
hamster (~> 3.0)
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (3.1.0)
Expand Down Expand Up @@ -545,7 +547,7 @@ GEM
redis (4.2.5)
regexp_parser (2.1.1)
remotipart (1.4.4)
repost (0.3.7)
repost (0.3.8)
request_store (1.5.0)
rack (>= 1.4)
responders (3.0.1)
Expand Down Expand Up @@ -665,11 +667,11 @@ GEM
vcr (3.0.3)
warden (1.2.9)
rack (>= 2.0.9)
webmock (3.12.2)
webmock (3.13.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.3)
websocket-driver (0.7.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
with_env (1.1.0)
Expand Down Expand Up @@ -748,7 +750,7 @@ DEPENDENCIES
omniauth-globus (~> 0.9.1)
omniauth-orcid (~> 2.0)
omniauth-rails_csrf_protection (~> 1.0)
orcid_client (~> 0.5, >= 0.8)
orcid_client (~> 0.5, >= 0.9.3)
postrank-uri (~> 1.0, >= 1.0.24)
pwqgen.rb (~> 0.1.0)
rack-cors (~> 1.0)
Expand Down Expand Up @@ -785,4 +787,4 @@ DEPENDENCIES
with_env (~> 1.1)

BUNDLED WITH
2.1.4
2.2.19
3 changes: 1 addition & 2 deletions app/models/claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ def to_param # overridden, use uuid instead of id
def process_data(options = {})
start

### depdency Injection for testing
result = options[:collect_data] || collect_data

if result.body["skip"]
Expand Down Expand Up @@ -238,7 +237,7 @@ def process_data(options = {})

def collect_data(options = {})
# already claimed
return OpenStruct.new(body: { "skip" => true, "Reason" => "already claimed." }) if to_be_created? && claimed_at.present?
return OpenStruct.new(body: { "skip" => true, "reason" => "already claimed." }) if to_be_created? && claimed_at.present?

# user has not signed up yet or orcid_token is missing
if user.blank? || orcid_token.blank?
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/resolvable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def github_as_url(github)
end

def get_doi_from_id(id)
if /(http|https):\/\/(dx\.)?doi\.org\/(\w+)/.match(id)
if /(http|https):\/\/(dx\.)?doi\.org\/(\w+)/.match?(id)
uri = Addressable::URI.parse(id)
uri.path[1..-1]
elsif id.starts_with?("doi:")
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def role_name
def validate_email
return true if email.blank?

unless email =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
unless /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.match?(email)
errors.add :email, "is not a valid email address"
end
end
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
QUEUE_OPTIONS = ["high", "default", "low"].freeze

# Version of ORCID API
ORCID_VERSION = "2.1".freeze
ORCID_VERSION = "3.0".freeze

# ORCID schema
ORCID_SCHEMA = "https://raw.githubusercontent.com/ORCID/ORCID-Source/master/orcid-model/src/main/resources/orcid-message-1.2.xsd".freeze
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/external_identifier.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<external-identifier:external-identifier xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:common="http://www.orcid.org/ns/common" xmlns:external-identifier="http://www.orcid.org/ns/external-identifier" put-code="5581" visibility="public" xsi:schemaLocation="http://www.orcid.org/ns/external-identifier ../person-external-identifier-2.1.xsd">
<external-identifier:external-identifier xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:common="http://www.orcid.org/ns/common" xmlns:external-identifier="http://www.orcid.org/ns/external-identifier" put-code="5581" visibility="public" xsi:schemaLocation="http://www.orcid.org/ns/external-identifier ../person-external-identifier-3.0.xsd">
<common:external-id-type>Github</common:external-id-type>
<common:external-id-value>mfenner</common:external-id-value>
<common:external-id-url>https://github.com/mfenner</common:external-id-url>
Expand Down
95 changes: 0 additions & 95 deletions spec/fixtures/vcr_cassettes/Claim/collect_data/delete_claim.yml

This file was deleted.

Loading

0 comments on commit 5a1aa88

Please sign in to comment.