bitex 0.2.7 → 0.2.8
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 +4 -4
- data/lib/bitex/api.rb +20 -8
- data/lib/bitex/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a5c093e696f6e700279363879d02d384a63f9d5
|
4
|
+
data.tar.gz: 8befbe2c0c019839b58d16806003d3421d31c7ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a65d855205f98b1692abbe779f31bf99434b81ae4f9eb945c433bf746e81f8a9fe1465642e280a75409c819479e611273fe1ce858ca107189b2bfb3c59bf111
|
7
|
+
data.tar.gz: a1db5b4473d640921c22f3f623fbb4e22a1b5c4a5d3c6cb76a650fa4cb15add332ed27ec557ef0da785de3ed138f7bca6c7118fe3ed127b6723f958cde3bab43
|
data/lib/bitex/api.rb
CHANGED
@@ -1,22 +1,34 @@
|
|
1
1
|
module Bitex
|
2
2
|
class ApiError < StandardError; end
|
3
3
|
class Api
|
4
|
-
def self.
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
def self.grab_curl
|
5
|
+
if @curl
|
6
|
+
@curl.reset
|
7
|
+
else
|
8
|
+
@curl = Curl::Easy.new
|
9
|
+
end
|
8
10
|
|
9
|
-
curl = Curl::
|
10
|
-
curl.ssl_version = Curl::CURL_SSLVERSION_TLSv1
|
11
|
-
|
11
|
+
@curl.ssl_version = Curl::CURL_SSLVERSION_TLSv1
|
12
12
|
if Bitex.debug
|
13
|
-
curl.on_debug do |t,d|
|
13
|
+
@curl.on_debug do |t,d|
|
14
14
|
if d.to_s.size < 300
|
15
15
|
puts "DEBUG SSL #{t}, #{d}"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
@curl.connect_timeout = 30
|
21
|
+
@curl
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.curl(verb, path, options={}, files={})
|
25
|
+
verb = verb.upcase.to_sym
|
26
|
+
query = verb == :GET ? "?#{options.to_query}" : ''
|
27
|
+
prefix = Bitex.sandbox ? 'sandbox.' : ''
|
28
|
+
|
29
|
+
curl = grab_curl
|
30
|
+
curl.url = "https://#{prefix}bitex.la/api-v1/rest#{path}#{query}"
|
31
|
+
|
20
32
|
if verb == :POST
|
21
33
|
fields = []
|
22
34
|
unless files.empty?
|
data/lib/bitex/version.rb
CHANGED