quoinex 0.1.4 → 0.2.0

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
  SHA1:
3
- metadata.gz: e9dd8c4f97072452b97db4d7995e9a69f1041bcc
4
- data.tar.gz: 6162b912992051d660ad6541bbe938cd3a6c935a
3
+ metadata.gz: 68dd86d49a25b65fe7f654d24462b2c464a19e4d
4
+ data.tar.gz: 1b366b6861b6c7990f37c6e617be062953ce512f
5
5
  SHA512:
6
- metadata.gz: 7978786f53bbecc879610a304f1ad22a6e882300339e017fc91c93fe61bb02cf222e545f495e5c549efcf30a38710f9cdc7dbc63dbf5197a7fe72308094e92da
7
- data.tar.gz: 9689338f41e479ce5170bd7761e61bd431ecfd1d3c35943f0a503c456fa0c1e17c9ccc049123fdf3feb88a2371d5ddeda1d91083ae177f2137541416795417ba
6
+ metadata.gz: 4d1ede02e6c26467d3908d2707ca76e6ee0e3e69837abb486459cbc696625905024458ce1e0df98ea12549e14a69b7ed1f76da98b36e0a6144d010f171b4dd7b
7
+ data.tar.gz: e56d19b830e012f53b30d6361ba88f1877bdf521a2c332a7dc6baaf2422702be472fd04467c49d413db51d732fa419817cd26c7248282b3d731ec432138f77aa
@@ -10,12 +10,16 @@ module Quoinex
10
10
  :secret,
11
11
  :url
12
12
 
13
- def initialize(key:, secret:, url: 'https://api.quoine.com/')
13
+ def initialize(key:, secret:, url: 'https://api.quoine.com')
14
14
  @key = key
15
15
  @secret = secret
16
16
  @url = url
17
17
  end
18
18
 
19
+ def crypto_accounts
20
+ get('/crypto_accounts')
21
+ end
22
+
19
23
  def balances
20
24
  get('/accounts/balance')
21
25
  end
@@ -28,28 +32,25 @@ module Quoinex
28
32
  get('/orders')
29
33
  end
30
34
 
31
- def cancel_order(id)
32
- status = put("/orders/#{id}/cancel")
33
- return status
34
-
35
- if status['responseStatus'] && status['responseStatus']['errorCode']
36
- error = status['responseStatus']['message']
37
- error ||= status['responseStatus']
38
- raise Quoinex::CancelOrderException.new(error)
39
- end
35
+ def products
36
+ get('/products')
37
+ end
40
38
 
41
- status
39
+ def cancel_order(id)
40
+ put("/orders/#{id}/cancel")
42
41
  rescue => e
43
42
  raise Quoinex::CancelOrderException.new(e.message)
44
43
  end
45
44
 
46
45
  def create_order(side:, size:, price:, product_id:)
47
46
  opts = {
48
- order_type: :limit,
49
- product_id: product_id,
50
- side: side,
51
- quantity: size.to_f.to_s,
52
- price: price.to_f.to_s,
47
+ order: {
48
+ order_type: :limit,
49
+ product_id: product_id,
50
+ side: side,
51
+ quantity: size.to_f.to_s,
52
+ price: price.to_f.to_s,
53
+ }
53
54
  }
54
55
  order = post('/orders', opts)
55
56
 
@@ -100,7 +101,7 @@ module Quoinex
100
101
  end
101
102
 
102
103
  def put(path, opts = {})
103
- response = RestClient.put("#{@url}#{path}", auth_headers(path))
104
+ response = RestClient.put("#{@url}#{path}", nil, auth_headers(path))
104
105
 
105
106
  if !opts[:skip_json]
106
107
  JSON.parse(response.body)
@@ -2,5 +2,5 @@
2
2
  # Primary module for this gem.
3
3
  module Quoinex
4
4
  # Current Quoinex version.
5
- VERSION = '0.1.4'.freeze
5
+ VERSION = '0.2.0'.freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quoinex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Fernandez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-01 00:00:00.000000000 Z
11
+ date: 2018-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler