bittrex-enterprise 0.3 → 0.4

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: 7703cab8d64fac9ee48663797b6316c91b218697186a24a0eb29d379a622f0c1
4
- data.tar.gz: 341535f1f8187d3948808ebf83804dddc9c3b91a4cc840083bf1e3cd37aa98e7
3
+ metadata.gz: eae4397d0819fa5d406afa4a5bf77acc5b631d3de0fe4531e27f8fc36d83d51a
4
+ data.tar.gz: 1f9f329dee24e1f5210ae99dc8c596eb0717844691cabda872ccedca886dcc65
5
5
  SHA512:
6
- metadata.gz: 2b8dbd3776bac469cfa7a7641afde36f343002a3b05d917a6091593cbe87a333c95753916c5249be09153af212662d72f46fd590ad0cb44fb4a628130f8070f9
7
- data.tar.gz: 31b5150ec43f38fa7a60d1b73cbb00855fdf4eb33599b5c22b48f5fd827383b74f02649f07a8faa4edc0d577471af9e41159589ffd8681c612051ab2ac1f06e1
6
+ metadata.gz: f1e37728d4e1eed1e80ba49a0e44bb77bc3ca8e47645beb66d63984693ee865267d246ef7964103514023082ffdcb069d5c1f2a66d7c145abefc15e99b0b0215
7
+ data.tar.gz: 25aa853140dcdf70885a8d882587f24b456542b0b1f1c6d00d6dfead51dffb959338a6d0a7e757971c73055f7190a707ae19bfeb0081599d8ff4e797ccfee707
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bittrex-enterprise (0.1.1)
4
+ bittrex-enterprise (0.3)
5
5
  addressable (~> 2.6)
6
6
  httparty (~> 0.17)
7
7
  json (~> 2.2)
@@ -18,14 +18,12 @@ GEM
18
18
  httparty (0.17.0)
19
19
  mime-types (~> 3.0)
20
20
  multi_xml (>= 0.5.2)
21
- ipaddr (1.2.2)
22
21
  json (2.2.0)
23
22
  mime-types (3.2.2)
24
23
  mime-types-data (~> 3.2015)
25
24
  mime-types-data (3.2019.0331)
26
25
  multi_xml (0.6.0)
27
26
  openssl (2.1.2)
28
- ipaddr
29
27
  public_suffix (3.1.0)
30
28
  rake (10.5.0)
31
29
  rspec (3.8.0)
@@ -4,6 +4,7 @@ module ApiHelpers
4
4
  end
5
5
 
6
6
  module ClassMethods
7
+
7
8
  def base_uri
8
9
  'https://api.bittrex.com/v3/'
9
10
  end
@@ -26,7 +27,7 @@ module ApiHelpers
26
27
 
27
28
  url = base_uri + api_group
28
29
 
29
- headers = setup_headers(url)
30
+ headers = setup_headers('GET', url)
30
31
 
31
32
  begin
32
33
  response = HTTParty.get(url, {query: params, headers: headers})
@@ -37,15 +38,16 @@ module ApiHelpers
37
38
  end
38
39
 
39
40
  def post_signed(api_group, params = {})
41
+
40
42
  params.compact!
41
43
  api_group, params = setup_params(api_group, params)
42
44
 
43
45
  url = base_uri + api_group
44
46
 
45
- headers = setup_headers(url)
47
+ headers = setup_headers('POST', url, params.to_json)
46
48
 
47
49
  begin
48
- response = HTTParty.post(url, {body: params, headers: headers})
50
+ response = HTTParty.post(url, {body: params.to_json, headers: headers})
49
51
  res_hash response
50
52
  rescue => e
51
53
  res_hash e.response
@@ -58,7 +60,7 @@ module ApiHelpers
58
60
 
59
61
  url = base_uri + api_group
60
62
 
61
- headers = setup_headers(url)
63
+ headers = setup_headers('DELETE', url, params)
62
64
 
63
65
  begin
64
66
  response = HTTParty.delete(url, {body: params, headers: headers})
@@ -78,16 +80,13 @@ module ApiHelpers
78
80
  [api_group, params]
79
81
  end
80
82
 
81
- def setup_headers(uri, content='')
83
+ def setup_headers(method, uri, content='')
82
84
  api_key = BittrexEnterprise.configuration.key
83
85
  api_timestamp = DateTime.now.strftime('%Q')
84
86
  api_content_hash = create_content_sign(content)
85
- puts "CONTENT HASH: #{api_content_hash.inspect}"
86
87
  api_subaccount_id = '' # TODO: make this work with Subaccounts
87
- pre_sign = [api_timestamp, uri, 'GET', api_content_hash, api_subaccount_id].join('')
88
- puts "PRE_SIGN: #{pre_sign.inspect}"
88
+ pre_sign = [api_timestamp, uri, method, api_content_hash, api_subaccount_id].join('')
89
89
  api_signature = create_sign_hmac(pre_sign)
90
- puts "SIGNED SIG: #{api_signature.inspect}"
91
90
 
92
91
  headers = {
93
92
  "Content-Type": 'application/json',
@@ -107,6 +106,7 @@ module ApiHelpers
107
106
  end
108
107
 
109
108
  def create_content_sign(content)
109
+ content = content.compact.map { |k, v| "#{k}=#{v}" }.join('&') if content.is_a?(Hash)
110
110
  Digest::SHA512.hexdigest(content.to_s)
111
111
  end
112
112
 
@@ -1,3 +1,3 @@
1
1
  module BittrexEnterprise
2
- VERSION = '0.3'
2
+ VERSION = '0.4'
3
3
  end
@@ -94,20 +94,14 @@ module BittrexEnterprise
94
94
  # ------ PARAMS ------
95
95
  # NewWithdrawal - object - required - information specifying the withdrawal to create
96
96
  # {
97
- # "id": "string (uuid)",
98
97
  # "currencySymbol": "string",
99
98
  # "quantity": "number (double)",
100
99
  # "cryptoAddress": "string",
101
- # "cryptoAddressTag": "string",
102
- # "txCost": "number (double)",
103
- # "txId": "string",
104
- # "status": "string",
105
- # "createdAt": "string (date-time)",
106
- # "completedAt": "string (date-time)"
100
+ # "cryptoAddressTag": "string"
107
101
  # }
108
- # *** REQUIRED - id, currencySymbol, quantity, cryptoAddress, status, createdAt ***
102
+ # *** REQUIRED - id, currencySymbol, quantity, cryptoAddress ***
109
103
  # --------------------------------------------------------------------------------------------
110
- def self.create(new_withdrawal)
104
+ def self.create(new_withdrawal={})
111
105
  post_signed 'withdrawals', new_withdrawal
112
106
  end
113
107
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bittrex-enterprise
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vertbase
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-25 00:00:00.000000000 Z
11
+ date: 2019-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable