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 +4 -4
- data/lib/istox/helpers/graphql_client.rb +36 -0
- data/lib/istox/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88e1f06c9f7e664e9ac724157fa79d1d074af6d31e9c9794a64d8aa1fa18fc24
|
4
|
+
data.tar.gz: 8903b3536feb3d49fcad449f291412d7df9a3065eef58092ec1be02a91265040
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
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
|