harmony-api 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/harmony/api/client.rb +10 -6
- data/lib/harmony/api/v1/client.rb +1 -1
- data/lib/harmony/api/version.rb +1 -1
- data/lib/harmony/api.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eea4af60480391167cacb1aae61b9fb5d0577c9401c8f7d3c46afaa40202e868
|
4
|
+
data.tar.gz: ee1fd543917f3ad408310e4944b69c819400473572c7ef6fc93a526a04ee4999
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c529167d76a0baac4cbab552a9d155b58767ce4237bbec19468a695a43dd1d4ba3a94bc2bcd3ba9a99f27afeb41b45db9952d355d742972ee0d645bad0ec87b4
|
7
|
+
data.tar.gz: b248603f97e2da9bcb41d53b6adae8ec8bcfd696af3a59965a9644fb550da7e4001e2c852adb69473df8dfdd44fa9fd6870669536e0c21f4886e1547184f70f2
|
data/Gemfile.lock
CHANGED
data/lib/harmony/api/client.rb
CHANGED
@@ -65,14 +65,18 @@ module Harmony
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def response(resp)
|
68
|
-
|
68
|
+
if resp.success?
|
69
|
+
resp = resp&.body
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
error = resp&.fetch('error', {})
|
72
|
+
unless error.empty?
|
73
|
+
raise ::Harmony::Api::Error, "#{error.fetch('message', '')} (#{error.fetch('code', -1)})"
|
74
|
+
end
|
74
75
|
|
75
|
-
|
76
|
+
resp&.fetch('result')
|
77
|
+
else
|
78
|
+
raise ::Harmony::Api::Error, "Failed to send request to #{self.url}"
|
79
|
+
end
|
76
80
|
end
|
77
81
|
|
78
82
|
def log(tag = self.class.name, message)
|
@@ -4,7 +4,7 @@ module Harmony
|
|
4
4
|
module Api
|
5
5
|
module V1
|
6
6
|
class Client < ::Harmony::Api::Client
|
7
|
-
def initialize(network: :
|
7
|
+
def initialize(network: :mainnet, shard: 0, configuration: ::Harmony::Api.configuration, options: {})
|
8
8
|
self.api_version = 1
|
9
9
|
super
|
10
10
|
end
|
data/lib/harmony/api/version.rb
CHANGED
data/lib/harmony/api.rb
CHANGED