Class: Istox::GraphqlClient

Inherits:
Object
  • Object
show all
Defined in:
lib/istox/helpers/graphql_client.rb

Class Method Summary collapse

Class Method Details

.add_host(host_type, url) ⇒ Object



6
7
8
9
10
11
# File 'lib/istox/helpers/graphql_client.rb', line 6

def add_host(host_type, url)
    unless defined?(@@hosts)
       @@hosts = {}
    end
    init_host(host_type, url)
end

.query(host_type, query, variables = {}) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/istox/helpers/graphql_client.rb', line 13

def query(host_type, query, variables = {})
  client = @@hosts[host_type]

  raise "Please make sure you have initialised graphql cient for host #{host_type}" if !client

  result = client.query(query, variables)
end