iex-ruby-client 0.3.1 → 0.3.2

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: 1595523ca5b890b51b9d49ac27d9def034b3ca5b
4
- data.tar.gz: 602da622ca41fa7940fd1045a69d931e66b55faf
3
+ metadata.gz: 7baa081dbd5a61e40dc8ba2b265d15809327edf6
4
+ data.tar.gz: b780dbaa9f3a68d24d78b8c3974fbabcf4660295
5
5
  SHA512:
6
- metadata.gz: 4a02a7bf63c7585adb5ee7a006c6984e524a05aaa23505707a7dd34312c1b2f8997c266270b281b4f00f75b8f9c1a78e4f857863ec324c4152a37829b24594b5
7
- data.tar.gz: 0be37668d735d10df0234a8b204c54ff59498be73ff36c7a9147207fa6650fad0c8abac962f80f31f11502830d2d2ac04642c4d4cbb51fafb6d18cee64fc3a67
6
+ metadata.gz: 98b22f4e83f9f9db5298d1c224da5209b3118f9d8d49900206325fd46064617d71320bc4dc189f1309cd0bc6344adbd6ba2797904ce2414ae828dcdc85c86c31
7
+ data.tar.gz: 8318da35e7f2ae1fdbe2514dcdd63934238d88132dcc1c3e78decdbde71d44273309a9fcab8fce3615674397823d2552c38bb85a21283b543dad03fd10629ec4
@@ -1,16 +1,11 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-05-22 16:18:43 -0400 using RuboCop version 0.51.0.
3
+ # on 2018-05-23 18:14:22 -0400 using RuboCop version 0.51.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 2
10
- Lint/AmbiguousOperator:
11
- Exclude:
12
- - 'spec/iex/resources/quote_spec.rb'
13
-
14
9
  # Offense count: 4
15
10
  # Configuration parameters: CountComments, ExcludedMethods.
16
11
  Metrics/BlockLength:
@@ -45,23 +40,6 @@ Style/DateTime:
45
40
  - 'lib/iex/resources/news.rb'
46
41
  - 'spec/iex/resources/news_spec.rb'
47
42
 
48
- # Offense count: 15
43
+ # Offense count: 16
49
44
  Style/Documentation:
50
- Exclude:
51
- - 'spec/**/*'
52
- - 'test/**/*'
53
- - 'lib/iex/api.rb'
54
- - 'lib/iex/api/chart.rb'
55
- - 'lib/iex/api/company.rb'
56
- - 'lib/iex/api/news.rb'
57
- - 'lib/iex/api/price.rb'
58
- - 'lib/iex/api/quote.rb'
59
- - 'lib/iex/errors/symbol_not_found_error.rb'
60
- - 'lib/iex/resources/chart.rb'
61
- - 'lib/iex/resources/chart/base.rb'
62
- - 'lib/iex/resources/chart/default.rb'
63
- - 'lib/iex/resources/chart/one_day.rb'
64
- - 'lib/iex/resources/company.rb'
65
- - 'lib/iex/resources/news.rb'
66
- - 'lib/iex/resources/price.rb'
67
- - 'lib/iex/resources/quote.rb'
45
+ Enabled: false
@@ -1,3 +1,7 @@
1
+ ### 0.3.2 (2018/05/26)
2
+
3
+ * Fix: undefined method > for nil:NilClass error - [@dblock](https://github.com/dblock).
4
+
1
5
  ### 0.3.1 (2018/05/23)
2
6
 
3
7
  * [#3](https://github.com/dblock/iex-ruby-client/issues/3): Fix: do not error on undefined properties - [@dblock](https://github.com/dblock).
@@ -16,12 +16,12 @@ module IEX
16
16
  property 'latest_source', from: 'latestSource' # the source of latestPrice - IEX real time price, 15 minute delayed price, Close or Previous close
17
17
  property 'latest_time', from: 'latestTime' # human readable time of the latestPrice
18
18
  property 'latest_update', from: 'latestUpdate' # the update time of latestPrice in milliseconds since midnight Jan 1, 1970
19
- property 'latest_update_t', from: 'latestUpdate', with: ->(v) { Time.at(v / 1000) } # the update time of latestPrice
19
+ property 'latest_update_t', from: 'latestUpdate', with: ->(v) { v && v > 0 ? Time.at(v / 1000) : nil } # the update time of latestPrice
20
20
  property 'latest_volume', from: 'latestVolume' # the total market volume of the stock
21
21
  property 'iex_realtime_price', from: 'iexRealtimePrice' # last sale price of the stock on IEX
22
22
  property 'iex_realtime_size', from: 'iexRealtimeSize' # last sale size of the stock on IEX
23
23
  property 'iex_last_updated', from: 'iexLastUpdated' # last update time of the data in milliseconds since midnight Jan 1, 1970 UTC or -1 or 0; if the value is -1 or 0, IEX has not quoted the symbol in the trading day
24
- property 'iex_last_updated_t', from: 'iexLastUpdated', with: ->(v) { v > 0 ? Time.at(v / 1000) : nil } # last update time of the data
24
+ property 'iex_last_updated_t', from: 'iexLastUpdated', with: ->(v) { v && v > 0 ? Time.at(v / 1000) : nil } # last update time of the data
25
25
  property 'delayed_price', from: 'delayedPrice' # 15 minute delayed market price
26
26
  property 'delayed_price_time', from: 'delayedPriceTime' # time of the delayed market price
27
27
  property 'extended_price', from: 'extendedPrice' # ?
@@ -30,11 +30,13 @@ module IEX
30
30
  property 'change' # change in value, calculated using calculation_price from previous_close
31
31
  property 'change_percent', from: 'changePercent' # change in percent, calculated using calculation_price from previous_close
32
32
  property 'change_percent_s', from: 'changePercent', with: lambda { |v|
33
- [
34
- v > 0 ? '+' : '',
35
- format('%.2f', v * 100),
36
- '%'
37
- ].join
33
+ if v
34
+ [
35
+ v > 0 ? '+' : '',
36
+ format('%.2f', v * 100),
37
+ '%'
38
+ ].join
39
+ end
38
40
  } # change in percent as a String with a leading + or - sign
39
41
  property 'iex_market_percent', from: 'iexMarketPercent' # IEX’s percentage of the market in the stock
40
42
  property 'iex_volume', from: 'iexVolume' # shares traded in the stock on IEX
@@ -1,6 +1,5 @@
1
1
  module IEX
2
2
  class Resource < Hashie::Trash
3
3
  include Hashie::Extensions::IgnoreUndeclared
4
-
5
4
  end
6
5
  end
@@ -1,3 +1,3 @@
1
1
  module IEX
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.3.2'.freeze
3
3
  end
@@ -21,16 +21,16 @@ http_interactions:
21
21
  Server:
22
22
  - nginx
23
23
  Date:
24
- - Wed, 23 May 2018 22:04:57 GMT
24
+ - Sat, 26 May 2018 22:44:50 GMT
25
25
  Content-Type:
26
26
  - application/json; charset=utf-8
27
27
  Content-Length:
28
- - '915'
28
+ - '912'
29
29
  Connection:
30
30
  - keep-alive
31
31
  Set-Cookie:
32
- - ctoken=087fe43d41f94d2fa909aef7ec6b84be; Domain=.iextrading.com; Path=/; Expires=Thu,
33
- 24 May 2018 10:04:57 GMT; Secure
32
+ - ctoken=b25c6a137426493aa77de4345b947c48; Domain=.iextrading.com; Path=/; Expires=Sun,
33
+ 27 May 2018 10:44:50 GMT; Secure
34
34
  Content-Security-Policy:
35
35
  - default-src 'self'; child-src 'none'; object-src 'none'; style-src 'self'
36
36
  'unsafe-inline'; font-src data:; frame-src 'self'; connect-src 'self' https://auth.iextrading.com
@@ -62,8 +62,8 @@ http_interactions:
62
62
  body:
63
63
  encoding: UTF-8
64
64
  string: '{"symbol":"MSFT","companyName":"Microsoft Corporation","primaryExchange":"Nasdaq
65
- Global Select","sector":"Technology","calculationPrice":"close","open":96.68,"openTime":1527082200673,"close":98.66,"closeTime":1527105600450,"high":98.73,"low":96.32,"latestPrice":98.66,"latestSource":"Close","latestTime":"May
66
- 23, 2018","latestUpdate":1527105600450,"latestVolume":20535596,"iexRealtimePrice":98.68,"iexRealtimeSize":42,"iexLastUpdated":1527105595797,"delayedPrice":98.66,"delayedPriceTime":1527105600450,"extendedPrice":98.56,"extendedChange":-0.1,"extendedChangePercent":-0.00101,"extendedPriceTime":1527109075453,"previousClose":97.5,"change":1.16,"changePercent":0.0119,"iexMarketPercent":0.01326,"iexVolume":272302,"avgTotalVolume":25931612,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":758024265646,"peRatio":29.19,"week52High":98.69,"week52Low":68.02,"ytdChange":0.1446483288134399}'
65
+ Global Select","sector":"Technology","calculationPrice":"close","open":98.3,"openTime":1527255000372,"close":98.36,"closeTime":1527278400376,"high":null,"low":null,"latestPrice":98.36,"latestSource":"Close","latestTime":"May
66
+ 25, 2018","latestUpdate":1527278400376,"latestVolume":17944712,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":98.36,"delayedPriceTime":1527281515371,"extendedPrice":98.48,"extendedChange":0.12,"extendedChangePercent":0.00122,"extendedPriceTime":1527281940950,"previousClose":98.31,"change":0.05,"changePercent":0.00051,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":25656536,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"marketCap":755719306395,"peRatio":29.1,"week52High":98.98,"week52Low":68.02,"ytdChange":0.15474471407271742}'
67
67
  http_version:
68
- recorded_at: Wed, 23 May 2018 22:04:57 GMT
68
+ recorded_at: Sat, 26 May 2018 22:44:50 GMT
69
69
  recorded_with: VCR 4.0.0
@@ -9,21 +9,21 @@ describe IEX::Resources::Quote do
9
9
  expect(subject.symbol).to eq 'MSFT'
10
10
  expect(subject.primary_exchange).to eq 'Nasdaq Global Select'
11
11
  expect(subject.company_name).to eq 'Microsoft Corporation'
12
- expect(subject.market_cap).to eq 758_024_265_646
12
+ expect(subject.market_cap).to eq 755_719_306_395
13
13
  end
14
14
  it 'coerces numbers' do
15
- expect(subject.latest_price).to eq 98.66
16
- expect(subject.change).to eq 1.16
17
- expect(subject.week_52_high).to eq 98.69
15
+ expect(subject.latest_price).to eq 98.36
16
+ expect(subject.change).to eq 0.05
17
+ expect(subject.week_52_high).to eq 98.98
18
18
  expect(subject.week_52_low).to eq 68.02
19
- expect(subject.change_percent).to eq 0.0119
20
- expect(subject.change_percent_s).to eq '+1.19%'
19
+ expect(subject.change_percent).to eq 0.00051
20
+ expect(subject.change_percent_s).to eq '+0.05%'
21
21
  end
22
22
  it 'coerces times' do
23
- expect(subject.latest_update).to eq 1_527_105_600_450
24
- expect(subject.latest_update_t).to eq Time.at(1_527_105_600)
25
- expect(subject.iex_last_updated).to eq 1_527_105_595_797
26
- expect(subject.iex_last_updated_t).to eq Time.at(1_527_105_595)
23
+ expect(subject.latest_update).to eq 1_527_278_400_376
24
+ expect(subject.latest_update_t).to eq Time.at(1_527_278_400)
25
+ expect(subject.iex_last_updated).to be nil
26
+ expect(subject.iex_last_updated_t).to be nil
27
27
  end
28
28
  end
29
29
  context 'invalid symbol', vcr: { cassette_name: 'quote/invalid' } do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iex-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-23 00:00:00.000000000 Z
11
+ date: 2018-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday