cryptsy 0.1 → 0.2

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: 86fbb550ff9903ff92f1ed6bd6f72addb0f7c262
4
- data.tar.gz: 21735c159cd27ce56adcbf629264b5da170692bd
3
+ metadata.gz: 5d1a9e53dc363dc442072d76a240b16e5d246b7d
4
+ data.tar.gz: 79ef12b13f786c0528c789622588be3400c83979
5
5
  SHA512:
6
- metadata.gz: f541a58e0610ba764d25de2cc0d2c4173b33f77aa58d96074e16a70113393c32c6d0a9b43ca58b5c0ad251f1b6c159d27031c1e2187166c8c362ff3d51ebe534
7
- data.tar.gz: 7dbafded98719d639791e1997bd4199e9af63382967ff02ce939a3c513423085cd5a954d0a096b53b0668b20234750572f4b5d699647edd4bb42526423fa740c
6
+ metadata.gz: 007bfc16b7ad2b71978044f0e972239be6059a2cdb99d23f5aead8453632478c9475e2508bd70b6f5a09883ee3855c4a2e35a7ef5d9ac2c245ac9a471bf15cd4
7
+ data.tar.gz: 1848249a8eb3a1d272763e96b1bd23fcee70c08861291bd89c394909a2dc0bc5b639508bd41372d60b55d51a2fe4beb9ebb8dd6a9d3575bf4df97a839ba25c6e
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Provides an idiomatic Ruby client for the authenticated Cryptsy API
4
4
 
5
+ [![Gem Release](http://img.shields.io/gem/v/cryptsy.svg)](http://rubygems.org/gems/cryptsy)
6
+
5
7
  ## JSON client
6
8
 
7
9
  Grab your API keys from the Crypsty website
@@ -159,8 +161,3 @@ This includes the following:
159
161
 
160
162
  Therefore, you should isolate the use of this client away from a public-facing service. On a separate VM,
161
163
  you can use a background worker process, like Sidekiq or Resque.
162
-
163
- ## To-do
164
-
165
- - [FIX] Add error handling to web client
166
- - [FEAT] Add auto-confirm for emailed confirmation links
@@ -85,7 +85,12 @@ module Cryptsy
85
85
  end
86
86
 
87
87
  def create_order(market_id, order_type, quantity, price)
88
- call(:createorder, marketid: market_id, ordertype: order_type, quantity: quantity, price: price)
88
+ call(:createorder,
89
+ marketid: market_id,
90
+ ordertype: order_type,
91
+ quantity: format_number(quantity),
92
+ price: format_number(price)
93
+ )
89
94
  end
90
95
 
91
96
  def cancel_order(order_id)
@@ -109,7 +114,11 @@ module Cryptsy
109
114
  end
110
115
 
111
116
  def calculate_fees(order_type, quantity, price)
112
- call(:calculatefees, ordertype: order_type, quantity: quantity, price: price)
117
+ call(:calculatefees,
118
+ ordertype: order_type,
119
+ quantity: format_number(quantity),
120
+ price: format_number(price)
121
+ )
113
122
  end
114
123
 
115
124
  def generate_new_address(currency)
@@ -131,7 +140,7 @@ module Cryptsy
131
140
  def call(method_name, params = {})
132
141
  request = {
133
142
  method: method_name,
134
- nonce: Time.now.to_i
143
+ nonce: (Time.now.to_f * 1000).to_i
135
144
  }.merge(params)
136
145
 
137
146
  body = URI.encode_www_form(request)
@@ -159,7 +168,17 @@ module Cryptsy
159
168
  raise ClientError, body.error
160
169
  end
161
170
 
162
- body.return
171
+ if body.return
172
+ body.return
173
+ else
174
+ body
175
+ end
176
+ end
177
+
178
+ # @param [Numeric] number
179
+ # @return [String]
180
+ def format_number(number)
181
+ format('%.8f', number)
163
182
  end
164
183
 
165
184
  # @param [Object] code
@@ -1,3 +1,3 @@
1
1
  module Cryptsy
2
- VERSION = '0.1'
2
+ VERSION = '0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptsy
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Unruh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-01 00:00:00.000000000 Z
11
+ date: 2014-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -83,4 +83,3 @@ test_files:
83
83
  - spec/client_spec.rb
84
84
  - spec/spec_helper.rb
85
85
  - spec/web_client_spec.rb
86
- has_rdoc: