istox 0.1.42.6 → 0.1.42.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8d2dd38b0774869f1489c683799293d3b62109c4d3ef0e2ee2f0af524a82fed
4
- data.tar.gz: d876e5558c15f670e717098c6f97612c3f0c76c9a9cdf0d255f8b14e89281b7b
3
+ metadata.gz: 88e1f06c9f7e664e9ac724157fa79d1d074af6d31e9c9794a64d8aa1fa18fc24
4
+ data.tar.gz: 8903b3536feb3d49fcad449f291412d7df9a3065eef58092ec1be02a91265040
5
5
  SHA512:
6
- metadata.gz: 76c02a2a76d5670bf851c0b9e92e888b825f24520ee6aeecc880e3c4d0c336510894995efc02e583ce2956729bd1591b818ba4357d9ea6b2ba4f1682dc28ec29
7
- data.tar.gz: 4c72a9a8a71e392b7c2edd58bbca64d0b868e983616d1f359c643293bc53bb3a00fb82133028cf7779dae152c77a5dfc233d8c895f545a7d97ab53d5be9f15b1
6
+ metadata.gz: 5eee1943d2297ab8873ba11a66dc92496a474ee6b9ec294a9c90572c3acba2ddf78228c8636592f09319ad3e7ff67cd58c21921197c845b0c22a0409d6750c1a
7
+ data.tar.gz: 0b770570f08b66370c9859bde1f2e690189e781fd99f0b4fbe32480fbdbbc273097232ad05cd90435723d9270e05a127ce2d312c3f18075d27585d413ba38607
@@ -0,0 +1,36 @@
1
+ require "graphql/client"
2
+ require "graphql/client/http"
3
+
4
+ module Istox
5
+ class GraphqlClient
6
+ class << self
7
+ def add_host(host_type, url)
8
+ unless defined?(@@hosts)
9
+ @@hosts = {}
10
+ end
11
+ init_host(host_type, url)
12
+ end
13
+
14
+ def query(host_type, query)
15
+ client = @@hosts[host_type]
16
+
17
+ raise "Please make sure you have initialised graphql cient for host #{host_type}" if !client
18
+ result = client.query(query)
19
+ end
20
+
21
+ private
22
+
23
+ def init_host(host_type, url)
24
+ http = GraphQL::Client::HTTP.new(url) do
25
+ def headers(context)
26
+ { "User-Agent": "My Client" }
27
+ end
28
+ end
29
+
30
+ client = GraphQL::Client.new(schema: GraphQL::Client.load_schema(http), execute: http)
31
+ @@hosts[host_type] = client
32
+ end
33
+
34
+ end
35
+ end
36
+ end
data/lib/istox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = "0.1.42.6"
2
+ VERSION = "0.1.42.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: istox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.42.6
4
+ version: 0.1.42.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng
@@ -226,6 +226,7 @@ files:
226
226
  - lib/istox/consumers/blockchain_status_handler.rb
227
227
  - lib/istox/helpers/blockchain_receipt_service.rb
228
228
  - lib/istox/helpers/bunny_boot.rb
229
+ - lib/istox/helpers/graphql_client.rb
229
230
  - lib/istox/helpers/grpc_client.rb
230
231
  - lib/istox/helpers/message_service.rb
231
232
  - lib/istox/helpers/order_book.rb