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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8dad1b17f535502441708ef65e4c5b83b7d8d6cb
4
- data.tar.gz: 2d7a5d84190b5b8778a70164335e623181121a7e
3
+ metadata.gz: 62544601ad8147aab330ff85bd81e379005f5294
4
+ data.tar.gz: 836c1344730b59f7db4a34f22ba4e39abf4220ee
5
5
  SHA512:
6
- metadata.gz: 7a1b15f16822ebd7e88d089c212f5d4562a7cbb04528b8cc15074008c0c83c91fab631b38a7adee526c4576958d8854cbbb5352fb646b8a2ff1fa95b8708ecfa
7
- data.tar.gz: 1bfb9206a91e60559a5f8362400529a6999be713e7f6617270fe73f679e8b0bcc5539b5dfb7e799c1f5208fc243932da056a321cad6ecf3b97135b4727beec45
6
+ metadata.gz: d7d566fb25055c7e5d0de242333d7f5b0dc39369627af25a156f3ba4be621dbc488659961a295b86694bd44f518248601990cc0d89f57160426666a4729be386
7
+ data.tar.gz: 378601b6e8f2d7de06a104d9ed8cfb2fdace504175b94bd6ac553f109df162e94e3044b00941a89243c4a9954ee8ac8d3b6610a18a864be8d6c6644de1a7bd09
@@ -1 +1,2 @@
1
- 2.3.4
1
+ 2.4.2
2
+
@@ -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
@@ -1,8 +1,10 @@
1
+ require 'date'
2
+
1
3
  module Bittrex
2
4
  module Helpers
3
5
  def extract_timestamp(value)
4
6
  return if value.nil? or value.strip.empty?
5
- Time.parse value
7
+ DateTime.parse value
6
8
  end
7
9
  end
8
10
  end
@@ -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 = attrs['MarketName']
12
- @high = attrs['High']
13
- @low = attrs['Low']
14
- @volume = attrs['Volume']
15
- @last = attrs['Last']
16
- @base_volume = attrs['BaseVolume']
17
- @raw = attrs
18
- @created_at = extract_timestamp(attrs['TimeStamp'])
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
@@ -1,3 +1,3 @@
1
1
  module Bittrex
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -9,7 +9,7 @@
9
9
  "Bid": 2.0E-7,
10
10
  "Ask": 2.3E-7,
11
11
  "OpenBuyOrders": 7,
12
- "OpenSellOrders": 7,
12
+ "OpenSellOrders": 8,
13
13
  "PrevDay": 2.2E-7,
14
14
  "Created": "2014-03-01T21:00:00",
15
15
  "DisplayMarketName": null
@@ -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, Time.parse('2014-06-16T22:57:17.457')) }
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
@@ -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, Time.parse('2014-02-13T00:00:00')) }
15
+ it { should_assign_attribute(subject, :created_at, DateTime.parse('2014-02-13T00:00:00')) }
16
16
  end
17
17
  end
@@ -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, Time.parse('2014-06-21T04:08:08.75')) }
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, Time.parse('2014-06-21T04:08:08.75')) }
42
- it { should_assign_attribute(subject, :closed_at, Time.parse('2014-06-22T04:08:08.75')) }
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
@@ -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, :created_at, Time.parse('2014-06-26T05:22:57.673')) }
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, Time.parse('2014-06-26T05:37:55.083')) }
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.3
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-01 00:00:00.000000000 Z
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