bitex 0.2.7 → 0.2.8

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
  SHA1:
3
- metadata.gz: d74361878cf503d9bd8f5e6292396dc1d9c2fd86
4
- data.tar.gz: 2dfb13b5ef634ad67614d1f6cbb2ae41f63fa298
3
+ metadata.gz: 7a5c093e696f6e700279363879d02d384a63f9d5
4
+ data.tar.gz: 8befbe2c0c019839b58d16806003d3421d31c7ca
5
5
  SHA512:
6
- metadata.gz: 1bc334db5cd0f105e38a166f07d53774764ce046e4da00d48692d6d9914075f8bf8415704e37e8216ba084868d3f0eb98910a6e0bd57c55c2f94b9806357f93b
7
- data.tar.gz: 624e68302c3d01d7153590f2679d5251e3b9823beeb98fb7b060e8364dc53faf3350547950681b1a699bc798217e4dc26fc593e000d9db6b97e9c4cac15d7a3f
6
+ metadata.gz: 0a65d855205f98b1692abbe779f31bf99434b81ae4f9eb945c433bf746e81f8a9fe1465642e280a75409c819479e611273fe1ce858ca107189b2bfb3c59bf111
7
+ data.tar.gz: a1db5b4473d640921c22f3f623fbb4e22a1b5c4a5d3c6cb76a650fa4cb15add332ed27ec557ef0da785de3ed138f7bca6c7118fe3ed127b6723f958cde3bab43
@@ -1,22 +1,34 @@
1
1
  module Bitex
2
2
  class ApiError < StandardError; end
3
3
  class Api
4
- def self.curl(verb, path, options={}, files={})
5
- verb = verb.upcase.to_sym
6
- query = verb == :GET ? "?#{options.to_query}" : ''
7
- prefix = Bitex.sandbox ? 'sandbox.' : ''
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::Easy.new("https://#{prefix}bitex.la/api-v1/rest#{path}#{query}")
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?
@@ -1,3 +1,3 @@
1
1
  module Bitex
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nubis