bitex 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bitex/specie_withdrawal.rb +11 -1
- data/lib/bitex/usd_deposit.rb +10 -4
- data/lib/bitex/version.rb +1 -1
- data/spec/fixtures/user_transactions.json +1 -1
- data/spec/specie_withdrawal_spec.rb +11 -1
- data/spec/usd_deposit_spec.rb +10 -4
- metadata +2 -2
@@ -13,7 +13,7 @@ module Bitex
|
|
13
13
|
# @return [Symbol] :btc or :ltc
|
14
14
|
attr_accessor :specie
|
15
15
|
|
16
|
-
# @!attribute
|
16
|
+
# @!attribute quantity
|
17
17
|
# @return [BigDecimal] Quantity deposited
|
18
18
|
attr_accessor :quantity
|
19
19
|
|
@@ -33,6 +33,14 @@ module Bitex
|
|
33
33
|
# * :destination_invalid The destination address was invalid.
|
34
34
|
attr_accessor :reason
|
35
35
|
|
36
|
+
# @!attribute to_address
|
37
|
+
# @return [String] Address to wich you made this withdrawal.
|
38
|
+
attr_accessor :to_address
|
39
|
+
|
40
|
+
# @!attribute label
|
41
|
+
# @return [String] A custom label you gave to this address.
|
42
|
+
attr_accessor :label
|
43
|
+
|
36
44
|
# @visibility private
|
37
45
|
def self.from_json(json)
|
38
46
|
status_lookup = {
|
@@ -50,6 +58,8 @@ module Bitex
|
|
50
58
|
thing.quantity = BigDecimal.new(json[4].to_s)
|
51
59
|
thing.status = status_lookup[json[5]]
|
52
60
|
thing.reason = reason_lookup[json[6]]
|
61
|
+
thing.to_address = json[7]
|
62
|
+
thing.label = json[8]
|
53
63
|
end
|
54
64
|
end
|
55
65
|
end
|
data/lib/bitex/usd_deposit.rb
CHANGED
@@ -9,6 +9,11 @@ module Bitex
|
|
9
9
|
# @return [Time] Time when this deposit was announced by you.
|
10
10
|
attr_accessor :created_at
|
11
11
|
|
12
|
+
# @!attribute requested_amount
|
13
|
+
# @return [BigDecimal] For pre-announced deposits, this is the amount you
|
14
|
+
# requested to deposit.
|
15
|
+
attr_accessor :requested_amount
|
16
|
+
|
12
17
|
# @!attribute amount
|
13
18
|
# @return [BigDecimal] Final amount credited to your bitex USD balance.
|
14
19
|
attr_accessor :amount
|
@@ -55,10 +60,11 @@ module Bitex
|
|
55
60
|
3 => :other,
|
56
61
|
}
|
57
62
|
Api.from_json(new, json) do |thing|
|
58
|
-
thing.
|
59
|
-
thing.
|
60
|
-
thing.
|
61
|
-
thing.
|
63
|
+
thing.requested_amount = BigDecimal.new(json[3].to_s)
|
64
|
+
thing.amount = BigDecimal.new(json[4].to_s)
|
65
|
+
thing.deposit_method = deposit_method_lookup[json[5]]
|
66
|
+
thing.status = status_lookup[json[6]]
|
67
|
+
thing.reason = reason_lookup[json[7]]
|
62
68
|
end
|
63
69
|
end
|
64
70
|
end
|
data/lib/bitex/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
[[3,12345678,946685400,1,2.00000000,600.00000000,0.05000000,300.00000000,123],[4,12345678,946685400,1,2.00000000,600.00000000,0.05000000,300.00000000,456],[5,12345678,946685400,1,100.00000000],[6,12345678,946685400,1,100.00000000,1,0],[7,12345678,946685400,100.00000000,1,1,0],[8,12345678,946685400,100.00000000,1,0]]
|
1
|
+
[[3,12345678,946685400,1,2.00000000,600.00000000,0.05000000,300.00000000,123],[4,12345678,946685400,1,2.00000000,600.00000000,0.05000000,300.00000000,456],[5,12345678,946685400,1,100.00000000],[6,12345678,946685400,1,100.00000000,1,0,"helloworld","label"],[7,12345678,946685400,110.00000000,100.00000000,1,1,0],[8,12345678,946685400,100.00000000,1,0]]
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Bitex::SpecieWithdrawal do
|
4
4
|
let(:as_json) do
|
5
|
-
[6,12345678,946685400,1,100.00000000,1,0]
|
5
|
+
[6,12345678,946685400,1,100.00000000,1,0, '1helloworld', 'label']
|
6
6
|
end
|
7
7
|
|
8
8
|
it_behaves_like 'API class'
|
@@ -34,4 +34,14 @@ describe Bitex::SpecieWithdrawal do
|
|
34
34
|
Bitex::SpecieWithdrawal.from_json(as_json).reason.should == symbol
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
it "sets label" do
|
39
|
+
thing = Bitex::SpecieWithdrawal.from_json(as_json).label
|
40
|
+
thing.should == 'label'
|
41
|
+
end
|
42
|
+
|
43
|
+
it "sets to_addresses" do
|
44
|
+
thing = Bitex::SpecieWithdrawal.from_json(as_json).to_address
|
45
|
+
thing.should == "1helloworld"
|
46
|
+
end
|
37
47
|
end
|
data/spec/usd_deposit_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Bitex::UsdDeposit do
|
4
4
|
let(:as_json) do
|
5
|
-
[7,12345678,946685400,100.00000000,1,1,0]
|
5
|
+
[7,12345678,946685400,110.0000000, 100.00000000,1,1,0]
|
6
6
|
end
|
7
7
|
|
8
8
|
it_behaves_like 'API class'
|
@@ -13,11 +13,17 @@ describe Bitex::UsdDeposit do
|
|
13
13
|
thing.should == 100.0
|
14
14
|
end
|
15
15
|
|
16
|
+
it "sets amount as BigDecimal" do
|
17
|
+
thing = Bitex::UsdDeposit.from_json(as_json).requested_amount
|
18
|
+
thing.should be_a BigDecimal
|
19
|
+
thing.should == 110.0
|
20
|
+
end
|
21
|
+
|
16
22
|
{ 1 => :astropay,
|
17
23
|
2 => :other,
|
18
24
|
}.each do |code, symbol|
|
19
25
|
it "sets status #{code} to #{symbol}" do
|
20
|
-
as_json[
|
26
|
+
as_json[5] = code
|
21
27
|
Bitex::UsdDeposit.from_json(as_json).deposit_method.should == symbol
|
22
28
|
end
|
23
29
|
end
|
@@ -27,7 +33,7 @@ describe Bitex::UsdDeposit do
|
|
27
33
|
3 => :cancelled,
|
28
34
|
}.each do |code, symbol|
|
29
35
|
it "sets status #{code} to #{symbol}" do
|
30
|
-
as_json[
|
36
|
+
as_json[6] = code
|
31
37
|
Bitex::UsdDeposit.from_json(as_json).status.should == symbol
|
32
38
|
end
|
33
39
|
end
|
@@ -38,7 +44,7 @@ describe Bitex::UsdDeposit do
|
|
38
44
|
3 => :other,
|
39
45
|
}.each do |code, symbol|
|
40
46
|
it "sets reason #{code} to #{symbol}" do
|
41
|
-
as_json[
|
47
|
+
as_json[7] = code
|
42
48
|
Bitex::UsdDeposit.from_json(as_json).reason.should == symbol
|
43
49
|
end
|
44
50
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-08-
|
13
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|