iex-ruby-client 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +14 -2
  4. data/lib/iex/api/config.rb +2 -0
  5. data/lib/iex/cloud/connection.rb +1 -1
  6. data/lib/iex/cloud/request.rb +1 -1
  7. data/lib/iex/endpoints/chart.rb +1 -1
  8. data/lib/iex/endpoints/company.rb +1 -1
  9. data/lib/iex/endpoints/crypto.rb +1 -1
  10. data/lib/iex/endpoints/dividends.rb +1 -1
  11. data/lib/iex/endpoints/earnings.rb +1 -1
  12. data/lib/iex/endpoints/income.rb +1 -1
  13. data/lib/iex/endpoints/key_stats.rb +1 -1
  14. data/lib/iex/endpoints/largest_trades.rb +1 -1
  15. data/lib/iex/endpoints/logo.rb +1 -1
  16. data/lib/iex/endpoints/news.rb +1 -1
  17. data/lib/iex/endpoints/ohlc.rb +2 -2
  18. data/lib/iex/endpoints/price.rb +1 -1
  19. data/lib/iex/endpoints/quote.rb +1 -1
  20. data/lib/iex/endpoints/sectors.rb +1 -1
  21. data/lib/iex/resources/chart.rb +8 -13
  22. data/lib/iex/version.rb +1 -1
  23. data/spec/fixtures/iex/chart/1d.yml +440 -473
  24. data/spec/fixtures/iex/chart/20190306.yml +440 -473
  25. data/spec/fixtures/iex/chart/bad_option.yml +47 -81
  26. data/spec/fixtures/iex/chart/chartInterval.yml +89 -122
  27. data/spec/fixtures/iex/chart/dynamic/1m.yml +73 -107
  28. data/spec/fixtures/iex/chart/invalid.yml +47 -81
  29. data/spec/fixtures/iex/chart/msft.yml +74 -107
  30. data/spec/fixtures/iex/income/invalid.yml +47 -47
  31. data/spec/fixtures/iex/income/nsrgy.yml +55 -0
  32. data/spec/fixtures/iex/ref-data/isin.yml +57 -0
  33. data/spec/iex/client_spec.rb +1 -1
  34. data/spec/iex/endpoints/chart_spec.rb +7 -7
  35. data/spec/iex/endpoints/income_spec.rb +10 -1
  36. data/spec/iex/endpoints/ref_data_spec.rb +16 -0
  37. data/spec/spec_helper.rb +1 -0
  38. data/spec/support/vcr.rb +3 -0
  39. metadata +9 -4
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://cloud.iexapis.com/v1/ref-data/isin
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"isin":["US0378331005"],"token":"test-iex-api-secret-token"}'
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ Content-Type:
13
+ - application/json; charset=utf-8
14
+ User-Agent:
15
+ - IEX Ruby Client/1.1.1
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Wed, 26 Feb 2020 20:04:36 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Set-Cookie:
34
+ - ctoken=6b0870d7654f4742a9458a86f537ae8b; Max-Age=43200; Path=/; Expires=Thu,
35
+ 27 Feb 2020 08:04:36 GMT
36
+ Iexcloud-Messages-Used:
37
+ - '100'
38
+ Iexcloud-Premium-Messages-Used:
39
+ - '0'
40
+ X-Content-Type-Options:
41
+ - nosniff
42
+ Strict-Transport-Security:
43
+ - max-age=15768000
44
+ Access-Control-Allow-Origin:
45
+ - "*"
46
+ Access-Control-Allow-Credentials:
47
+ - 'true'
48
+ Access-Control-Allow-Methods:
49
+ - GET, OPTIONS
50
+ Access-Control-Allow-Headers:
51
+ - Origin, X-Requested-With, Content-Type, Accept
52
+ body:
53
+ encoding: ASCII-8BIT
54
+ string: '[{"symbol":"AAPL","region":"US","exchange":"NAS","iexId":"IEX_4D48333344362D52"},{"symbol":"APC-GY","region":"DE","exchange":"ETR","iexId":"IEX_464D46474C312D52"}]'
55
+ http_version: null
56
+ recorded_at: Wed, 26 Feb 2020 20:04:36 GMT
57
+ recorded_with: VCR 5.1.0
@@ -130,7 +130,7 @@ describe IEX::Api::Client do
130
130
  let(:client) { described_class.new }
131
131
  it 'results in an API key error', vcr: { cassette_name: 'client/access_denied' } do
132
132
  expect do
133
- client.get '/stock/msft/quote'
133
+ client.get '/stock/msft/quote', token: client.publishable_token
134
134
  end.to raise_error IEX::Errors::PermissionDeniedError, /The API key provided is not valid./
135
135
  end
136
136
  end
@@ -12,11 +12,11 @@ describe IEX::Resources::Chart do
12
12
  it 'retrieves a default chart' do
13
13
  expect(subject.count).to eq 23
14
14
  expect(first).to be_a IEX::Resources::Chart::Default
15
- expect(first.label).to eq 'Mar 6'
15
+ expect(first.label).to eq 'Jul 10'
16
16
  expect(first.change_percent_s).to eq '0.00%'
17
- expect(first.close).to eq 111.75
18
- expect(first.date).to eq Date.new(2019, 3, 6)
19
- expect(last.label).to eq 'Apr 5'
17
+ expect(first.close).to eq 137.85
18
+ expect(first.date).to eq Date.new(2019, 7, 10)
19
+ expect(last.label).to eq 'Aug 9'
20
20
  end
21
21
  end
22
22
 
@@ -30,8 +30,8 @@ describe IEX::Resources::Chart do
30
30
  expect(subject.count).to eq 390
31
31
  expect(first).to be_a IEX::Resources::Chart::OneDay
32
32
  expect(first.label).to eq '09:30 AM'
33
- expect(first.high).to eq 119.67
34
- expect(first.low).to eq 119.43
33
+ expect(first.high).to eq 138.72
34
+ expect(first.low).to eq 138.5
35
35
  expect(first.minute).to eq '09:30'
36
36
  end
37
37
  end
@@ -67,7 +67,7 @@ describe IEX::Resources::Chart do
67
67
  it 'retrieves a 1m chart from' do
68
68
  expect(subject.count).to eq 23
69
69
  expect(first).to be_a IEX::Resources::Chart::Default
70
- expect(first.date).to eq Date.new(2019, 3, 6)
70
+ expect(first.date).to eq Date.new(2019, 7, 10)
71
71
  end
72
72
  end
73
73
 
@@ -48,9 +48,18 @@ describe IEX::Resources::Income do
48
48
  end
49
49
  end
50
50
 
51
+ context 'no result', vcr: { cassette_name: 'income/nsrgy' } do
52
+ subject do
53
+ client.income('nsrgy')
54
+ end
55
+ it 'returns empty array' do
56
+ expect(subject).to eq []
57
+ end
58
+ end
59
+
51
60
  context 'invalid symbol', vcr: { cassette_name: 'income/invalid' } do
52
61
  subject do
53
- client.earnings('INVALID')
62
+ client.income('INVALID')
54
63
  end
55
64
  it 'fails with SymbolNotFoundError' do
56
65
  expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe IEX::Api::Client do
4
+ include_context 'client'
5
+
6
+ describe 'ISIN Mapping', vcr: { cassette_name: 'ref-data/isin' } do
7
+ subject do
8
+ client.post('ref-data/isin', isin: ['US0378331005'], token: client.secret_token)
9
+ end
10
+ it 'retrieves a ticker by ISIN' do
11
+ expect(subject.count).to eq(2)
12
+ expect(subject.first).to eq('exchange' => 'NAS', 'iexId' => 'IEX_4D48333344362D52', 'region' => 'US', 'symbol' => 'AAPL')
13
+ expect(subject.last).to eq('exchange' => 'ETR', 'iexId' => 'IEX_464D46474C312D52', 'region' => 'DE', 'symbol' => 'APC-GY')
14
+ end
15
+ end
16
+ end
@@ -10,3 +10,4 @@ Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].each do |file|
10
10
  end
11
11
 
12
12
  ENV['IEX_API_PUBLISHABLE_TOKEN'] ||= 'test-iex-api-publishable-token'
