bitex 0.1.5 → 0.1.7
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.
- data/lib/bitex/order.rb +20 -0
- data/lib/bitex/specie_withdrawal.rb +5 -0
- data/lib/bitex/version.rb +1 -1
- data/spec/ask_spec.rb +2 -2
- data/spec/bid_spec.rb +2 -2
- data/spec/specie_withdrawal_spec.rb +6 -1
- data/spec/support/from_json_shared_examples.rb +5 -0
- metadata +2 -2
data/lib/bitex/order.rb
CHANGED
@@ -8,6 +8,7 @@ module Bitex
|
|
8
8
|
attr_accessor :price
|
9
9
|
attr_accessor :status
|
10
10
|
attr_accessor :reason
|
11
|
+
attr_accessor :issuer
|
11
12
|
|
12
13
|
# Returns an array with all your active orders
|
13
14
|
# of this type, and any other order of this type that was active in the
|
@@ -73,6 +74,7 @@ module Bitex
|
|
73
74
|
thing.price = BigDecimal.new(json[6].to_s)
|
74
75
|
thing.status = status_lookup[json[7]]
|
75
76
|
thing.reason = reason_lookup[json[8]]
|
77
|
+
thing.issuer = json[10]
|
76
78
|
end
|
77
79
|
end
|
78
80
|
end
|
@@ -115,6 +117,14 @@ module Bitex
|
|
115
117
|
# * :user_cancelled Cancelled per user's request
|
116
118
|
# * :system_cancelled Bitex cancelled this order, for a good reason.
|
117
119
|
|
120
|
+
# @!attribute produced_quantity
|
121
|
+
# @return [BigDecimal] Quantity of specie produced by this bid so far.
|
122
|
+
attr_accessor :produced_quantity
|
123
|
+
|
124
|
+
# @!attribute issuer
|
125
|
+
# @return [String] The issuer of this order, helps you tell
|
126
|
+
# apart orders created from the web UI and the API.
|
127
|
+
|
118
128
|
# @visibility private
|
119
129
|
def self.base_path
|
120
130
|
'/bids'
|
@@ -137,6 +147,7 @@ module Bitex
|
|
137
147
|
super(json, order).tap do |thing|
|
138
148
|
thing.amount = BigDecimal.new(json[4].to_s)
|
139
149
|
thing.remaining_amount = BigDecimal.new(json[5].to_s)
|
150
|
+
thing.produced_quantity = BigDecimal.new(json[9].to_s)
|
140
151
|
end
|
141
152
|
end
|
142
153
|
end
|
@@ -179,6 +190,14 @@ module Bitex
|
|
179
190
|
# * :user_cancelled Cancelled per user's request
|
180
191
|
# * :system_cancelled Bitex cancelled this order, for a good reason.
|
181
192
|
|
193
|
+
# @!attribute produced_amount
|
194
|
+
# @return [BigDecimal] Amount of USD produced from this sale
|
195
|
+
attr_accessor :produced_amount
|
196
|
+
|
197
|
+
# @!attribute issuer
|
198
|
+
# @return [String] The issuer of this order, helps you tell
|
199
|
+
# apart orders created from the web UI and the API.
|
200
|
+
|
182
201
|
# @visibility private
|
183
202
|
def self.base_path
|
184
203
|
'/asks'
|
@@ -201,6 +220,7 @@ module Bitex
|
|
201
220
|
super(json, order).tap do |thing|
|
202
221
|
thing.quantity = BigDecimal.new(json[4].to_s)
|
203
222
|
thing.remaining_quantity = BigDecimal.new(json[5].to_s)
|
223
|
+
thing.produced_amount = BigDecimal.new(json[9].to_s)
|
204
224
|
end
|
205
225
|
end
|
206
226
|
end
|
@@ -45,6 +45,10 @@ module Bitex
|
|
45
45
|
# @return [Integer] Kyc profile id for which this request was made.
|
46
46
|
attr_accessor :kyc_profile_id
|
47
47
|
|
48
|
+
# @!attribute transaction_id
|
49
|
+
# @return [String] Network transaction id, if available.
|
50
|
+
attr_accessor :transaction_id
|
51
|
+
|
48
52
|
# @visibility private
|
49
53
|
def self.from_json(json)
|
50
54
|
status_lookup = {
|
@@ -65,6 +69,7 @@ module Bitex
|
|
65
69
|
thing.to_address = json[7]
|
66
70
|
thing.label = json[8]
|
67
71
|
thing.kyc_profile_id = json[9]
|
72
|
+
thing.transaction_id = json[10]
|
68
73
|
end
|
69
74
|
end
|
70
75
|
|
data/lib/bitex/version.rb
CHANGED
data/spec/ask_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Bitex::Ask do
|
4
4
|
let(:as_json) do
|
5
|
-
[2,12345678,946685400,1,100.00000000,100.00000000,1000.00000000,1]
|
5
|
+
[2,12345678,946685400,1,100.00000000,100.00000000,1000.00000000,1,0,10.0,'User#1']
|
6
6
|
end
|
7
7
|
|
8
8
|
it_behaves_like 'API class'
|
@@ -14,7 +14,7 @@ describe Bitex::Ask do
|
|
14
14
|
it_behaves_like 'Order', 'asks'
|
15
15
|
end
|
16
16
|
|
17
|
-
{ quantity: 100.0, remaining_quantity: 100.0}.each do |field, value|
|
17
|
+
{ quantity: 100.0, remaining_quantity: 100.0, produced_amount: 10.0}.each do |field, value|
|
18
18
|
it "sets #{field} as BigDecimal" do
|
19
19
|
thing = subject.class.from_json(as_json).send(field)
|
20
20
|
thing.should be_a BigDecimal
|
data/spec/bid_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Bitex::Bid do
|
4
4
|
let(:as_json) do
|
5
|
-
[1,12345678,946685400,1,100.00000000,100.00000000,1000.00000000,1]
|
5
|
+
[1,12345678,946685400,1,100.00000000,100.00000000,1000.00000000,1,0,10.0,'User#1']
|
6
6
|
end
|
7
7
|
|
8
8
|
it_behaves_like 'API class'
|
@@ -14,7 +14,7 @@ describe Bitex::Bid do
|
|
14
14
|
it_behaves_like 'Order', 'bids'
|
15
15
|
end
|
16
16
|
|
17
|
-
{ amount: 100.0, remaining_amount: 100.0}.each do |field, value|
|
17
|
+
{ amount: 100.0, remaining_amount: 100.0, produced_quantity: 10.0}.each do |field, value|
|
18
18
|
it "sets #{field} as BigDecimal" do
|
19
19
|
thing = subject.class.from_json(as_json).send(field)
|
20
20
|
thing.should be_a BigDecimal
|
@@ -6,7 +6,7 @@ describe Bitex::SpecieWithdrawal do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
let(:as_json) do
|
9
|
-
[6,12345678,946685400,1,100.00000000,1,0, '1helloworld', 'label', 1]
|
9
|
+
[6,12345678,946685400,1,100.00000000,1,0, '1helloworld', 'label', 1, 'ABC1']
|
10
10
|
end
|
11
11
|
|
12
12
|
it_behaves_like 'API class'
|
@@ -49,6 +49,11 @@ describe Bitex::SpecieWithdrawal do
|
|
49
49
|
thing.should == "1helloworld"
|
50
50
|
end
|
51
51
|
|
52
|
+
it "sets transaction id" do
|
53
|
+
thing = Bitex::SpecieWithdrawal.from_json(as_json).transaction_id
|
54
|
+
thing.should == "ABC1"
|
55
|
+
end
|
56
|
+
|
52
57
|
it "sets the kyc profile id" do
|
53
58
|
Bitex::SpecieWithdrawal.from_json(as_json).kyc_profile_id.should == 1
|
54
59
|
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.7
|
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-
|
13
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|