harmony-api 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90cd6fbfdd6bfc8dd0bdf7eaefd9d5e81e34d3051662b623f0aeaecef0badf75
4
- data.tar.gz: c208f1342ef273164a82e503cd3efd660ef9ba5c66d0ba9ac0878832b8e7fe57
3
+ metadata.gz: eea4af60480391167cacb1aae61b9fb5d0577c9401c8f7d3c46afaa40202e868
4
+ data.tar.gz: ee1fd543917f3ad408310e4944b69c819400473572c7ef6fc93a526a04ee4999
5
5
  SHA512:
6
- metadata.gz: ddb38ee0df3142d3c4e3d26df1132bf1ae63eda3df21fad1bea052eb5ac8da05482d57acf0e2387cb7f0c82ab5697cba8f37ca63b0f80114914ca636c77489bd
7
- data.tar.gz: 58adae6f19dcce68904cbb686579d9dc29aa30fefed25acd6f69edc934366cb1c7af513d834b6a444b9e2d9c937e0ac5a658fcc7faca12d6b3b3aec0d966a375
6
+ metadata.gz: c529167d76a0baac4cbab552a9d155b58767ce4237bbec19468a695a43dd1d4ba3a94bc2bcd3ba9a99f27afeb41b45db9952d355d742972ee0d645bad0ec87b4
7
+ data.tar.gz: b248603f97e2da9bcb41d53b6adae8ec8bcfd696af3a59965a9644fb550da7e4001e2c852adb69473df8dfdd44fa9fd6870669536e0c21f4886e1547184f70f2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- harmony-api (0.1.0)
4
+ harmony-api (0.1.2)
5
5
  faraday
6
6
  faraday_middleware
7
7
 
@@ -65,14 +65,18 @@ module Harmony
65
65
  end
66
66
 
67
67
  def response(resp)
68
- resp = resp&.body
68
+ if resp.success?
69
+ resp = resp&.body
69
70
 
70
- error = resp&.fetch('error', {})
71
- unless error.empty?
72
- raise ::Harmony::Api::Error, "#{error.fetch('message', '')} (#{error.fetch('code', -1)})"
73
- end
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
- resp&.fetch('result')
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: :os, shard: 0, configuration: ::Harmony::Api.configuration, options: {})
7
+ def initialize(network: :mainnet, shard: 0, configuration: ::Harmony::Api.configuration, options: {})
8
8
  self.api_version = 1
9
9
  super
10
10
  end
@@ -1,5 +1,5 @@
1
1
  module Harmony
2
2
  module Api
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
data/lib/harmony/api.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'faraday'
4
4
  require 'faraday_middleware'
5
+ require 'logger'
5
6
 
6
7
  require 'harmony/api/version'
7
8
  require 'harmony/api/configuration'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harmony-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Johnsson