13
+ ENV['IEX_API_SECRET_TOKEN'] ||= 'test-iex-api-secret-token'
@@ -6,4 +6,7 @@ VCR.configure do |config|
6
6
  config.hook_into :webmock
7
7
  # config.default_cassette_options = { record: :new_episodes }
8
8
  config.configure_rspec_metadata!
9
+
10
+ config.filter_sensitive_data('test-iex-api-publishable-token') { ENV['IEX_API_PUBLISHABLE_TOKEN'] }
11
+ config.filter_sensitive_data('test-iex-api-secret-token') { ENV['IEX_API_SECRET_TOKEN'] }
9
12
  end
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: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-08 00:00:00.000000000 Z
11
+ date: 2020-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -220,6 +220,7 @@ files:
220
220
  - spec/fixtures/iex/earnings/msft.yml
221
221
  - spec/fixtures/iex/income/invalid.yml
222
222
  - spec/fixtures/iex/income/msft.yml
223
+ - spec/fixtures/iex/income/nsrgy.yml
223
224
  - spec/fixtures/iex/key_stats/invalid.yml
224
225
  - spec/fixtures/iex/key_stats/msft.yml
225
226
  - spec/fixtures/iex/largest-trades/aapl.yml
@@ -234,6 +235,7 @@ files:
234
235
  - spec/fixtures/iex/price/msft.yml
235
236
  - spec/fixtures/iex/quote/invalid.yml
236
237
  - spec/fixtures/iex/quote/msft.yml
238
+ - spec/fixtures/iex/ref-data/isin.yml
237
239
  - spec/fixtures/iex/sectors/invalid.yml
238
240
  - spec/fixtures/iex/sectors/sectors-performance.yml
239
241
  - spec/iex/client_spec.rb
@@ -251,6 +253,7 @@ files:
251
253
  - spec/iex/endpoints/ohlc_spec.rb
252
254
  - spec/iex/endpoints/price_spec.rb
253
255
  - spec/iex/endpoints/quote_spec.rb
256
+ - spec/iex/endpoints/ref_data_spec.rb
254
257
  - spec/iex/endpoints/sectors_spec.rb
255
258
  - spec/iex/resources/resource_spec.rb
256
259
  - spec/iex/version_spec.rb
@@ -276,8 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
279
  - !ruby/object:Gem::Version
277
280
  version: 1.3.6
278
281
  requirements: []
279
- rubyforge_project:
280
- rubygems_version: 2.6.14.1
282
+ rubygems_version: 3.0.3
281
283
  signing_key:
282
284
  specification_version: 4
283
285
  summary: IEX Finance API Ruby client with support for retrieving stock quotes.
@@ -302,6 +304,7 @@ test_files:
302
304
  - spec/fixtures/iex/earnings/msft.yml
303
305
  - spec/fixtures/iex/income/invalid.yml
304
306
  - spec/fixtures/iex/income/msft.yml
307
+ - spec/fixtures/iex/income/nsrgy.yml
305
308
  - spec/fixtures/iex/key_stats/invalid.yml
306
309
  - spec/fixtures/iex/key_stats/msft.yml
307
310
  - spec/fixtures/iex/largest-trades/aapl.yml
@@ -316,6 +319,7 @@ test_files:
316
319
  - spec/fixtures/iex/price/msft.yml
317
320
  - spec/fixtures/iex/quote/invalid.yml
318
321
  - spec/fixtures/iex/quote/msft.yml
322
+ - spec/fixtures/iex/ref-data/isin.yml
319
323
  - spec/fixtures/iex/sectors/invalid.yml
320
324
  - spec/fixtures/iex/sectors/sectors-performance.yml
321
325
  - spec/iex/client_spec.rb
@@ -333,6 +337,7 @@ test_files:
333
337
  - spec/iex/endpoints/ohlc_spec.rb
334
338
  - spec/iex/endpoints/price_spec.rb
335
339
  - spec/iex/endpoints/quote_spec.rb
340
+ - spec/iex/endpoints/ref_data_spec.rb
336
341
  - spec/iex/endpoints/sectors_spec.rb
337
342
  - spec/iex/resources/resource_spec.rb
338
343
  - spec/iex/version_spec.rb