viabtc 0.1.1 → 0.2.0

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: 741190140bfa78ab1cb23fb904e23358e3b50ec156bca8834732d2c731ec624f
4
- data.tar.gz: daa6a7a5c965f219af48b6d5d8c1a2c3c80b2dd2de1d0def0369065fac97d8c2
3
+ metadata.gz: 6f6faea21869b0bb5cf1c68e7ce2c55d5ee769872d747d6a62e5dbb3d8d22ba6
4
+ data.tar.gz: bb10abb7ad810ec80c4bd4161fedef55f6609e279af16196d627bed1062c3771
5
5
  SHA512:
6
- metadata.gz: 936e71e3e3c614d7b35f145cf458a853dc16f7d8530a9735cddf711261f51414807dd6c62e8db257dc5e3dfa5152b5fe1f10f2d4a5f2ff9379757b8e57415a0b
7
- data.tar.gz: eb98759481d3df3935290c99d3db210fe55be8c35d3946366e6b93f36d10f8d56629ab90ff50836d7da990f47e00d48d0df6ff13cbfa5a8eba9ddea1b028ac76
6
+ metadata.gz: 10466297750f595fa88d76daad7971608b4933cf0004352499c3ad34011b408dedb8d8bd5588e4274eb83de23e53fa0f294f2759632e002281caacc6cef79407
7
+ data.tar.gz: 975385083e97437dd00f7b55438c87ec0650e8ee083e4c55791dd4874b8c1cb9cd71e97e77308762631bd510f899d387eb3265277d0a37969fb6938e2963362c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- viabtc (0.1.0)
4
+ viabtc (0.2.0)
5
5
  faraday (~> 0.15.3)
6
6
 
7
7
  GEM
@@ -3,20 +3,11 @@ module ViaBTC
3
3
  def initialize(base_url: nil, faraday_response: nil, faraday_adapter: nil)
4
4
  if ViaBTC.configuration
5
5
  base_url ||= ViaBTC.configuration.base_url
6
- faraday_response ||= ViaBTC.configuration.faraday_response || :logger
7
- faraday_adapter ||= ViaBTC.configuration.faraday_adapter || :net_http
8
- else
9
- faraday_response ||= :logger
10
- faraday_adapter ||= :net_http
6
+ faraday_response ||= ViaBTC.configuration.faraday_response
7
+ faraday_adapter ||= ViaBTC.configuration.faraday_adapter
11
8
  end
12
9
 
13
- raise ViaBTC::Error::Configuration, 'required: base_url' unless base_url
14
-
15
- @connection ||= Faraday.new(base_url) do |conn|
16
- conn.response faraday_response
17
- conn.adapter faraday_adapter
18
- conn.headers['Content-Type'] = ['application/json']
19
- end
10
+ @connection ||= connection(base_url, faraday_response, faraday_adapter)
20
11
  end
21
12
 
22
13
  # Asset API
@@ -179,6 +170,17 @@ module ViaBTC
179
170
 
180
171
  private
181
172
 
173
+ def connection(base_url, faraday_response, faraday_adapter)
174
+ raise ViaBTC::Error::Configuration, 'required: base_url' unless base_url
175
+ faraday_response ||= :logger
176
+ faraday_adapter ||= :net_http
177
+ Faraday.new(base_url) do |conn|
178
+ conn.response faraday_response
179
+ conn.adapter faraday_adapter
180
+ conn.headers['Content-Type'] = ['application/json']
181
+ end
182
+ end
183
+
182
184
  def request(method:, params:, id: 0)
183
185
  response = @connection.post do |req|
184
186
  req.body = {
@@ -1,3 +1,3 @@
1
1
  module ViaBTC
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viabtc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kerem Bozdas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-18 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday