bitex 0.0.2 → 0.0.3
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/buy.rb +11 -0
- data/lib/bitex/sell.rb +11 -0
- data/lib/bitex/version.rb +1 -1
- data/spec/buy_spec.rb +6 -1
- data/spec/fixtures/user_transactions.json +1 -1
- data/spec/sell_spec.rb +6 -1
- data/spec/support/from_json_shared_examples.rb +1 -1
- metadata +2 -2
data/lib/bitex/buy.rb
CHANGED
@@ -21,5 +21,16 @@ module Bitex
|
|
21
21
|
|
22
22
|
# @!attribute price
|
23
23
|
# @return [BigDecimal] Price paid per unit
|
24
|
+
|
25
|
+
# @!attribute bid_id
|
26
|
+
# @return [Integer] Unique ID for the Bid that resulted in this Buy
|
27
|
+
attr_accessor :bid_id
|
28
|
+
|
29
|
+
# @visibility private
|
30
|
+
def self.from_json(json)
|
31
|
+
super(json).tap do |thing|
|
32
|
+
thing.bid_id = json[8].to_i
|
33
|
+
end
|
34
|
+
end
|
24
35
|
end
|
25
36
|
end
|
data/lib/bitex/sell.rb
CHANGED
@@ -21,5 +21,16 @@ module Bitex
|
|
21
21
|
|
22
22
|
# @!attribute price
|
23
23
|
# @return [BigDecimal] Price charged per unit
|
24
|
+
|
25
|
+
# @!attribute ask_id
|
26
|
+
# @return [Integer] Unique ID for the Ask that resulted in this Sell
|
27
|
+
attr_accessor :ask_id
|
28
|
+
|
29
|
+
# @visibility private
|
30
|
+
def self.from_json(json)
|
31
|
+
super(json).tap do |thing|
|
32
|
+
thing.ask_id = json[8].to_i
|
33
|
+
end
|
34
|
+
end
|
24
35
|
end
|
25
36
|
end
|
data/lib/bitex/version.rb
CHANGED
data/spec/buy_spec.rb
CHANGED
@@ -2,10 +2,15 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Bitex::Buy do
|
4
4
|
let(:as_json) do
|
5
|
-
[4,12345678,946685400,1,100.50000000,201.0000000,0.05000000,2.00000000]
|
5
|
+
[4,12345678,946685400,1,100.50000000,201.0000000,0.05000000,2.00000000,456]
|
6
6
|
end
|
7
7
|
|
8
8
|
it_behaves_like 'API class'
|
9
9
|
it_behaves_like 'API class with a specie'
|
10
10
|
it_behaves_like 'JSON deserializable match'
|
11
|
+
|
12
|
+
it "sets the bid id" do
|
13
|
+
thing = subject.class.from_json(as_json).bid_id
|
14
|
+
thing.should == 456
|
15
|
+
end
|
11
16
|
end
|
@@ -1 +1 @@
|
|
1
|
-
[[3,12345678,946685400,1,2.00000000,600.00000000,0.05000000,300.00000000],[4,12345678,946685400,1,2.00000000,600.00000000,0.05000000,300.00000000],[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],[7,12345678,946685400,100.00000000,1,1,0],[8,12345678,946685400,100.00000000,1,0]]
|
data/spec/sell_spec.rb
CHANGED
@@ -2,10 +2,15 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Bitex::Sell do
|
4
4
|
let(:as_json) do
|
5
|
-
[3,12345678,946685400,1,100.50000000,201.0000000,0.05000000,2.00000000]
|
5
|
+
[3,12345678,946685400,1,100.50000000,201.0000000,0.05000000,2.00000000,123]
|
6
6
|
end
|
7
7
|
|
8
8
|
it_behaves_like 'API class'
|
9
9
|
it_behaves_like 'API class with a specie'
|
10
10
|
it_behaves_like 'JSON deserializable match'
|
11
|
+
|
12
|
+
it "sets the ask id" do
|
13
|
+
thing = subject.class.from_json(as_json).ask_id
|
14
|
+
thing.should == 123
|
15
|
+
end
|
11
16
|
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.0.
|
4
|
+
version: 0.0.3
|
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-07-
|
13
|
+
date: 2014-07-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|