Skip to content

Commit

Permalink
user lowercase doi in claims query. #623
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Oct 2, 2020
1 parent e973fd5 commit 1cdcc6b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/graphql/resolvers/claims.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ def resolve

# Use DataCite Claims API call to get all ORCID claims for a given DOI
api_url = Rails.env.production? ? "https://api.datacite.org" : "https://api.stage.datacite.org"
url = "#{api_url}/claims?user-id=#{context[:current_user].uid}&dois=#{object.doi}"
url = "#{api_url}/claims?user-id=#{context[:current_user].uid}&dois=#{object.doi.downcase}"
response = Maremma.get(url, bearer: context[:current_user].jwt)
if response.status != 200
Rails.logger.error "Error retrieving claims for user #{context[:current_user].uid} and doi #{object.doi}: " + response.body["errors"].inspect
Rails.logger.error "Error retrieving claims for user #{context[:current_user].uid} and doi #{object.doi.downcase}: " + response.body["errors"].inspect
return []
end

Rails.logger.info "Claims for user #{context[:current_user].uid} and doi #{object.doi} retrieved: " + response.body["data"].inspect
Rails.logger.info "Claims for user #{context[:current_user].uid} and doi #{object.doi.downcase} retrieved: " + response.body["data"].inspect

Array.wrap(response.body.dig("data")).map do |claim|
{ id: claim["id"],
Expand Down

0 comments on commit 1cdcc6b

Please sign in to comment.