Skip to content

Commit

Permalink
update graphql orcid support. #255
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 8, 2019
1 parent 6423eaa commit 751c96b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions app/models/researcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def self.find_by_id(id)
def self.parse_message(id: nil, message: nil)
{
id: id,
given_name: message.dig("name", "given-names", "value"),
family_name: message.dig("name", "family-name", "value"),
name: message.dig("name", "credit-name", "value") }.compact
name: message.dig("name", "credit-name", "value"),
"givenName" => message.dig("name", "given-names", "value"),
"familyName" => message.dig("name", "family-name", "value") }.compact
end

def self.orcid_from_url(url)
Expand Down
6 changes: 3 additions & 3 deletions spec/fixtures/vcr_cassettes/Researcher/find_by_id/found.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/models/researcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
id = "https://orcid.org/0000-0003-1419-2405"
researchers = Researcher.find_by_id(id)
expect(researchers.size).to eq(1)
expect(researchers.first).to eq(id: "https://orcid.org/0000-0003-1419-2405", name: "Martin Fenner", given_name: "Martin", family_name: "Fenner")
expect(researchers.first).to eq(id: "https://orcid.org/0000-0003-1419-2405", name: "Martin Fenner", "givenName" => "Martin", "familyName" => "Fenner")
end

it "not found" do
Expand Down

0 comments on commit 751c96b

Please sign in to comment.