iex-ruby-client 1.0.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +5 -5
  2. data/.env.sample +2 -0
  3. data/.github/FUNDING.yml +1 -0
  4. data/.rubocop.yml +4 -1
  5. data/.rubocop_todo.yml +0 -8
  6. data/CHANGELOG.md +43 -9
  7. data/Dangerfile +2 -2
  8. data/Gemfile +3 -2
  9. data/README.md +134 -10
  10. data/iex-ruby-client.gemspec +3 -2
  11. data/lib/iex/api.rb +6 -1
  12. data/lib/iex/api/client.rb +13 -2
  13. data/lib/iex/api/config/client.rb +52 -0
  14. data/lib/iex/api/config/logger.rb +35 -0
  15. data/lib/iex/cloud/connection.rb +22 -19
  16. data/lib/iex/cloud/request.rb +1 -1
  17. data/lib/iex/cloud/response.rb +1 -1
  18. data/lib/iex/endpoints/advanced_stats.rb +11 -0
  19. data/lib/iex/endpoints/chart.rb +5 -6
  20. data/lib/iex/endpoints/company.rb +1 -1
  21. data/lib/iex/endpoints/crypto.rb +1 -1
  22. data/lib/iex/endpoints/dividends.rb +1 -1
  23. data/lib/iex/endpoints/earnings.rb +1 -1
  24. data/lib/iex/endpoints/income.rb +13 -0
  25. data/lib/iex/endpoints/key_stats.rb +1 -1
  26. data/lib/iex/endpoints/largest_trades.rb +1 -1
  27. data/lib/iex/endpoints/logo.rb +1 -1
  28. data/lib/iex/endpoints/news.rb +1 -1
  29. data/lib/iex/endpoints/ohlc.rb +2 -2
  30. data/lib/iex/endpoints/price.rb +1 -1
  31. data/lib/iex/endpoints/quote.rb +1 -1
  32. data/lib/iex/endpoints/ref_data.rb +22 -0
  33. data/lib/iex/endpoints/sectors.rb +1 -1
  34. data/lib/iex/endpoints/stock_market.rb +11 -0
  35. data/lib/iex/resources.rb +4 -0
  36. data/lib/iex/resources/advanced_stats.rb +42 -0
  37. data/lib/iex/resources/chart.rb +9 -14
  38. data/lib/iex/resources/company.rb +1 -0
  39. data/lib/iex/resources/income.rb +36 -0
  40. data/lib/iex/resources/key_stats.rb +2 -2
  41. data/lib/iex/resources/quote.rb +15 -5
  42. data/lib/iex/resources/resource.rb +1 -1
  43. data/lib/iex/resources/symbol.rb +10 -0
  44. data/lib/iex/resources/symbols.rb +19 -0
  45. data/lib/iex/version.rb +1 -1
  46. data/spec/fixtures/iex/advanced_stats/invalid.yml +50 -0
  47. data/spec/fixtures/iex/advanced_stats/msft.yml +57 -0
  48. data/spec/fixtures/iex/chart/1d.yml +440 -473
  49. data/spec/fixtures/iex/chart/20190306.yml +440 -473
  50. data/spec/fixtures/iex/chart/bad_option.yml +47 -81
  51. data/spec/fixtures/iex/chart/chartInterval.yml +89 -122
  52. data/spec/fixtures/iex/chart/dynamic/1m.yml +73 -107
  53. data/spec/fixtures/iex/chart/invalid.yml +47 -81
  54. data/spec/fixtures/iex/chart/msft.yml +74 -107
  55. data/spec/fixtures/iex/income/invalid.yml +49 -0
  56. data/spec/fixtures/iex/income/msft.yml +53 -0
  57. data/spec/fixtures/iex/income/nsrgy.yml +55 -0
  58. data/spec/fixtures/iex/ref-data/isin.yml +57 -0
  59. data/spec/fixtures/iex/ref-data/isin_mapped.yml +57 -0
  60. data/spec/fixtures/iex/ref-data/symbols.yml +9002 -0
  61. data/spec/fixtures/iex/ref-data/wrong_isin_mapped.yml +57 -0
  62. data/spec/fixtures/iex/stock_market/list_mostactive.yml +76 -0
  63. data/spec/iex/client_spec.rb +97 -14
  64. data/spec/iex/config/client_spec.rb +49 -0
  65. data/spec/iex/config/logger_spec.rb +46 -0
  66. data/spec/iex/endpoints/advanced_stats_spec.rb +54 -0
  67. data/spec/iex/endpoints/chart_spec.rb +7 -7
  68. data/spec/iex/endpoints/company_spec.rb +1 -0
  69. data/spec/iex/endpoints/income_spec.rb +68 -0
  70. data/spec/iex/endpoints/key_stats_spec.rb +2 -1
  71. data/spec/iex/endpoints/quote_spec.rb +2 -0
  72. data/spec/iex/endpoints/ref_data_spec.rb +76 -0
  73. data/spec/iex/endpoints/stock_market_spec.rb +14 -0
  74. data/spec/spec_helper.rb +3 -2
  75. data/spec/support/vcr.rb +3 -0
  76. metadata +56 -16
  77. data/lib/iex/api/config.rb +0 -45
  78. data/spec/iex/config_spec.rb +0 -22
@@ -1,45 +0,0 @@
1
- module IEX
2
- module Api
3
- module Config
4
- extend self
5
-
6
- ATTRIBUTES = %i[
7
- proxy
8
- user_agent
9
- ca_path
10
- ca_file
11
- logger
12
- timeout
13
- open_timeout
14
- endpoint
15
- publishable_token
16
- ].freeze
17
-
18
- attr_accessor(*Config::ATTRIBUTES)
19
-
20
- def reset!
21
- self.endpoint = 'https://cloud.iexapis.com/v1'
22
- self.publishable_token = ENV['IEX_API_PUBLISHABLE_TOKEN']
23
- self.user_agent = "IEX Ruby Client/#{IEX::VERSION}"
24
- self.ca_path = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_DIR : nil
25
- self.ca_file = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_FILE : nil
26
- self.proxy = nil
27
- self.logger = nil
28
- self.timeout = nil
29
- self.open_timeout = nil
30
- end
31
- end
32
-
33
- class << self
34
- def configure
35
- block_given? ? yield(Config) : Config
36
- end
37
-
38
- def config
39
- Config
40
- end
41
- end
42
- end
43
- end
44
-
45
- IEX::Api::Config.reset!
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe IEX::Api::Config do
4
- before do
5
- IEX::Api.config.reset!
6
- end
7
- describe '#defaults' do
8
- it 'sets endpoint' do
9
- expect(IEX::Api.config.endpoint).to eq 'https://cloud.iexapis.com/v1'
10
- end
11
- end
12
- describe '#configure' do
13
- before do
14
- IEX::Api.configure do |config|
15
- config.endpoint = 'updated'
16
- end
17
- end
18
- it 'sets endpoint' do
19
- expect(IEX::Api.config.endpoint).to eq 'updated'
20
- end
21
- end
22
- end