iex-ruby-client 1.4.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/danger.yml +20 -0
  3. data/.github/workflows/rubocop.yml +14 -0
  4. data/.github/workflows/test.yml +25 -0
  5. data/.gitignore +2 -0
  6. data/.rubocop.yml +1 -0
  7. data/.rubocop_todo.yml +8 -1
  8. data/CHANGELOG.md +14 -0
  9. data/CONTRIBUTING.md +1 -1
  10. data/Gemfile.danger +6 -0
  11. data/README.md +53 -16
  12. data/RELEASING.md +1 -1
  13. data/UPGRADING.md +23 -0
  14. data/iex-ruby-client.gemspec +3 -3
  15. data/lib/iex/api/client.rb +2 -0
  16. data/lib/iex/api/config/client.rb +2 -2
  17. data/lib/iex/api.rb +2 -0
  18. data/lib/iex/endpoints/fx.rb +13 -0
  19. data/lib/iex/endpoints/historial_prices.rb +2 -2
  20. data/lib/iex/endpoints/key_stat.rb +14 -0
  21. data/lib/iex/endpoints/ref_data.rb +5 -0
  22. data/lib/iex/errors/invalid_symbols_list.rb +14 -0
  23. data/lib/iex/errors/stat_not_found_error.rb +13 -0
  24. data/lib/iex/errors.rb +3 -1
  25. data/lib/iex/resources/currency_rate.rb +9 -0
  26. data/lib/iex/resources/resource.rb +5 -1
  27. data/lib/iex/resources/symbols.rb +5 -0
  28. data/lib/iex/resources.rb +1 -0
  29. data/lib/iex/version.rb +1 -1
  30. data/lib/iex-ruby-client.rb +1 -1
  31. data/script/console +9 -0
  32. data/spec/fixtures/iex/fx/invalid.yml +83 -0
  33. data/spec/fixtures/iex/fx/latest.yml +85 -0
  34. data/spec/fixtures/iex/fx/latest_one_symbol.yml +85 -0
  35. data/spec/fixtures/iex/key_stat/individual.yml +60 -0
  36. data/spec/fixtures/iex/key_stat/invalid_stat.yml +60 -0
  37. data/spec/fixtures/iex/key_stat/invalid_symbol.yml +50 -0
  38. data/spec/fixtures/iex/ref-data/exchange_symbols.yml +1 -1869
  39. data/spec/fixtures/iex/ref-data/region_symbols.yml +58 -0
  40. data/spec/iex/config/client_spec.rb +9 -3
  41. data/spec/iex/endpoints/fx_spec.rb +48 -0
  42. data/spec/iex/endpoints/key_stat_spec.rb +43 -0
  43. data/spec/iex/endpoints/ref_data_spec.rb +38 -8
  44. data/spec/support/client.rb +2 -0
  45. metadata +43 -16
  46. data/.travis.yml +0 -9
