bittrex 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +2 -1
- data/lib/bittrex/deposit.rb +2 -0
- data/lib/bittrex/helpers.rb +3 -1
- data/lib/bittrex/summary.rb +15 -8
- data/lib/bittrex/version.rb +1 -1
- data/spec/fixtures/summary.json +1 -1
- data/spec/models/deposit_spec.rb +1 -1
- data/spec/models/helper_spec.rb +36 -0
- data/spec/models/market_spec.rb +1 -1
- data/spec/models/order_spec.rb +3 -3
- data/spec/models/summary_spec.rb +7 -1
- data/spec/models/withdrawal_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62544601ad8147aab330ff85bd81e379005f5294
|
4
|
+
data.tar.gz: 836c1344730b59f7db4a34f22ba4e39abf4220ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7d566fb25055c7e5d0de242333d7f5b0dc39369627af25a156f3ba4be621dbc488659961a295b86694bd44f518248601990cc0d89f57160426666a4729be386
|
7
|
+
data.tar.gz: 378601b6e8f2d7de06a104d9ed8cfb2fdace504175b94bd6ac553f109df162e94e3044b00941a89243c4a9954ee8ac8d3b6610a18a864be8d6c6644de1a7bd09
|
data/.ruby-version
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
2.
|
1
|
+
2.4.2
|
2
|
+
|
data/lib/bittrex/deposit.rb
CHANGED
@@ -3,6 +3,7 @@ module Bittrex
|
|
3
3
|
include Helpers
|
4
4
|
|
5
5
|
attr_reader :id, :transaction_id, :address, :quantity, :currency, :confirmations, :executed_at
|
6
|
+
attr_reader :raw
|
6
7
|
|
7
8
|
def initialize(attrs = {})
|
8
9
|
@id = attrs['Id']
|
@@ -12,6 +13,7 @@ module Bittrex
|
|
12
13
|
@currency = attrs['Currency']
|
13
14
|
@confirmations = attrs['Confirmations']
|
14
15
|
@executed_at = extract_timestamp(attrs['LastUpdated'])
|
16
|
+
@raw = attrs
|
15
17
|
end
|
16
18
|
|
17
19
|
def self.all
|
data/lib/bittrex/helpers.rb
CHANGED
data/lib/bittrex/summary.rb
CHANGED
@@ -3,19 +3,26 @@ module Bittrex
|
|
3
3
|
include Helpers
|
4
4
|
|
5
5
|
attr_reader :name, :high, :low, :volume, :last, :base_volume, :raw, :created_at
|
6
|
+
attr_reader :bid, :ask, :open_buy_orders, :open_sell_orders, :previous_day, :updated_at
|
6
7
|
|
7
8
|
alias_method :vol, :volume
|
8
9
|
alias_method :base_vol, :base_volume
|
9
10
|
|
10
11
|
def initialize(attrs = {})
|
11
|
-
@name
|
12
|
-
@high
|
13
|
-
@low
|
14
|
-
@volume
|
15
|
-
@last
|
16
|
-
@base_volume
|
17
|
-
@
|
18
|
-
@
|
12
|
+
@name = attrs['MarketName']
|
13
|
+
@high = attrs['High']
|
14
|
+
@low = attrs['Low']
|
15
|
+
@volume = attrs['Volume']
|
16
|
+
@last = attrs['Last']
|
17
|
+
@base_volume = attrs['BaseVolume']
|
18
|
+
@bid = attrs['Bid']
|
19
|
+
@ask = attrs['Ask']
|
20
|
+
@open_buy_orders = attrs['OpenBuyOrders']
|
21
|
+
@open_sell_orders = attrs['OpenSellOrders']
|
22
|
+
@previous_day = attrs['PrevDay']
|
23
|
+
@updated_at = extract_timestamp(attrs['TimeStamp'])
|
24
|
+
@created_at = extract_timestamp(attrs['Created'])
|
25
|
+
@raw = attrs
|
19
26
|
end
|
20
27
|
|
21
28
|
def self.all
|
data/lib/bittrex/version.rb
CHANGED
data/spec/fixtures/summary.json
CHANGED
data/spec/models/deposit_spec.rb
CHANGED
@@ -11,6 +11,6 @@ describe Bittrex::Deposit do
|
|
11
11
|
it { should_assign_attribute(subject, :address, '17m3mcA3wo5kk637TgEysxxx2c89SDCRZDB') }
|
12
12
|
it { should_assign_attribute(subject, :transaction_id, '416ba84218c178e7befbe22b23bf1123a23ec2bc68678586a27cebdxxxb6') }
|
13
13
|
it { should_assign_attribute(subject, :confirmations, 2) }
|
14
|
-
it { should_assign_attribute(subject, :executed_at,
|
14
|
+
it { should_assign_attribute(subject, :executed_at, DateTime.parse('2014-06-16T22:57:17.457')) }
|
15
15
|
end
|
16
16
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bittrex::Helpers do
|
4
|
+
include Bittrex::Helpers
|
5
|
+
describe '#extract_timestamp' do
|
6
|
+
context 'when the argument is empty' do
|
7
|
+
it 'returns nil' do
|
8
|
+
expect(extract_timestamp(nil)).to be(nil)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'when the argument is an empty string' do
|
13
|
+
it 'returns nil' do
|
14
|
+
expect(extract_timestamp('')).to be(nil)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when the argument is a string of spaces' do
|
19
|
+
it 'returns nil' do
|
20
|
+
expect(extract_timestamp(' ')).to be(nil)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when the argument is datetime string' do
|
25
|
+
it 'returns a datetime object' do
|
26
|
+
expected_time_object = DateTime.now
|
27
|
+
time_string = expected_time_object.to_s
|
28
|
+
strftime_format = '%B %d, %Y %H %M %S'
|
29
|
+
expect(extract_timestamp(time_string).class).to eql(DateTime)
|
30
|
+
expect(
|
31
|
+
extract_timestamp(time_string).strftime(strftime_format)
|
32
|
+
).to eql(expected_time_object.strftime(strftime_format))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/spec/models/market_spec.rb
CHANGED
@@ -12,6 +12,6 @@ describe Bittrex::Market do
|
|
12
12
|
it { should_assign_attribute(subject, :base_name, 'Bitcoin') }
|
13
13
|
it { should_assign_attribute(subject, :minimum_trade, 0.01) }
|
14
14
|
it { should_assign_attribute(subject, :active, true) }
|
15
|
-
it { should_assign_attribute(subject, :created_at,
|
15
|
+
it { should_assign_attribute(subject, :created_at, DateTime.parse('2014-02-13T00:00:00')) }
|
16
16
|
end
|
17
17
|
end
|
data/spec/models/order_spec.rb
CHANGED
@@ -17,7 +17,7 @@ describe Bittrex::Order do
|
|
17
17
|
it { should_assign_attribute(subject, :price, 0.0) }
|
18
18
|
it { should_assign_attribute(subject, :total, nil) }
|
19
19
|
it { should_assign_attribute(subject, :fill, nil) }
|
20
|
-
it { should_assign_attribute(subject, :executed_at,
|
20
|
+
it { should_assign_attribute(subject, :executed_at, DateTime.parse('2014-06-21T04:08:08.75')) }
|
21
21
|
it { should_assign_attribute(subject, :opened_at, nil) }
|
22
22
|
it { should_assign_attribute(subject, :closed_at, nil) }
|
23
23
|
end
|
@@ -38,8 +38,8 @@ describe Bittrex::Order do
|
|
38
38
|
it { should_assign_attribute(subject, :total, nil) }
|
39
39
|
it { should_assign_attribute(subject, :fill, nil) }
|
40
40
|
it { should_assign_attribute(subject, :executed_at, nil) }
|
41
|
-
it { should_assign_attribute(subject, :opened_at,
|
42
|
-
it { should_assign_attribute(subject, :closed_at,
|
41
|
+
it { should_assign_attribute(subject, :opened_at, DateTime.parse('2014-06-21T04:08:08.75')) }
|
42
|
+
it { should_assign_attribute(subject, :closed_at, DateTime.parse('2014-06-22T04:08:08.75')) }
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/spec/models/summary_spec.rb
CHANGED
@@ -11,6 +11,12 @@ describe Bittrex::Summary do
|
|
11
11
|
it { should_assign_attribute(subject, :volume, 1406611.43827056) }
|
12
12
|
it { should_assign_attribute(subject, :last, 0.00000020) }
|
13
13
|
it { should_assign_attribute(subject, :base_volume, 0.30179011) }
|
14
|
-
it { should_assign_attribute(subject, :
|
14
|
+
it { should_assign_attribute(subject, :ask, 2.3e-07) }
|
15
|
+
it { should_assign_attribute(subject, :bid, 2.0e-07) }
|
16
|
+
it { should_assign_attribute(subject, :open_buy_orders, 7) }
|
17
|
+
it { should_assign_attribute(subject, :open_sell_orders, 8) }
|
18
|
+
it { should_assign_attribute(subject, :previous_day, 2.2e-07) }
|
19
|
+
it { should_assign_attribute(subject, :updated_at, DateTime.parse('2014-06-26T05:22:57.673')) }
|
20
|
+
it { should_assign_attribute(subject, :created_at, DateTime.parse('2014-03-01T21:00:00.000')) }
|
15
21
|
end
|
16
22
|
end
|
@@ -15,6 +15,6 @@ describe Bittrex::Withdrawal do
|
|
15
15
|
it { should_assign_attribute(subject, :invalid_address, false) }
|
16
16
|
it { should_assign_attribute(subject, :transaction_cost, 0.0002) }
|
17
17
|
it { should_assign_attribute(subject, :transaction_id, '0b34fc4xxx102d0f80efddafexxx6b77c6ce170100b2a579ab5b5f493a383392') }
|
18
|
-
it { should_assign_attribute(subject, :executed_at,
|
18
|
+
it { should_assign_attribute(subject, :executed_at, DateTime.parse('2014-06-26T05:37:55.083')) }
|
19
19
|
end
|
20
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bittrex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Werner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- spec/models/configuration_spec.rb
|
164
164
|
- spec/models/currency_spec.rb
|
165
165
|
- spec/models/deposit_spec.rb
|
166
|
+
- spec/models/helper_spec.rb
|
166
167
|
- spec/models/market_spec.rb
|
167
168
|
- spec/models/order_spec.rb
|
168
169
|
- spec/models/quote_spec.rb
|
@@ -208,6 +209,7 @@ test_files:
|
|
208
209
|
- spec/models/configuration_spec.rb
|
209
210
|
- spec/models/currency_spec.rb
|
210
211
|
- spec/models/deposit_spec.rb
|
212
|
+
- spec/models/helper_spec.rb
|
211
213
|
- spec/models/market_spec.rb
|
212
214
|
- spec/models/order_spec.rb
|
213
215
|
- spec/models/quote_spec.rb
|