diff --git a/app/graphql/types/base_connection.rb b/app/graphql/types/base_connection.rb index 9715aea22..4bfd77485 100644 --- a/app/graphql/types/base_connection.rb +++ b/app/graphql/types/base_connection.rb @@ -16,10 +16,12 @@ def orcid_from_url(url) end def prepare_args(args) - args[:user_id] ||= object.parent.try(:orcid).present? ? object.parent.orcid : nil - args[:user_id] = orcid_from_url(args[:user_id]) if args[:user_id].present? + args[:user_id] ||= object.parent.try(:type) == "Person" ? object.parent.orcid : nil args[:client_id] ||= object.parent.try(:client_type).present? ? object.parent.symbol.downcase : nil args[:provider_id] ||= object.parent.try(:region).present? ? object.parent.symbol.downcase : nil + args[:affiliation_id] ||= object.parent.try(:type) == "Organization" ? object.parent[:id] : nil + args[:funder_id] ||= object.parent.try(:type) == "Funder" ? object.parent[:id] : nil + args[:re3data_id] ||= object.parent.try(:type) == "DataCatalog" ? object.parent[:id] : nil args.compact end diff --git a/app/graphql/types/data_catalog_type.rb b/app/graphql/types/data_catalog_type.rb index 56b1f772d..380ed31d1 100644 --- a/app/graphql/types/data_catalog_type.rb +++ b/app/graphql/types/data_catalog_type.rb @@ -38,10 +38,6 @@ class DataCatalogType < BaseObject argument :first, Int, required: false, default_value: 25 end - def type - "DataCatalog" - end - def identifier Array.wrap(object.re3data_id).map { |o| { "name" => "re3data", "value" => "r3d#{o}" } } end diff --git a/app/graphql/types/dataset_connection_with_meta_type.rb b/app/graphql/types/dataset_connection_with_meta_type.rb index 6f03929b3..ac02f6451 100644 --- a/app/graphql/types/dataset_connection_with_meta_type.rb +++ b/app/graphql/types/dataset_connection_with_meta_type.rb @@ -27,7 +27,19 @@ def years end def response(**args) - @response ||= Doi.query(args[:query], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], year: args[:year], resource_type_id: "Dataset", has_citations: args[:has_citations], has_views: args[:has_views], has_downloads: args[:has_downloads], page: { number: 1, size: 0 }) + @response ||= Doi.query(args[:query], + user_id: args[:user_id], + client_id: args[:client_id], + provider_id: args[:provider_id], + funder_id: args[:funder_id], + affiliation_id: args[:affiliation_id], + re3data_id: args[:re3data_id], + year: args[:year], + resource_type_id: "Dataset", + has_citations: args[:has_citations], + has_views: args[:has_views], + has_downloads: args[:has_downloads], + page: { number: 1, size: 0 }) end def dataset_connection_count diff --git a/app/graphql/types/funder_type.rb b/app/graphql/types/funder_type.rb index 14dd57958..61188bd94 100644 --- a/app/graphql/types/funder_type.rb +++ b/app/graphql/types/funder_type.rb @@ -56,10 +56,6 @@ class FunderType < BaseObject argument :first, Int, required: false, default_value: 25 end - def type - "Funder" - end - def address { "type" => "postalAddress", "country" => object.country.to_h.fetch("name", nil) } diff --git a/app/graphql/types/organization_type.rb b/app/graphql/types/organization_type.rb index 8dde1201e..19aac7bb7 100644 --- a/app/graphql/types/organization_type.rb +++ b/app/graphql/types/organization_type.rb @@ -62,10 +62,6 @@ class OrganizationType < BaseObject argument :first, Int, required: false, default_value: 25 end - def type - "Organization" - end - def alternate_name object.aliases + object.acronyms end diff --git a/app/graphql/types/person_type.rb b/app/graphql/types/person_type.rb index c250fb0ce..4d8e68666 100644 --- a/app/graphql/types/person_type.rb +++ b/app/graphql/types/person_type.rb @@ -52,10 +52,6 @@ class PersonType < BaseObject argument :first, Int, required: false, default_value: 25 end - def type - "Person" - end - def publications(**args) Doi.query(args[:query], user_id: orcid_from_url(object[:id]), client_id: args[:client_id], provider_id: args[:provider_id], has_citations: args[:has_citations], has_views: args[:has_views], has_downloads: args[:has_downloads], resource_type_id: "Text", state: "findable", page: { number: 1, size: args[:first] }).results.to_a end diff --git a/app/graphql/types/provider_type.rb b/app/graphql/types/provider_type.rb index cb24dbbe6..ad6622168 100644 --- a/app/graphql/types/provider_type.rb +++ b/app/graphql/types/provider_type.rb @@ -17,6 +17,10 @@ class ProviderType < BaseObject field :organization_type, String, null: true, description: "Type of organization" field :focus_area, String, null: true, description: "Field of science covered by provider" field :joined, String, null: true, description: "Date provider joined DataCite" + field :view_count, Integer, null: true, description: "The number of views according to the Counter Code of Practice." + field :download_count, Integer, null: true, description: "The number of downloads according to the Counter Code of Practice." + field :citation_count, Integer, null: true, description: "The number of citations." + field :datasets, DatasetConnectionWithMetaType, null: true, connection: true, max_page_size: 1000, description: "Authored datasets" do argument :query, String, required: false argument :client_id, String, required: false @@ -106,4 +110,20 @@ def prefixes(**args) def clients(**args) Client.query(args[:query], provider_id: object.uid, year: args[:year], software: args[:software], page: { number: 1, size: args[:first] }).results.to_a end + + def view_count + response.results.total.positive? ? aggregate_count(response.response.aggregations.views.buckets) : [] + end + + def download_count + response.results.total.positive? ? aggregate_count(response.response.aggregations.downloads.buckets) : [] + end + + def citation_count + response.results.total.positive? ? aggregate_count(response.response.aggregations.citations.buckets) : [] + end + + def response + @response ||= Doi.query(nil, provider_id: object.uid, state: "findable", page: { number: 1, size: 0 }) + end end diff --git a/app/graphql/types/publication_connection_with_meta_type.rb b/app/graphql/types/publication_connection_with_meta_type.rb index ebcaf39d6..1148d381d 100644 --- a/app/graphql/types/publication_connection_with_meta_type.rb +++ b/app/graphql/types/publication_connection_with_meta_type.rb @@ -27,7 +27,19 @@ def years end def response(**args) - @response ||= Doi.query(args[:query], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], year: args[:year], resource_type_id: "Text", has_citations: args[:has_citations], has_views: args[:has_views], has_downloads: args[:has_downloads], page: { number: 1, size: 0 }) + @response ||= Doi.query(args[:query], + user_id: args[:user_id], + client_id: args[:client_id], + provider_id: args[:provider_id], + funder_id: args[:funder_id], + affiliation_id: args[:affiliation_id], + re3data_id: args[:re3data_id], + year: args[:year], + resource_type_id: "Text", + has_citations: args[:has_citations], + has_views: args[:has_views], + has_downloads: args[:has_downloads], + page: { number: 1, size: 0 }) end def publication_connection_count diff --git a/app/graphql/types/software_connection_with_meta_type.rb b/app/graphql/types/software_connection_with_meta_type.rb index 670b57b20..e2a15cf79 100644 --- a/app/graphql/types/software_connection_with_meta_type.rb +++ b/app/graphql/types/software_connection_with_meta_type.rb @@ -31,7 +31,19 @@ def years end def response(**args) - @response ||= Doi.query(args[:query], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], year: args[:year], resource_type_id: "Software", has_citations: args[:has_citations], has_views: args[:has_views], has_downloads: args[:has_downloads], page: { number: 1, size: 0 }) + @response ||= Doi.query(args[:query], + user_id: args[:user_id], + client_id: args[:client_id], + provider_id: args[:provider_id], + funder_id: args[:funder_id], + affiliation_id: args[:affiliation_id], + re3data_id: args[:re3data_id], + year: args[:year], + resource_type_id: "Software", + has_citations: args[:has_citations], + has_views: args[:has_views], + has_downloads: args[:has_downloads], + page: { number: 1, size: 0 }) end def software_connection_count diff --git a/app/graphql/types/work_connection_with_meta_type.rb b/app/graphql/types/work_connection_with_meta_type.rb index bdae52b96..bbcb05f46 100644 --- a/app/graphql/types/work_connection_with_meta_type.rb +++ b/app/graphql/types/work_connection_with_meta_type.rb @@ -10,6 +10,7 @@ class WorkConnectionWithMetaType < BaseConnection def total_count args = prepare_args(object.arguments) + Rails.logger.warn object.parent.inspect response(**args).results.total end @@ -29,6 +30,18 @@ def resource_types end def response(**args) - @response ||= Doi.query(args[:query], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], year: args[:year], resource_type_id: args[:resource_type_id], has_citations: args[:has_citations], has_views: args[:has_views], has_downloads: args[:has_downloads], page: { number: 1, size: 0 }) + @response ||= Doi.query(args[:query], + user_id: args[:user_id], + client_id: args[:client_id], + provider_id: args[:provider_id], + funder_id: args[:funder_id], + affiliation_id: args[:affiliation_id], + re3data_id: args[:re3data_id], + year: args[:year], + resource_type_id: args[:resource_type_id], + has_citations: args[:has_citations], + has_views: args[:has_views], + has_downloads: args[:has_downloads], + page: { number: 1, size: 0 }) end end diff --git a/app/models/data_catalog.rb b/app/models/data_catalog.rb index 4adf3522e..9ad52e43e 100644 --- a/app/models/data_catalog.rb +++ b/app/models/data_catalog.rb @@ -52,6 +52,7 @@ def self.query(query, options={}) def self.parse_message(id: nil, message: nil) Hashie::Mash.new({ id: id, + type: "DataCatalog", re3data_id: message["re3dataId"], name: message["repositoryName"], url: message["repositoryUrl"], diff --git a/app/models/funder.rb b/app/models/funder.rb index 4977978a4..319b2572c 100644 --- a/app/models/funder.rb +++ b/app/models/funder.rb @@ -55,6 +55,7 @@ def self.parse_message(id: nil, message: nil) Hashie::Mash.new({ id: id, + type: "Funder", name: message["name"], alternate_name: message["alt-names"], country: country, diff --git a/app/models/organization.rb b/app/models/organization.rb index 08042268c..2246bdaaf 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -52,6 +52,7 @@ def self.parse_message(id: nil, message: nil) Hashie::Mash.new({ id: id, + type: "Organization", name: message["name"], aliases: message["aliases"], acronyms: message["acronyms"], diff --git a/app/models/person.rb b/app/models/person.rb index abf00bfb2..a1e3ce2b1 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -47,6 +47,7 @@ def self.query(query, options={}) def self.parse_message(id: nil, message: nil) Hashie::Mash.new({ id: id, + type: "Person", orcid: message["orcid"], name: message["name"], given_name: message["givenName"], diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_crossref_funder_id.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_crossref_funder_id.yml index c8bdd0a90..9059dafcb 100644 --- a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_crossref_funder_id.yml +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_crossref_funder_id.yml @@ -25,7 +25,7 @@ http_interactions: Connection: - keep-alive Date: - - Sun, 29 Mar 2020 17:06:33 GMT + - Mon, 30 Mar 2020 18:57:13 GMT Status: - 200 OK X-Frame-Options: @@ -41,17 +41,17 @@ http_interactions: X-Cache: - Hit from cloudfront Via: - - 1.1 9e627a2e7bf673974b02e3bf374bb843.cloudfront.net (CloudFront) + - 1.1 3395b043e03ecb4acfd925a6e5a26e92.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - DUS51-C1 X-Amz-C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ImdyaWQuMTQwOTUuMzkiLCJhbGwiOiJncmlkLjE0MDk1LjM5In19fV0sIm1ldGEiOnsidHlwZXMiOlt7ImlkIjoiZWR1Y2F0aW9uIiwidGl0bGUiOiJFZHVjYXRpb24iLCJjb3VudCI6MX1dLCJjb3VudHJpZXMiOlt7ImlkIjoiZGUiLCJ0aXRsZSI6IkZlZGVyYWwgUmVwdWJsaWMgb2YgR2VybWFueSIsImNvdW50IjoxfV19fQ== http_version: null - recorded_at: Sun, 29 Mar 2020 19:52:06 GMT + recorded_at: Mon, 30 Mar 2020 18:57:37 GMT recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_crossref_funder_id_as_url.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_crossref_funder_id_as_url.yml index 6a83982dc..3e796e5ab 100644 --- a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_crossref_funder_id_as_url.yml +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_crossref_funder_id_as_url.yml @@ -25,7 +25,7 @@ http_interactions: Connection: - keep-alive Date: - - Sun, 29 Mar 2020 17:06:33 GMT + - Mon, 30 Mar 2020 18:57:13 GMT Status: - 200 OK X-Frame-Options: @@ -41,17 +41,17 @@ http_interactions: X-Cache: - Hit from cloudfront Via: - - 1.1 d0be2eec997f966c9c7eb03ae2f75c30.cloudfront.net (CloudFront) + - 1.1 5cd60f530cdafe284762767565aa2747.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - DUS51-C1 X-Amz-Cf-Id: - - IR576DDe20N0BecU92aq4oIlJ1qrGTUBR8KX1wkWI9MYk4xbzXueSg== + - m0H2dIKUIcHRaRGKRfWpSKxCQaLU1NV2cXg7LSlLxa8rzjyZ383tfA== Age: - - '9925' + - '28' body: encoding: ASCII-8BIT string: !binary |- eyJudW1iZXJfb2ZfcmVzdWx0cyI6MSwidGltZV90YWtlbiI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wdWJsaWMgb2YgR2VybWFueSIsImNvdW50IjoxfV19fQ== http_version: null - recorded_at: Sun, 29 Mar 2020 19:51:58 GMT + recorded_at: Mon, 30 Mar 2020 18:57:41 GMT recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_orcid_id.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_orcid_id.yml index d7139c804..3a18c0499 100644 --- a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_orcid_id.yml +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_orcid_id.yml @@ -25,7 +25,7 @@ http_interactions: Connection: - keep-alive Date: - - Sun, 29 Mar 2020 17:06:33 GMT + - Mon, 30 Mar 2020 18:57:13 GMT Status: - 200 OK X-Frame-Options: @@ -45,13 +45,13 @@ http_interactions: X-Amz-Cf-Pop: - DUS51-C1 X-Amz-Cf-Id: - - aKdXdMUhDBteQDBZR431yy8r9fzTr3VFd3zJWjezjSJnQqH0mDtXCA== + - wreLL5xBppofzCrertVG9ggQkf1XG4ib2orsFLYLyYMAJtefuv_sUA== Age: - - '9949' + - '10' body: encoding: ASCII-8BIT string: !binary |- eyJudW1iZXJfb2ZfcmVzdWx0cyI6MSwidGltZV90YWtlbiI6MTUsIml0ZW1zIjpbeyJpZCI6Imh0dHBzOi8vcm9yLm9yZy8wNDZhazI0ODUiLCJuYW1lIjoiRnJlaWUgVW5pdmVyc2l0w6R0IEJlcmxpbiIsInR5cGVzIjpbIkVkdWNhdGlvbiJdLCJsaW5rcyI6WyJodHRwOi8vd3d3LmZ1LWJlcmxpbi5kZS9lbi8iXSwiYWxpYXNlcyI6WyJGVSBCZXJsaW4iXSwiYWNyb255bXMiOlsiRlUiXSwic3RhdHVzIjoiYWN0aXZlIiwid2lraXBlZGlhX3VybCI6Imh0dHA6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvRnJlZV9Vbml2ZXJzaXR5X29mX0JlcmxpbiIsImxhYmVscyI6W3sibGFiZWwiOiJGcmVlIFVuaXZlcnNpdHkgb2YgQmVybGluIiwiaXNvNjM5IjoiZW4ifV0sImNvdW50cnkiOnsiY291bnRyeV9uYW1lIjoiR2VybWFueSIsImNvdW50cnlfY29kZSI6IkRFIn0sImV4dGVybmFsX2lkcyI6eyJJU05JIjp7InByZWZlcnJlZCI6bnVsbCwiYWxsIjpbIjAwMDAgMDAwMCA5MTE2IDQ4MzYiXX0sIkZ1bmRSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiNTAxMTAwMDAxNjQ0IiwiNTAxMTAwMDAyOTcxIl19LCJPcmdSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiMzE1Mjc1Il19LCJXaWtpZGF0YSI6eyJwcmVmZXJyZWQiOm51bGwsImFsbCI6WyJRMTUzMDA2Il19LCJHUklEIjp7InByZWZlcnJlZCI6ImdyaWQuMTQwOTUuMzkiLCJhbGwiOiJncmlkLjE0MDk1LjM5In19fV0sIm1ldGEiOnsidHlwZXMiOlt7ImlkIjoiZWR1Y2F0aW9uIiwidGl0bGUiOiJFZHVjYXRpb24iLCJjb3VudCI6MX1dLCJjb3VudHJpZXMiOlt7ImlkIjoiZGUiLCJ0aXRsZSI6IkZlZGVyYWwgUmVwdWJsaWMgb2YgR2VybWFueSIsImNvdW50IjoxfV19fQ== http_version: null - recorded_at: Sun, 29 Mar 2020 19:52:22 GMT + recorded_at: Mon, 30 Mar 2020 18:57:23 GMT recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_orcid_id_as_url.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_orcid_id_as_url.yml index a4ba7b303..e8c2db48e 100644 --- a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_orcid_id_as_url.yml +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_orcid_id_as_url.yml @@ -25,7 +25,7 @@ http_interactions: Connection: - keep-alive Date: - - Sun, 29 Mar 2020 17:06:33 GMT + - Mon, 30 Mar 2020 18:57:13 GMT Status: - 200 OK X-Frame-Options: @@ -39,19 +39,17 @@ http_interactions: Vary: - Cookie,Origin X-Cache: - - Hit from cloudfront + - Miss from cloudfront Via: - - 1.1 20f674d6a4a322fa027d3644cb825864.cloudfront.net (CloudFront) + - 1.1 e8640ab30463560abfb6a2665bafb393.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - DUS51-C1 X-Amz-Cf-Id: - - Tek6EM7TeVV2lbwubBa66DZZs8ACWOWvd23nJLK4u75Gsd2zniau7A== - Age: - - '9945' + - oGf3as8F89YN5BSDjoJwvgf7VKV6P9H0WOM-Owpt1gYq_vdwF2j1xA== body: encoding: ASCII-8BIT string: !binary |- eyJudW1iZXJfb2ZfcmVzdWx0cyI6MSwidGltZV90YWtlbiI6MTUsIml0ZW1zIjpbeyJpZCI6Imh0dHBzOi8vcm9yLm9yZy8wNDZhazI0ODUiLCJuYW1lIjoiRnJlaWUgVW5pdmVyc2l0w6R0IEJlcmxpbiIsInR5cGVzIjpbIkVkdWNhdGlvbiJdLCJsaW5rcyI6WyJodHRwOi8vd3d3LmZ1LWJlcmxpbi5kZS9lbi8iXSwiYWxpYXNlcyI6WyJGVSBCZXJsaW4iXSwiYWNyb255bXMiOlsiRlUiXSwic3RhdHVzIjoiYWN0aXZlIiwid2lraXBlZGlhX3VybCI6Imh0dHA6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvRnJlZV9Vbml2ZXJzaXR5X29mX0JlcmxpbiIsImxhYmVscyI6W3sibGFiZWwiOiJGcmVlIFVuaXZlcnNpdHkgb2YgQmVybGluIiwiaXNvNjM5IjoiZW4ifV0sImNvdW50cnkiOnsiY291bnRyeV9uYW1lIjoiR2VybWFueSIsImNvdW50cnlfY29kZSI6IkRFIn0sImV4dGVybmFsX2lkcyI6eyJJU05JIjp7InByZWZlcnJlZCI6bnVsbCwiYWxsIjpbIjAwMDAgMDAwMCA5MTE2IDQ4MzYiXX0sIkZ1bmRSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiNTAxMTAwMDAxNjQ0IiwiNTAxMTAwMDAyOTcxIl19LCJPcmdSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiMzE1Mjc1Il19LCJXaWtpZGF0YSI6eyJwcmVmZXJyZWQiOm51bGwsImFsbCI6WyJRMTUzMDA2Il19LCJHUklEIjp7InByZWZlcnJlZCI6ImdyaWQuMTQwOTUuMzkiLCJhbGwiOiJncmlkLjE0MDk1LjM5In19fV0sIm1ldGEiOnsidHlwZXMiOlt7ImlkIjoiZWR1Y2F0aW9uIiwidGl0bGUiOiJFZHVjYXRpb24iLCJjb3VudCI6MX1dLCJjb3VudHJpZXMiOlt7ImlkIjoiZGUiLCJ0aXRsZSI6IkZlZGVyYWwgUmVwdWJsaWMgb2YgR2VybWFueSIsImNvdW50IjoxfV19fQ== http_version: null - recorded_at: Sun, 29 Mar 2020 19:52:18 GMT + recorded_at: Mon, 30 Mar 2020 18:57:13 GMT recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_re3data_id.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_re3data_id.yml index 000411732..b97aa2c39 100644 --- a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_re3data_id.yml +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_re3data_id.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://api.ror.org/organizations?query=%22https://ror.org/04wxnsj81%22%20%22https://ror.org/046ak2485%22 + uri: https://api.ror.org/organizations?query=%22https://ror.org/046ak2485%22 body: encoding: US-ASCII string: '' @@ -20,10 +20,12 @@ http_interactions: headers: Content-Type: - application/json + Content-Length: + - '868' Connection: - keep-alive Date: - - Sun, 29 Mar 2020 20:26:39 GMT + - Mon, 30 Mar 2020 18:57:13 GMT Status: - 200 OK X-Frame-Options: @@ -34,22 +36,22 @@ http_interactions: - Phusion Passenger 6.0.4 Server: - nginx/1.17.3 + Phusion Passenger 6.0.4 - Content-Encoding: - - gzip Vary: - - Accept-Encoding,Cookie,Origin + - Cookie,Origin X-Cache: - - Miss from cloudfront + - Hit from cloudfront Via: - - 1.1 c51e3be89c14e3f859ea898f7e36eced.cloudfront.net (CloudFront) + - 1.1 9ed795ea7207c9add01c8c2ab17d8299.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - DUS51-C1 X-Amz-Cf-Id: - - V5u7y-CsW8vs4ezSpcBmW6YYN-TIUln6hCAqDQB9byBAo3-xZDaFRA== + - 9KiTamNC2qDBMlOUVPFPWRkO1WTOw0-1ZZpf8ZHZlS3RXNFKIzmMjA== + Age: + - '14' body: encoding: ASCII-8BIT string: !binary |- - H4sIAAAAAAAAA6xUwY6bMBD9FeQzJUCATXJsN1nlkmpTrXpYRciBIXVjDDKmWRTxN/2T/ljHJDgkVbY9lAPyjOeN/eY9+UhEnW9BxkUWS6hqrioy822iWA6xonsQGEY2YQpy3Hk9EpaSGfmmVFnNRiNZSKeQu5EbHN5E9X3iEZsImgOWPFJFPyEMM6opQYPJqhClLDKmyMYmnIl9l+2bHQ4HJ0VUgijdVRdRzmjVgXWQyEI0+TmqFFU1rjGt2A99zoHtWQkpo3Et+eCWIByz1V1XR6PBBTndAj+3TYpaKNmQ2bFfxmdGTyBzKhpiauKkSDuqc9LaBN4USEF5zNJKo7/iIZqOXpcSMpAS9OyeJ74XBj7R5Ljm3yc22ORpvXy8BewkS53gIZz4kUN72E22bVv7rjYR3fvBJLxos5DAwHoRODZZMfXrp7I+gkRBhmLN0zqhihXiD7HOWmX1h22HclLAGY+u9SKLl77ptXS4Qf5ZvrvqIQWIDYNG+9dQMHIeT8sT4wHhxiqyC2NWFdF4ikVo9vZ/OmD5ZbW8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bGwsImFsbCI6WyJRMTUzMDA2Il19LCJHUklEIjp7InByZWZlcnJlZCI6ImdyaWQuMTQwOTUuMzkiLCJhbGwiOiJncmlkLjE0MDk1LjM5In19fV0sIm1ldGEiOnsidHlwZXMiOlt7ImlkIjoiZWR1Y2F0aW9uIiwidGl0bGUiOiJFZHVjYXRpb24iLCJjb3VudCI6MX1dLCJjb3VudHJpZXMiOlt7ImlkIjoiZGUiLCJ0aXRsZSI6IkZlZGVyYWwgUmVwdWJsaWMgb2YgR2VybWFueSIsImNvdW50IjoxfV19fQ== http_version: null - recorded_at: Sun, 29 Mar 2020 20:26:39 GMT + recorded_at: Mon, 30 Mar 2020 18:57:27 GMT recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_re3data_id_as_url.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_re3data_id_as_url.yml new file mode 100644 index 000000000..0381a8e51 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_re3data_id_as_url.yml @@ -0,0 +1,57 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.ror.org/organizations?query=%22https://ror.org/046ak2485%22 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.6.1; mailto:info@datacite.org) + Accept: + - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5 + Accept-Encoding: + - gzip,deflate + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json + Content-Length: + - '868' + Connection: + - keep-alive + Date: + - Mon, 30 Mar 2020 18:57:13 GMT + Status: + - 200 OK + X-Frame-Options: + - SAMEORIGIN + Allow: + - GET, HEAD, OPTIONS + X-Powered-By: + - Phusion Passenger 6.0.4 + Server: + - nginx/1.17.3 + Phusion Passenger 6.0.4 + Vary: + - Cookie,Origin + X-Cache: + - Hit from cloudfront + Via: + - 1.1 e5dcf90f3787d486ad40e46070021460.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - DUS51-C1 + X-Amz-Cf-Id: + - 2JpAiSOgDr_6CkQ0kg8eE4zOwlSEZk0P1aHGNr_kMslsWS6W_UrUZg== + Age: + - '5' + body: + encoding: ASCII-8BIT + string: !binary |- + eyJudW1iZXJfb2ZfcmVzdWx0cyI6MSwidGltZV90YWtlbiI6MTUsIml0ZW1zIjpbeyJpZCI6Imh0dHBzOi8vcm9yLm9yZy8wNDZhazI0ODUiLCJuYW1lIjoiRnJlaWUgVW5pdmVyc2l0w6R0IEJlcmxpbiIsInR5cGVzIjpbIkVkdWNhdGlvbiJdLCJsaW5rcyI6WyJodHRwOi8vd3d3LmZ1LWJlcmxpbi5kZS9lbi8iXSwiYWxpYXNlcyI6WyJGVSBCZXJsaW4iXSwiYWNyb255bXMiOlsiRlUiXSwic3RhdHVzIjoiYWN0aXZlIiwid2lraXBlZGlhX3VybCI6Imh0dHA6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvRnJlZV9Vbml2ZXJzaXR5X29mX0JlcmxpbiIsImxhYmVscyI6W3sibGFiZWwiOiJGcmVlIFVuaXZlcnNpdHkgb2YgQmVybGluIiwiaXNvNjM5IjoiZW4ifV0sImNvdW50cnkiOnsiY291bnRyeV9uYW1lIjoiR2VybWFueSIsImNvdW50cnlfY29kZSI6IkRFIn0sImV4dGVybmFsX2lkcyI6eyJJU05JIjp7InByZWZlcnJlZCI6bnVsbCwiYWxsIjpbIjAwMDAgMDAwMCA5MTE2IDQ4MzYiXX0sIkZ1bmRSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiNTAxMTAwMDAxNjQ0IiwiNTAxMTAwMDAyOTcxIl19LCJPcmdSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiMzE1Mjc1Il19LCJXaWtpZGF0YSI6eyJwcmVmZXJyZWQiOm51bGwsImFsbCI6WyJRMTUzMDA2Il19LCJHUklEIjp7InByZWZlcnJlZCI6ImdyaWQuMTQwOTUuMzkiLCJhbGwiOiJncmlkLjE0MDk1LjM5In19fV0sIm1ldGEiOnsidHlwZXMiOlt7ImlkIjoiZWR1Y2F0aW9uIiwidGl0bGUiOiJFZHVjYXRpb24iLCJjb3VudCI6MX1dLCJjb3VudHJpZXMiOlt7ImlkIjoiZGUiLCJ0aXRsZSI6IkZlZGVyYWwgUmVwdWJsaWMgb2YgR2VybWFueSIsImNvdW50IjoxfV19fQ== + http_version: null + recorded_at: Mon, 30 Mar 2020 18:57:18 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_ror_id.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_ror_id.yml index 2170937f0..42caa6a33 100644 --- a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_ror_id.yml +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_ror_id.yml @@ -25,7 +25,7 @@ http_interactions: Connection: - keep-alive Date: - - Sun, 29 Mar 2020 17:06:33 GMT + - Mon, 30 Mar 2020 18:57:13 GMT Status: - 200 OK X-Frame-Options: @@ -41,17 +41,17 @@ http_interactions: X-Cache: - Hit from cloudfront Via: - - 1.1 e8640ab30463560abfb6a2665bafb393.cloudfront.net (CloudFront) + - 1.1 821feb380ab4aeca6ae9157aa1190ff2.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - DUS51-C1 X-Amz-Cf-Id: - - Fpeuto_OMhhboIXN-6_Q5TCFWvm3YwZCulmDi3bfyAdHlrDc-BJwZQ== + - bcm6LDaIG_WepZqu4sDsOjtJIv-IMk7dxfqvAG3fHKb3Ir7AfMuisg== Age: - - '9937' + - '37' body: encoding: ASCII-8BIT string: !binary |- eyJudW1iZXJfb2ZfcmVzdWx0cyI6MSwidGltZV90YWtlbiI6MTUsIml0ZW1zIjpbeyJpZCI6Imh0dHBzOi8vcm9yLm9yZy8wNDZhaz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un, 29 Mar 2020 19:52:10 GMT + recorded_at: Mon, 30 Mar 2020 18:57:50 GMT recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_ror_id_as_url.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_ror_id_as_url.yml index 63ae74606..36d4ffbc1 100644 --- a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_ror_id_as_url.yml +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_ror_id_as_url.yml @@ -25,7 +25,7 @@ http_interactions: Connection: - keep-alive Date: - - Sun, 29 Mar 2020 17:06:33 GMT + - Mon, 30 Mar 2020 18:57:13 GMT Status: - 200 OK X-Frame-Options: @@ -41,17 +41,17 @@ http_interactions: X-Cache: - Hit from cloudfront Via: - - 1.1 f12c01365a7e1bcbb4b6d5b856516527.cloudfront.net (CloudFront) + - 1.1 414a05dee9c365a2a2079013f9d53671.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - DUS51-C1 X-Amz-Cf-Id: - - DQeq7dVe3tWiZaYNvSvtSTzwFuw6hvGbP7W7bq20XuSqDHu4wkLnBw== + - 5CiZLEi7aeUF9QzSM435L108Jol09ARlRy901uJeSkq11AYoxEjjyQ== Age: - - '9953' + - '33' body: encoding: ASCII-8BIT string: !binary |- eyJudW1iZXJfb2ZfcmVzdWx0cyI6MSwidGltZV90YWtlbiI6MTUsIml0ZW1zIjpbeyJpZCI6Imh0dHBzOi8vcm9yLm9yZy8wNDZhazI0ODUiLCJuYW1lIjoiRnJlaWUgVW5pdmVyc2l0w6R0IEJlcmxpbiIsInR5cGVzIjpbIkVkdWNhdGlvbiJdLCJsaW5rcyI6WyJodHRwOi8vd3d3LmZ1LWJlcmxpbi5kZS9lbi8iXSwiYWxpYXNlcyI6WyJGVSBCZXJsaW4iXSwiYWNyb255bXMiOlsiRlUiXSwic3RhdHVzIjoiYWN0aXZlIiwid2lraXBlZGlhX3VybCI6Imh0dHA6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvRnJlZV9Vbml2ZXJzaXR5X29mX0JlcmxpbiIsImxhYmVscyI6W3sibGFiZWwiOiJGcmVlIFVuaXZlcnNpdHkgb2YgQmVybGluIiwiaXNvNjM5IjoiZW4ifV0sImNvdW50cnkiOnsiY291bnRyeV9uYW1lIjoiR2VybWFueSIsImNvdW50cnlfY29kZSI6IkRFIn0sImV4dGVybmFsX2lkcyI6eyJJU05JIjp7InByZWZlcnJlZCI6bnVsbCwiYWxsIjpbIjAwMDAgMDAwMCA5MTE2IDQ4MzYiXX0sIkZ1bmRSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiNTAxMTAwMDAxNjQ0IiwiNTAxMTAwMDAyOTcxIl19LCJPcmdSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiMzE1Mjc1Il19LCJXaWtpZGF0YSI6eyJwcmVmZXJyZWQiOm51bGwsImFsbCI6WyJRMTUzMDA2Il19LCJHUklEIjp7InByZWZlcnJlZCI6ImdyaWQuMTQwOTUuMzkiLCJhbGwiOiJncmlkLjE0MDk1LjM5In19fV0sIm1ldGEiOnsidHlwZXMiOlt7ImlkIjoiZWR1Y2F0aW9uIiwidGl0bGUiOiJFZHVjYXRpb24iLCJjb3VudCI6MX1dLCJjb3VudHJpZXMiOlt7ImlkIjoiZGUiLCJ0aXRsZSI6IkZlZGVyYWwgUmVwdWJsaWMgb2YgR2VybWFueSIsImNvdW50IjoxfV19fQ== http_version: null - recorded_at: Sun, 29 Mar 2020 19:52:26 GMT + recorded_at: Mon, 30 Mar 2020 18:57:46 GMT recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_short_orcid_id.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_short_orcid_id.yml index 432a9db6c..a708d70d3 100644 --- a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_short_orcid_id.yml +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_short_orcid_id.yml @@ -25,7 +25,7 @@ http_interactions: Connection: - keep-alive Date: - - Sun, 29 Mar 2020 17:06:33 GMT + - Mon, 30 Mar 2020 18:57:13 GMT Status: - 200 OK X-Frame-Options: @@ -41,17 +41,17 @@ http_interactions: X-Cache: - Hit from cloudfront Via: - - 1.1 3e9b9356decf1aa720af0bc92acc0586.cloudfront.net (CloudFront) + - 1.1 e7b88cadf742e342f39f17392af35c4f.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - DUS51-C1 X-Amz-Cf-Id: - - 1UHTGCQgyMb6qc37NZNlsGJtGfsHbNm7MkwOsJXrwQSxRokxhm_Usw== + - MsduDui7pS7_pzZZtZcqYOBi30k7BGhDhjEx7dNCEcjWc4FNVWpK9A== Age: - - '9929' + - '19' body: encoding: ASCII-8BIT string: !binary |- eyJudW1iZXJfb2ZfcmVzdWx0cyI6MSwidGltZV90YWtlbiI6MTUsIml0ZW1zIjpbeyJpZCI6Imh0dHBzOi8vcm9yLm9yZy8wNDZhazI0ODUiLCJuYW1lIjoiRnJlaWUgVW5pdmVyc2l0w6R0IEJlcmxpbiIsInR5cGVzIjpbIkVkdWNhdGlvbiJdLCJsaW5rcyI6WyJodHRwOi8vd3d3LmZ1LWJlcmxpbi5kZS9lbi8iXSwiYWxpYXNlcyI6WyJGVSBCZXJsaW4iXSwiYWNyb255bXMiOlsiRlUiXSwic3RhdHVzIjoiYWN0aXZlIiwid2lraXBlZGlhX3VybCI6Imh0dHA6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvRnJlZV9Vbml2ZXJzaXR5X29mX0JlcmxpbiIsImxhYmVscyI6W3sibGFiZWwiOiJGcmVlIFVuaXZlcnNpdHkgb2YgQmVybGluIiwiaXNvNjM5IjoiZW4ifV0sImNvdW50cnkiOnsiY291bnRyeV9uYW1lIjoiR2VybWFueSIsImNvdW50cnlfY29kZSI6IkRFIn0sImV4dGVybmFsX2lkcyI6eyJJU05JIjp7InByZWZlcnJlZCI6bnVsbCwiYWxsIjpbIjAwMDAgMDAwMCA5MTE2IDQ4MzYiXX0sIkZ1bmRSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiNTAxMTAwMDAxNjQ0IiwiNTAxMTAwMDAyOTcxIl19LCJPcmdSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiMzE1Mjc1Il19LCJXaWtpZGF0YSI6eyJwcmVmZXJyZWQiOm51bGwsImFsbCI6WyJRMTUzMDA2Il19LCJHUklEIjp7InByZWZlcnJlZCI6ImdyaWQuMTQwOTUuMzkiLCJhbGwiOiJncmlkLjE0MDk1LjM5In19fV0sIm1ldGEiOnsidHlwZXMiOlt7ImlkIjoiZWR1Y2F0aW9uIiwidGl0bGUiOiJFZHVjYXRpb24iLCJjb3VudCI6MX1dLCJjb3VudHJpZXMiOlt7ImlkIjoiZGUiLCJ0aXRsZSI6IkZlZGVyYWwgUmVwdWJsaWMgb2YgR2VybWFueSIsImNvdW50IjoxfV19fQ== http_version: null - recorded_at: Sun, 29 Mar 2020 19:52:02 GMT + recorded_at: Mon, 30 Mar 2020 18:57:32 GMT recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_short_ror_id.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_short_ror_id.yml index bd94f14b7..3c335a2aa 100644 --- a/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_short_ror_id.yml +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_with_query/returns_dois_with_short_ror_id.yml @@ -25,7 +25,7 @@ http_interactions: Connection: - keep-alive Date: - - Sun, 29 Mar 2020 17:06:33 GMT + - Mon, 30 Mar 2020 18:57:13 GMT Status: - 200 OK X-Frame-Options: @@ -41,17 +41,17 @@ http_interactions: X-Cache: - Hit from cloudfront Via: - - 1.1 962c9e2b0aa7dee39ccec2b38fda120f.cloudfront.net (CloudFront) + - 1.1 e542677c3bd2d6c30a5ed3dab78f8476.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - DUS51-C1 X-Amz-Cf-Id: - - 5bPfZX0vmHc1RkCU_xL5VJ_ZunxSC4rwTGPWNP3i0P25D8bNtDBcGQ== + - tjT2YrikO8J1_Hgls_TfliqH5X_lagioxgzIZ5TE7W7i1W7oDGa46g== Age: - - '9941' + - '168' body: encoding: ASCII-8BIT string: !binary |- eyJudW1iZXJfb2ZfcmVzdWx0cyI6MSwidGltZV90YWtlbiI6MTUsIml0ZW1zIjpbeyJpZCI6Imh0dHBzOi8vcm9yLm9yZy8wNDZhazI0ODUiLCJuYW1lIjoiRnJlaWUgVW5pdmVyc2l0w6R0IEJlcmxpbiIsInR5cGVzIjpbIkVkdWNhdGlvbiJdLCJsaW5rcyI6WyJodHRwOi8vd3d3LmZ1LWJlcmxpbi5kZS9lbi8iXSwiYWxpYXNlcyI6WyJGVSBCZXJsaW4iXSwiYWNyb255bXMiOlsiRlUiXSwic3RhdHVzIjoiYWN0aXZlIiwid2lraXBlZGlhX3VybCI6Imh0dHA6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvRnJlZV9Vbml2ZXJzaXR5X29mX0JlcmxpbiIsImxhYmVscyI6W3sibGFiZWwiOiJGcmVlIFVuaXZlcnNpdHkgb2YgQmVybGluIiwiaXNvNjM5IjoiZW4ifV0sImNvdW50cnkiOnsiY291bnRyeV9uYW1lIjoiR2VybWFueSIsImNvdW50cnlfY29kZSI6IkRFIn0sImV4dGVybmFsX2lkcyI6eyJJU05JIjp7InByZWZlcnJlZCI6bnVsbCwiYWxsIjpbIjAwMDAgMDAwMCA5MTE2IDQ4MzYiXX0sIkZ1bmRSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiNTAxMTAwMDAxNjQ0IiwiNTAxMTAwMDAyOTcxIl19LCJPcmdSZWYiOnsicHJlZmVycmVkIjpudWxsLCJhbGwiOlsiMzE1Mjc1Il19LCJXaWtpZGF0YSI6eyJwcmVmZXJyZWQiOm51bGwsImFsbCI6WyJRMTUzMDA2Il19LCJHUklEIjp7InByZWZlcnJlZCI6ImdyaWQuMTQwOTUuMzkiLCJhbGwiOiJncmlkLjE0MDk1LjM5In19fV0sIm1ldGEiOnsidHlwZXMiOlt7ImlkIjoiZWR1Y2F0aW9uIiwidGl0bGUiOiJFZHVjYXRpb24iLCJjb3VudCI6MX1dLCJjb3VudHJpZXMiOlt7ImlkIjoiZGUiLCJ0aXRsZSI6IkZlZGVyYWwgUmVwdWJsaWMgb2YgR2VybWFueSIsImNvdW50IjoxfV19fQ== http_version: null - recorded_at: Sun, 29 Mar 2020 19:52:14 GMT + recorded_at: Mon, 30 Mar 2020 19:00:01 GMT recorded_with: VCR 5.1.0 diff --git a/spec/graphql/types/query_type_spec.rb b/spec/graphql/types/query_type_spec.rb index 9c913bc70..8d78e7171 100644 --- a/spec/graphql/types/query_type_spec.rb +++ b/spec/graphql/types/query_type_spec.rb @@ -344,7 +344,7 @@ it "returns datasets" do response = LupoSchema.execute(query).as_json - + puts response expect(response.dig("data", "datasets", "totalCount")).to eq(3) expect(response.dig("data", "datasets", "years")).to eq([{"count"=>3, "id"=>"2011"}]) expect(response.dig("data", "datasets", "nodes").length).to eq(3) @@ -672,11 +672,11 @@ expect(response.dig("data", "funder", "id")).to eq("https://doi.org/10.13039/501100009053") expect(response.dig("data", "funder", "name")).to eq("The Wellcome Trust DBT India Alliance") expect(response.dig("data", "funder", "citationCount")).to eq(0) - # TODO should be 1 - expect(response.dig("data", "funder", "works", "totalCount")).to eq(3) - # expect(response.dig("data", "funder", "works", "years")).to eq([{"count"=>1, "title"=>"2011"}]) - # expect(response.dig("data", "funder", "works", "resourceTypes")).to eq([{"count"=>1, "title"=>"Dataset"}]) - # expect(response.dig("data", "funder", "works", "nodes").length).to eq(1) + + expect(response.dig("data", "funder", "works", "totalCount")).to eq(1) + expect(response.dig("data", "funder", "works", "years")).to eq([{"count"=>1, "title"=>"2011"}]) + expect(response.dig("data", "funder", "works", "resourceTypes")).to eq([{"count"=>1, "title"=>"Dataset"}]) + expect(response.dig("data", "funder", "works", "nodes").length).to eq(1) work = response.dig("data", "funder", "works", "nodes", 0) expect(work.dig("titles", 0, "title")).to eq("Data from: A new malaria agent in African hominids.") @@ -719,7 +719,7 @@ it "returns funder information" do response = LupoSchema.execute(query).as_json - + puts response expect(response.dig("data", "funders", "totalCount")).to eq(4) expect(response.dig("data", "funders", "nodes").length).to eq(4) funder = response.dig("data", "funders", "nodes", 0) @@ -799,11 +799,10 @@ expect(response.dig("data", "organization", "name")).to eq("University of Cambridge") expect(response.dig("data", "organization", "alternateName")).to eq(["Cambridge University"]) expect(response.dig("data", "organization", "citationCount")).to eq(0) - # TODO should be 1 - expect(response.dig("data", "organization", "works", "totalCount")).to eq(3) - # expect(response.dig("data", "organization", "works", "years")).to eq([{"count"=>1, "title"=>"2011"}]) - # expect(response.dig("data", "organization", "works", "resourceTypes")).to eq([{"count"=>1, "title"=>"Dataset"}]) - # expect(response.dig("data", "organization", "works", "nodes").length).to eq(1) + expect(response.dig("data", "organization", "works", "totalCount")).to eq(1) + expect(response.dig("data", "organization", "works", "years")).to eq([{"count"=>1, "title"=>"2011"}]) + expect(response.dig("data", "organization", "works", "resourceTypes")).to eq([{"count"=>1, "title"=>"Dataset"}]) + expect(response.dig("data", "organization", "works", "nodes").length).to eq(1) work = response.dig("data", "organization", "works", "nodes", 0) expect(work.dig("titles", 0, "title")).to eq("Data from: A new malaria agent in African hominids.") @@ -870,9 +869,9 @@ expect(organization.fetch("alternateName")).to eq(["Cambridge University"]) expect(organization.fetch("identifiers").length).to eq(39) expect(organization.fetch("identifiers").last).to eq("identifier"=>"http://en.wikipedia.org/wiki/University_of_Cambridge", "identifierType"=>"wikipedia") - # TODO should be 1 - expect(organization.dig("works", "totalCount")).to eq(4) - expect(organization.dig("works", "years")).to eq([{"count"=>4, "title"=>"2011"}]) + + expect(organization.dig("works", "totalCount")).to eq(1) + expect(organization.dig("works", "years")).to eq([{"count"=>1, "title"=>"2011"}]) end end @@ -939,7 +938,7 @@ expect(response.dig("data", "dataCatalog", "softwareApplication")).to eq([{"name"=>"other", "url"=>nil, "softwareVersion"=>nil}]) expect(response.dig("data", "dataCatalog", "citationCount")).to eq(0) # TODO should be 1 - expect(response.dig("data", "dataCatalog", "datasets", "totalCount")).to eq(3) + expect(response.dig("data", "dataCatalog", "datasets", "totalCount")).to eq(1) # expect(response.dig("data", "funder", "works", "years")).to eq([{"count"=>1, "title"=>"2011"}]) # expect(response.dig("data", "funder", "works", "resourceTypes")).to eq([{"count"=>1, "title"=>"Dataset"}]) # expect(response.dig("data", "funder", "works", "nodes").length).to eq(1) diff --git a/spec/requests/dois_spec.rb b/spec/requests/dois_spec.rb index da71a25a1..4e77490af 100644 --- a/spec/requests/dois_spec.rb +++ b/spec/requests/dois_spec.rb @@ -73,7 +73,7 @@ "funderName" => "The Wellcome Trust DBT India Alliance" }]) } - let!(:dois) { create_list(:doi, 3, client: client, aasm_state: "findable") } + let!(:dois) { create_list(:doi, 3, aasm_state: "findable") } before do Doi.import @@ -144,21 +144,21 @@ expect(json.dig('data', 0, 'attributes', 'creators')).to eq([{"name"=>"Garza, Kristian", "nameType"=>"Personal", "givenName"=>"Kristian", "familyName"=>"Garza", "affiliation"=>[{"name"=>"Freie Universität Berlin", "affiliationIdentifier"=>"https://ror.org/046ak2485", "affiliationIdentifierScheme"=>"ROR"}], "nameIdentifiers"=>[{"schemeUri"=>"https://orcid.org", "nameIdentifier"=>"https://orcid.org/0000-0003-3484-6875", "nameIdentifierScheme"=>"ORCID"}]}]) end - # it 'returns dois with re3data id', vcr: true do - # get "/dois?re3data-id=10.17616/R3XS37&include=client", nil, headers + it 'returns dois with re3data id', vcr: true do + get "/dois?re3data-id=10.17616/R3XS37&include=client", nil, headers - # expect(last_response.status).to eq(200) - # expect(json.dig('meta', 'total')).to eq(4) - # expect(json.dig('included', 0, 'attributes', "re3data")).to eq("https://doi.org/10.17616/r3xs37") - # end + expect(last_response.status).to eq(200) + expect(json.dig('meta', 'total')).to eq(1) + expect(json.dig('included', 0, 'attributes', "re3data")).to eq("https://doi.org/10.17616/r3xs37") + end - # it 'returns dois with re3data id as url', vcr: true do - # get "/dois?re3data-id=https://doi.org/10.17616/R3XS37&include=client", nil, headers + it 'returns dois with re3data id as url', vcr: true do + get "/dois?re3data-id=https://doi.org/10.17616/R3XS37&include=client", nil, headers - # expect(last_response.status).to eq(200) - # expect(json.dig('meta', 'total')).to eq(1) - # expect(json.dig('included', 0, 'attributes')).to eq([{"name"=>"Garza, Kristian", "nameType"=>"Personal", "givenName"=>"Kristian", "familyName"=>"Garza", "affiliation"=>[{"name"=>"Freie Universität Berlin", "affiliationIdentifier"=>"https://ror.org/046ak2485", "affiliationIdentifierScheme"=>"ROR"}], "nameIdentifiers"=>[{"schemeUri"=>"https://orcid.org", "nameIdentifier"=>"https://orcid.org/0000-0003-3484-6875", "nameIdentifierScheme"=>"ORCID"}]}]) - # end + expect(last_response.status).to eq(200) + expect(json.dig('meta', 'total')).to eq(1) + expect(json.dig('included', 0, 'attributes', "re3data")).to eq("https://doi.org/10.17616/r3xs37") + end end describe 'GET /dois/:id', elasticsearch: true do