Class: GnListResolver::GnGraphQL

Inherits:
Object
  • Object
show all
Defined in:
lib/gn_list_resolver/graphql.rb

Overview

GraphQL client for gnindex API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGnGraphQL

Returns a new instance of GnGraphQL.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 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 = "    query($names: [name!]!, $dataSourceIds: [Int!]) {\n      nameResolver(names: $names, dataSourceIds: $dataSourceIds,\n                   advancedResolution: true) {\n        responses {\n          suppliedId suppliedInput\n          results {\n            name { value }\n            canonicalName { value }\n            acceptedName { name { value } }\n            synonym\n            matchType { kind score editDistance }\n            taxonId classification { path pathRanks }\n            score { value parsingQuality }\n          }\n        }\n      }\n    }\n  GRAPHQL_QUERY\nend\n"

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/gn_list_resolver/graphql.rb', line 6

def client
  @client
end

#queryObject (readonly)

Returns the value of attribute query.



6
7
8
# File 'lib/gn_list_resolver/graphql.rb', line 6

def query
  @query
end