mexbt 0.0.2 → 0.0.3

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: 0653a2d6d27ec38617306422739ce95a108d7483
4
- data.tar.gz: fa5beeae2838cd3ba809e5bfa57bb8ea27e823c1
3
+ metadata.gz: 15732e233077f44d567ce9daae9097843322d1d3
4
+ data.tar.gz: 5a29f9c01b744e4636864b5a7fcd171be33e1365
5
5
  SHA512:
6
- metadata.gz: b0c46985c1ca2e6cb7762ac308d2ff0515b0915df797c5885f575e2e47ec9f4fb198d950da59f5d8cca6989bdf0c67b9f7718324f8534708f147fbee3be2ccc7
7
- data.tar.gz: 90d6328e6064f85e009bc830b011273eb1a1f4e0e98d40fa8909773f1e6e06b291b82cbfa94261fe9e3e8e3ecb38716046ac9589cc3a1305c64e22036fe450bf
6
+ metadata.gz: 39e9ad6cc488e0b18fb9b00cc21862be8af7a4c3ce5be9bcf26915db7ddbf9ba5e9f9546c3a9ab8bbc43cf570f93dd3b79eed7ba0462de623f71a0efb644c37d
7
+ data.tar.gz: 2d5ed961b26805dce2795e429c2cb4b7f03f7361241344755d576cb833ac321c814de5bf6cbe52f78b58d42802a585c0197f0598e59a59be8bbe12a6a79e4b77
data/README.md CHANGED
@@ -7,7 +7,7 @@ returns it as-is.
7
7
 
8
8
  If using bundler simply this to your Gemfile:
9
9
 
10
- gem 'bitstamp'
10
+ gem 'mexbt'
11
11
 
12
12
  And run `bundle install` of course.
13
13
 
@@ -39,28 +39,28 @@ Or alternatively you can set it per call:
39
39
 
40
40
  You need to generate an API key pair at https://mexbt.com/api/keys. However if you want to get started quickly we recommend having a play in the sandbox first, see the 'Sandbox' section below.
41
41
 
42
- Mexbt.configure do |c|
43
- mexbt.public_key = "xxx"
42
+ Mexbt.configure do |c|
43
+ mexbt.public_key = "xxx"
44
44
  mexbt.private_key = "yyy"
45
45
  mexbt.user_id = "email@test.com" # Your registered email address
46
46
  mexbt.sandbox = true # Set this to true to use the sandbox
47
- end
47
+ end
48
48
 
49
49
  ## Order functions
50
50
 
51
- Mexbt::Orders.create(amount: 0.1, currency_pair: 'btcmxn') # Create a market buy order for 0.1 BTC for Pesos
52
- Mexbt::Orders.create(amount: 2, side: :sell, currency_pair: 'btcusd') # Create a market order to sell 2 BTC for USD
53
- Mexbt::Orders.create(amount: 2, price: 1, side: :buy, type: :limit, currency_pair: 'ltcmxn') # Create a limit order to buy 2 LTC for 1 peso
54
- Mexbt::Orders.cancel(id: 123, currency_pair: 'btcmxn')
55
- Mexbt::Orders.cancel_all() # Cancel all orders for the default currency pair
51
+ Mexbt::Orders.create(amount: 0.1, currency_pair: 'btcmxn') # Create a market buy order for 0.1 BTC for Pesos
52
+ Mexbt::Orders.create(amount: 2, side: :sell, currency_pair: 'btcusd') # Create a market order to sell 2 BTC for USD
53
+ Mexbt::Orders.create(amount: 2, price: 1, side: :buy, type: :limit, currency_pair: 'ltcmxn') # Create a limit order to buy 2 LTC for 1 peso
54
+ Mexbt::Orders.cancel(id: 123, currency_pair: 'btcmxn')
55
+ Mexbt::Orders.cancel_all() # Cancel all orders for the default currency pair
56
56
 
57
57
  ## Account functions
58
58
 
59
- Mexbt::Account.balance
60
- Mexbt::Account.trades
61
- Mexbt::Account.orders
62
- Mexbt::Account.deposit_addresses
63
- Mexbt::Account.withdraw(amount: 1, currency: :btc, address: 'xxx') Mexbt::Account.info # Fetches your user info
59
+ Mexbt::Account.balance
60
+ Mexbt::Account.trades
61
+ Mexbt::Account.orders
62
+ Mexbt::Account.deposit_addresses
63
+ Mexbt::Account.withdraw(amount: 1, currency: :btc, address: 'xxx') Mexbt::Account.info # Fetches your user info
64
64
 
65
65
  ## Sandbox
66
66
 
data/lib/mexbt/client.rb CHANGED
@@ -13,6 +13,9 @@ module Mexbt
13
13
  if Mexbt.public_key.nil? || Mexbt.private_key.nil?
14
14
  raise "You must configure your API keys!"
15
15
  end
16
+ if Mexbt.user_id.nil?
17
+ raise "You must configure your user_id!"
18
+ end
16
19
  nonce = (Time.now.to_f*10000).to_i
17
20
  {
18
21
  apiKey: Mexbt.public_key,
data/lib/mexbt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mexbt
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -4,25 +4,43 @@ describe Mexbt::Private do
4
4
 
5
5
  context "without authentication" do
6
6
 
7
- it "should raise a friendly error" do
7
+ after do
8
+ Mexbt.configure do |c|
9
+ c.public_key = nil
10
+ c.private_key = nil
11
+ end
12
+ end
13
+
14
+ it "should raise a friendly error if no keys are configured" do
8
15
  expect { Mexbt::Account.balance }.to raise_error("You must configure your API keys!")
9
16
  end
10
17
 
18
+ it "should raise a friendly error if no user_id is configured" do
19
+ Mexbt.configure do |c|
20
+ c.public_key = "foo"
21
+ c.private_key = "bar"
22
+ end
23
+ expect { Mexbt::Account.balance }.to raise_error("You must configure your user_id!")
24
+ end
25
+
11
26
  end
12
27
 
13
28
  context "with authentication" do
14
29
 
15
30
  before do
16
- Mexbt.configure do | mexbt |
17
- mexbt.public_key = "1d039abd0e667a4e03767ddef11cb8d5"
18
- mexbt.private_key = "0e5a8d04838fc43f0f4335c8a380f200"
19
- mexbt.user_id = "test@mexbt.com"
20
- mexbt.sandbox = true
31
+ Mexbt.configure do |c|
32
+ c.public_key = "8a742b8ecaff21784d8d788119bded0e"
33
+ c.private_key = "e989fb9c1905a4fbd0a4bfe84230c9bc"
34
+ c.user_id = "test@mexbt.com"
35
+ c.sandbox = true
21
36
  end
22
37
  end
23
38
 
24
39
  after do
25
- Mexbt.configure { | mexbt | mexbt.public_key = nil }
40
+ Mexbt.configure do |c|
41
+ c.public_key = nil
42
+ c.user_id = nil
43
+ end
26
44
  end
27
45
 
28
46
  context Mexbt::Account do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mexbt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - williamcoates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-21 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport