Class: GnListResolver::GnGraphQL
- Inherits:
-
Object
- Object
- GnListResolver::GnGraphQL
- Defined in:
- lib/gn_list_resolver/graphql.rb
Overview
GraphQL client for gnindex API
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize ⇒ GnGraphQL
constructor
A new instance of GnGraphQL.
Constructor Details
#initialize ⇒ GnGraphQL
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gn_list_resolver/graphql.rb', line 8 def initialize http = GraphQL::Client::HTTP.new(RESOLVER_URL) schema = GraphQL::Client.load_schema(http) @client = GraphQL::Client.new(schema: schema, execute: http) @query = <<~GRAPHQL_QUERY query($names: [name!]!, $dataSourceIds: [Int!]) { nameResolver(names: $names, dataSourceIds: $dataSourceIds) { responses { suppliedId suppliedInput results { name { value } canonicalName { value } acceptedName { name { value } } synonym matchType { kind score editDistance } taxonId classification { path pathRanks } score { value parsingQuality } } } } } GRAPHQL_QUERY end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/gn_list_resolver/graphql.rb', line 6 def client @client end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
6 7 8 |
# File 'lib/gn_list_resolver/graphql.rb', line 6 def query @query end |