bitfex 1.1.0 → 1.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
- SHA1:
3
- metadata.gz: b95f8e72ca50610bf5ffc6c6c51ca67b43ad71df
4
- data.tar.gz: c65c0f60df7f843cb053faf02e701317be965977
2
+ SHA256:
3
+ metadata.gz: a830e2f527b5de4456a1469cfc9bee9f36f8c8e1b8498dbbd8600dd485af5e35
4
+ data.tar.gz: 204ae8dc2394a689920f29b2fedd7c33662661de5f43d4bbb2eba8689677e6b1
5
5
  SHA512:
6
- metadata.gz: 87d452edae4a73d1e5449ed7ae333943c8a3d2741dbe3b71f9b373f3703e3d76118278d0d6b6db048ab05247b9d450338941a0cfa3a436338ab78a9e8e25e11d
7
- data.tar.gz: 943afeeb3298d89afe1c8dd74ec791774e6d8a70fb1ca00938de4a11f7722429b497969ab5ca738ec33ae20ee8c07f7c1a5ebf77280fdb376b175b125bbad7b7
6
+ metadata.gz: b1a3ffa111c05e0a68832aaa77e858b90e653e83f3229ab9cccd07ad8407284bdb5fab264aba258273653e85dbcb26b3c2298444f32a40b0c60b3427c8644c64
7
+ data.tar.gz: 614f6d40384b812c38c2bca832243dd8d35d46826a057000315e3eb92fbc45708d3c593c3d492743dab99fbaf1b578d2062bc932f8db94b0de7d3e63652f9866
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitfex (1.0.0)
4
+ bitfex (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -30,4 +30,4 @@ DEPENDENCIES
30
30
  webmock (~> 2.0)
31
31
 
32
32
  BUNDLED WITH
33
- 1.13.6
33
+ 1.17.3
@@ -6,8 +6,10 @@ module Bitfex
6
6
  attr_accessor :token
7
7
 
8
8
  # @param server_url [String] URL of the main server
9
- def initialize(server_url: 'https://bitfex.trade')
9
+ # @param auth_server_url [String] URL of the auth server
10
+ def initialize(server_url: 'https://bitfex.trade', auth_server_url: 'https://auth.bitfex.trade')
10
11
  @_server_url = server_url
12
+ @_auth_server_url = auth_server_url
11
13
  end
12
14
 
13
15
  # @return [String] server url
@@ -15,11 +17,21 @@ module Bitfex
15
17
  @_server_url
16
18
  end
17
19
 
20
+ # @return [String] auth server url
21
+ def auth_server_url
22
+ @_auth_server_url
23
+ end
24
+
18
25
  # @param url [String] set URL of the server
19
26
  def server_url=(url)
20
27
  @_server_url = url
21
28
  end
22
29
 
30
+ # @param url [String] set URL of the auth server
31
+ def auth_server_url=(url)
32
+ @_auth_server_url = url
33
+ end
34
+
23
35
  # Get token for API operations
24
36
  # @param email [String] email
25
37
  # @param password [String] password
@@ -100,7 +112,7 @@ module Bitfex
100
112
  end
101
113
 
102
114
  def request(endpoint, klass, body = nil)
103
- url = @_server_url + endpoint
115
+ url = (body && body.has_key?(:auth) ? @_auth_server_url : @_server_url) + endpoint
104
116
  uri = URI.parse(url)
105
117
  http = Net::HTTP.new(uri.host, uri.port)
106
118
  http.use_ssl = uri.port == 443
@@ -1,5 +1,5 @@
1
1
  module Bitfex
2
- VERSION_INFO = [1, 1, 0].freeze
2
+ VERSION_INFO = [1, 2, 0].freeze
3
3
  VERSION = VERSION_INFO.map(&:to_s).join('.').freeze
4
4
 
5
5
  def self.version
@@ -20,7 +20,7 @@ class BitfexTest < Minitest::Test
20
20
  end
21
21
 
22
22
  def test_auth_success
23
- stub_request(:post, 'https://bitfex.trade/auth')
23
+ stub_request(:post, 'https://auth.bitfex.trade/auth')
24
24
  .with(body: '{"auth":{"email":"user@example.com","password":"123"}}')
25
25
  .to_return(status: 200, body: '{"jwt":"token"}')
26
26
 
@@ -29,7 +29,7 @@ class BitfexTest < Minitest::Test
29
29
  end
30
30
 
31
31
  def test_auth_failure
32
- stub_request(:post, 'https://bitfex.trade/auth')
32
+ stub_request(:post, 'https://auth.bitfex.trade/auth')
33
33
  .with(body: '{"auth":{"email":"user@example.com","password":"123"}}')
34
34
  .to_return(status: 404, body: '{}')
35
35
 
@@ -62,24 +62,24 @@ class BitfexTest < Minitest::Test
62
62
  end
63
63
 
64
64
  def test_orders_list_success
65
- stub_request(:get, "https://bitfex.trade/api/v1/orders")
65
+ stub_request(:get, "https://bitfex.trade/api/v1/orders?pair=BTC_RUR")
66
66
  .with(headers: { 'Authorization' => 'Bearer 123' })
67
67
  .to_return(status: 200, body: '{"success":true,"orders":[{"id":1}]}')
68
68
 
69
69
  client = Bitfex::Api.new
70
70
  client.token = '123'
71
- assert_equal([{'id' => 1}], client.orders_list)
71
+ assert_equal([{'id' => 1}], client.orders_list('BTC_RUR'))
72
72
  end
73
73
 
74
74
  def test_orders_list_faulure
75
- stub_request(:get, "https://bitfex.trade/api/v1/orders")
75
+ stub_request(:get, "https://bitfex.trade/api/v1/orders?pair=BTC_RUR")
76
76
  .with(headers: { 'Authorization' => 'Bearer 123' })
77
77
  .to_return(status: 403, body: '{"success":false,"errors":["TEST"]}')
78
78
 
79
79
  assert_raises Bitfex::ApiError do
80
80
  client = Bitfex::Api.new
81
81
  client.token = '123'
82
- client.orders_list
82
+ client.orders_list('BTC_RUR')
83
83
  end
84
84
  end
85
85
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitfex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - BitFex.Trade
@@ -79,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubyforge_project:
83
- rubygems_version: 2.5.2.1
82
+ rubygems_version: 3.0.3
84
83
  signing_key:
85
84
  specification_version: 4
86
85
  summary: API wrapper for BitFex.Trade