@@ -0,0 +1,85 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cloud.iexapis.com/v1/fx/latest?symbols=USDCAD,USDGBP,USDJPY&token=test-iex-api-publishable-token
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.4
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Fri, 05 Apr 2019 02:59:48 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Content-Length:
28
+ - "6"
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - ctoken=3859f7adf5e24bb0ac6a2283b1d2c588; Max-Age=43200; Path=/; Expires=Fri,
33
+ 05 Apr 2019 14:59:48 GMT
34
+ Content-Security-Policy:
35
+ - "default-src 'self'; child-src 'none'; object-src 'self'; style-src
36
+ 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self'
37
+ https://js.intercomcdn.com/fonts/ https://fonts.gstatic.com; frame-src 'self'
38
+ https://portal.productboard.com/ https://js.stripe.com/; img-src 'self'
39
+ data: https://*.intercomcdn.com/ https://static.intercomassets.com/ https://www.google-analytics.com
40
+ https://downloads.intercomcdn.com/; connect-src 'self' https://auth.iexcloud.io
41
+ https://api.iexcloud.io https://api.iexcloud.io https://cloud.iexapis.com
42
+ wss://iexcloud.io wss://tops.iexcloud.io wss://api.iexcloud.io wss://iexcloud.io
43
+ https://api-iam.intercom.io/messenger/ https://nexus-websocket-a.intercom.io/
44
+ https://nexus-websocket-b.intercom.io/ wss://nexus-websocket-a.intercom.io/
45
+ wss://nexus-websocket-b.intercom.io/ https://www.google-analytics.com; script-src
46
+ 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com/recaptcha/api.js
47
+ https://www.google-analytics.com https://js.stripe.com/v3/ https://widget.intercom.io/widget/lhos563b
48
+ https://js.intercomcdn.com/ https://www.googletagmanager.com;"
49
+ X-Content-Security-Policy:
50
+ - "default-src 'self'; child-src 'none'; object-src 'self'; style-src
51
+ 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self'
52
+ https://js.intercomcdn.com/fonts/ https://fonts.gstatic.com; frame-src 'self'
53
+ https://portal.productboard.com/ https://js.stripe.com/; img-src 'self'
54
+ data: https://*.intercomcdn.com/ https://static.intercomassets.com/ https://www.google-analytics.com
55
+ https://downloads.intercomcdn.com/; connect-src 'self' https://auth.iexcloud.io
56
+ https://api.iexcloud.io https://api.iexcloud.io https://cloud.iexapis.com
57
+ wss://iexcloud.io wss://tops.iexcloud.io wss://api.iexcloud.io wss://iexcloud.io
58
+ https://api-iam.intercom.io/messenger/ https://nexus-websocket-a.intercom.io/
59
+ https://nexus-websocket-b.intercom.io/ wss://nexus-websocket-a.intercom.io/
60
+ wss://nexus-websocket-b.intercom.io/ https://www.google-analytics.com; script-src
61
+ 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com/recaptcha/api.js
62
+ https://www.google-analytics.com https://js.stripe.com/v3/ https://widget.intercom.io/widget/lhos563b
63
+ https://js.intercomcdn.com/ https://www.googletagmanager.com;"
64
+ Frame-Options:
65
+ - SAMEORIGIN
66
+ X-Frame-Options:
67
+ - SAMEORIGIN
68
+ X-Content-Type-Options:
69
+ - nosniff
70
+ Strict-Transport-Security:
71
+ - max-age=15768000
72
+ Access-Control-Allow-Origin:
73
+ - "*"
74
+ Access-Control-Allow-Credentials:
75
+ - "true"
76
+ Access-Control-Allow-Methods:
77
+ - GET, OPTIONS
78
+ Access-Control-Allow-Headers:
79
+ - Origin, X-Requested-With, Content-Type, Accept
80
+ body:
81
+ encoding: ASCII-8BIT
82
+ string: '[{"symbol":"USDCAD","rate":1.25674,"timestamp":1627045829863,"isDerived":false},{"symbol":"USDGBP","rate":0.7262111386264443,"timestamp":1627045780863,"isDerived":false},{"symbol":"USDJPY","rate":110.426,"timestamp":1627045825365,"isDerived":false}]'
83
+ http_version:
84
+ recorded_at: Fri, 05 Apr 2019 02:59:48 GMT
85
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,85 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cloud.iexapis.com/v1/fx/latest?symbols=USDCAD&token=test-iex-api-publishable-token
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.4
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Fri, 05 Apr 2019 02:59:48 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Content-Length:
28
+ - "6"
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - ctoken=3859f7adf5e24bb0ac6a2283b1d2c588; Max-Age=43200; Path=/; Expires=Fri,
33
+ 05 Apr 2019 14:59:48 GMT
34
+ Content-Security-Policy:
35
+ - "default-src 'self'; child-src 'none'; object-src 'self'; style-src
36
+ 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self'
37
+ https://js.intercomcdn.com/fonts/ https://fonts.gstatic.com; frame-src 'self'
38
+ https://portal.productboard.com/ https://js.stripe.com/; img-src 'self'
39
+ data: https://*.intercomcdn.com/ https://static.intercomassets.com/ https://www.google-analytics.com
40
+ https://downloads.intercomcdn.com/; connect-src 'self' https://auth.iexcloud.io
41
+ https://api.iexcloud.io https://api.iexcloud.io https://cloud.iexapis.com
42
+ wss://iexcloud.io wss://tops.iexcloud.io wss://api.iexcloud.io wss://iexcloud.io
43
+ https://api-iam.intercom.io/messenger/ https://nexus-websocket-a.intercom.io/
44
+ https://nexus-websocket-b.intercom.io/ wss://nexus-websocket-a.intercom.io/
45
+ wss://nexus-websocket-b.intercom.io/ https://www.google-analytics.com; script-src
46
+ 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com/recaptcha/api.js
47
+ https://www.google-analytics.com https://js.stripe.com/v3/ https://widget.intercom.io/widget/lhos563b
48
+ https://js.intercomcdn.com/ https://www.googletagmanager.com;"
49
+ X-Content-Security-Policy:
50
+ - "default-src 'self'; child-src 'none'; object-src 'self'; style-src
51
+ 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self'
52
+ https://js.intercomcdn.com/fonts/ https://fonts.gstatic.com; frame-src 'self'
53
+ https://portal.productboard.com/ https://js.stripe.com/; img-src 'self'
54
+ data: https://*.intercomcdn.com/ https://static.intercomassets.com/ https://www.google-analytics.com
55
+ https://downloads.intercomcdn.com/; connect-src 'self' https://auth.iexcloud.io
56
+ https://api.iexcloud.io https://api.iexcloud.io https://cloud.iexapis.com
57
+ wss://iexcloud.io wss://tops.iexcloud.io wss://api.iexcloud.io wss://iexcloud.io
58
+ https://api-iam.intercom.io/messenger/ https://nexus-websocket-a.intercom.io/
59
+ https://nexus-websocket-b.intercom.io/ wss://nexus-websocket-a.intercom.io/
60
+ wss://nexus-websocket-b.intercom.io/ https://www.google-analytics.com; script-src
61
+ 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com/recaptcha/api.js
62
+ https://www.google-analytics.com https://js.stripe.com/v3/ https://widget.intercom.io/widget/lhos563b
63
+ https://js.intercomcdn.com/ https://www.googletagmanager.com;"
64
+ Frame-Options:
65
+ - SAMEORIGIN
66
+ X-Frame-Options:
67
+ - SAMEORIGIN
68
+ X-Content-Type-Options:
69
+ - nosniff
70
+ Strict-Transport-Security:
71
+ - max-age=15768000
72
+ Access-Control-Allow-Origin:
73
+ - "*"
74
+ Access-Control-Allow-Credentials:
75
+ - "true"
76
+ Access-Control-Allow-Methods:
77
+ - GET, OPTIONS
78
+ Access-Control-Allow-Headers:
79
+ - Origin, X-Requested-With, Content-Type, Accept
80
+ body:
81
+ encoding: ASCII-8BIT
82
+ string: '[{"symbol":"USDCAD","rate":1.25674,"timestamp":1627045829863}]'
83
+ http_version:
84
+ recorded_at: Fri, 05 Apr 2019 02:59:48 GMT
85
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cloud.iexapis.com/v1/stock/VTI/stats/ttmDividendRate?token=test-iex-api-publishable-token
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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.4.2
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
+ - Thu, 12 Aug 2021 20:04:24 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '18'
31
+ Connection:
32
+ - keep-alive
33
+ Set-Cookie:
34
+ - ctoken=8df9fdfb440744638edd9bfdc8e0d27b; Max-Age=43200; Path=/; Expires=Fri,
35
+ 13 Aug 2021 08:04:24 GMT
36
+ Iexcloud-Messages-Used:
37
+ - '2'
38
+ Iexcloud-Credits-Used:
39
+ - '2'
40
+ Iexcloud-Premium-Messages-Used:
41
+ - '0'
42
+ Iexcloud-Premium-Credits-Used:
43
+ - '0'
44
+ X-Content-Type-Options:
45
+ - nosniff
46
+ Strict-Transport-Security:
47
+ - max-age=15768000
48
+ Access-Control-Allow-Origin:
49
+ - "*"
50
+ Access-Control-Allow-Credentials:
51
+ - 'true'
52
+ Access-Control-Allow-Methods:
53
+ - GET, OPTIONS
54
+ Access-Control-Allow-Headers:
55
+ - Origin, X-Requested-With, Content-Type, Accept, Request-Source
56
+ body:
57
+ encoding: UTF-8
58
+ string: '2.7887693754001748'
59
+ recorded_at: Thu, 12 Aug 2021 20:04:24 GMT
60
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cloud.iexapis.com/v1/stock/VTI/stats/INVALID?token=test-iex-api-publishable-token
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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.4.2
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
+ - Fri, 13 Aug 2021 17:45:21 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=f9f32af4b36f4a1bac8e9b2ff9018275; Max-Age=43200; Path=/; Expires=Sat,
35
+ 14 Aug 2021 05:45:21 GMT
36
+ Iexcloud-Messages-Used:
37
+ - '6'
38
+ Iexcloud-Credits-Used:
39
+ - '6'
40
+ Iexcloud-Premium-Messages-Used:
41
+ - '0'
42
+ Iexcloud-Premium-Credits-Used:
43
+ - '0'
44
+ X-Content-Type-Options:
45
+ - nosniff
46
+ Strict-Transport-Security:
47
+ - max-age=15768000
48
+ Access-Control-Allow-Origin:
49
+ - "*"
50
+ Access-Control-Allow-Credentials:
51
+ - 'true'
52
+ Access-Control-Allow-Methods:
53
+ - GET, OPTIONS
54
+ Access-Control-Allow-Headers:
55
+ - Origin, X-Requested-With, Content-Type, Accept, Request-Source
56
+ body:
57
+ encoding: ASCII-8BIT
58
+ string: '{"companyName":"Vanguard Group, Inc.","marketcap":260737447690,"week52high":230.02,"week52low":160.5,"week52highSplitAdjustOnly":230.02,"week52lowSplitAdjustOnly":162.85,"week52change":0.3645993202513256,"sharesOutstanding":1133542508,"float":0,"avg10Volume":2888645,"avg30Volume":3320395,"day200MovingAvg":213.89,"day50MovingAvg":225.73,"employees":0,"ttmEPS":0,"ttmDividendRate":2.788769375400175,"dividendYield":0.012124029977394032,"nextDividendDate":"","exDividendDate":"2021-06-24","nextEarningsDate":"","peRatio":0,"beta":1.0132372909433216,"maxChangePercent":3.578068183401369,"year5ChangePercent":1.249480952953752,"year2ChangePercent":0.6180018710916342,"year1ChangePercent":0.3635630717574918,"ytdChangePercent":0.1893429658290111,"month6ChangePercent":0.1156861042707178,"month3ChangePercent":0.10073637646122013,"month1ChangePercent":0.015496004591408763,"day30ChangePercent":0.021176470588235352,"day5ChangePercent":0.006255741720985197}'
59
+ recorded_at: Fri, 13 Aug 2021 17:45:21 GMT
60
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cloud.iexapis.com/v1/stock/INVALID/stats/ttmDividendRate?token=test-iex-api-publishable-token
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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.4.2
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 404
21
+ message: Not Found
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Fri, 13 Aug 2021 17:45:20 GMT
27
+ Content-Type:
28
+ - text/html; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Set-Cookie:
34
+ - ctoken=8e6f76d57e134a4ca1be468312f5f33c; Max-Age=43200; Path=/; Expires=Sat,
35
+ 14 Aug 2021 05:45:20 GMT
36
+ Strict-Transport-Security:
37
+ - max-age=15768000
38
+ Access-Control-Allow-Origin:
39
+ - "*"
40
+ Access-Control-Allow-Credentials:
41
+ - 'true'
42
+ Access-Control-Allow-Methods:
43
+ - GET, OPTIONS
44
+ Access-Control-Allow-Headers:
45
+ - Origin, X-Requested-With, Content-Type, Accept, Request-Source
46
+ body:
47
+ encoding: ASCII-8BIT
48
+ string: Unknown symbol
49
+ recorded_at: Fri, 13 Aug 2021 17:45:20 GMT
50
+ recorded_with: VCR 6.0.0