iex-ruby-client 1.6.0 → 2.1.0

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
  SHA256:
3
- metadata.gz: 842d8fd485aebd159c318088ca1137348555a4a2106e4e4089da3e13ecc596eb
4
- data.tar.gz: dc2046dd1efbd5c0593134fa99daf5a280f62c629c2779d785f5f34f41896c6a
3
+ metadata.gz: d09a99f0ca87c78ce64bacf0ba8587cda08a9d9f05ca44fc253f755ad2976655
4
+ data.tar.gz: 148a78b3c9887c700ba119a37bf8ba533906393cabe52e0957288d4536ed2817
5
5
  SHA512:
6
- metadata.gz: 543f9a5bea937226e974b430654c53d4fab1f4cbb79d025784888f6a4924aeb2c59bcceb2214257a78544274c217f555594cc100a9820dae2b8f90d72ef9b1ae
7
- data.tar.gz: 205d65bf85cfd152e4cddb8f6344658cea65a12201aceba42a43a52a524efcbf02e9695ddfa543c99b5fc90f402b096e490fe6341697fbb07e7de5a5a7961c72
6
+ metadata.gz: fac04752f4c52037cec76636ad59687f282e8bcc65e941c6dc2115a93ccc80cfe176456a8bb86ba46720b8a18d9b71ed672c0d0ca809a50f2ebbe70da0051014
7
+ data.tar.gz: b0533be87e2432309695f22b03a1e24336a40a197475e1f25dc605fbd93bcc42404ce017c846934c7d9d757373e1d73a55913e8337985c77097aa5b66ac92cd7
@@ -0,0 +1,20 @@
1
+ name: PR Linter
2
+ on: [pull_request]
3
+ jobs:
4
+ danger:
5
+ runs-on: ubuntu-latest
6
+ env:
7
+ BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.danger
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ with:
11
+ fetch-depth: 0
12
+ - name: Set up Ruby
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.7
16
+ bundler-cache: true
17
+ - run: |
18
+ # the personal token is public, this is ok, base64 encode to avoid tripping Github
19
+ TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
20
+ DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
@@ -0,0 +1,14 @@
1
+ name: Rubocop
2
+ on: [push, pull_request]
3
+ jobs:
4
+ lint:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v2
8
+ - name: Set up Ruby
9
+ uses: ruby/setup-ruby@v1
10
+ with:
11
+ ruby-version: 2.7
12
+ bundler-cache: true
13
+ - name: Run Rubocop
14
+ run: bundle exec rubocop
@@ -0,0 +1,25 @@
1
+ name: Tests
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ matrix:
8
+ entry:
9
+ - { ruby: "2.7" }
10
+ - { ruby: "3.0" }
11
+ - { ruby: "3.1" }
12
+ - { ruby: ruby-head, ignore: true }
13
+ - { ruby: jruby-head, ignore: true }
14
+ name: test (ruby=${{ matrix.entry.ruby }})
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Install Ruby
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: ${{ matrix.entry.ruby }}
21
+ - name: Run Tests
22
+ continue-on-error: ${{ matrix.entry.ignore || false }}
23
+ run: |
24
+ bundle install
25
+ bundle exec rspec
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
  .bundle
6
6
  .idea
7
7
  .irbrc
8
+ .tool-versions
data/.rubocop.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  AllCops:
2
2
  Exclude:
3
3
  - vendor/**/*
4
+ TargetRubyVersion: 2.4
4
5
 
5
6
  Style/FrozenStringLiteralComment:
6
7
  Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-04-19 14:36:19 -0400 using RuboCop version 0.67.2.
3
+ # on 2022-07-21 13:04:05 -0500 using RuboCop version 0.75.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
@@ -11,3 +11,10 @@
11
11
  Style/AsciiComments:
12
12
  Exclude:
13
13
  - 'lib/iex/resources/quote.rb'
14
+
15
+ # Offense count: 2
16
+ # Configuration parameters: EnforcedStyle.
17
+ # SupportedStyles: annotated, template, unannotated
18
+ Style/FormatStringToken:
19
+ Exclude:
20
+ - 'lib/iex/resources/resource.rb'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 2.1.0 (2023-09-17)
2
+ * [#120](https://github.com/dblock/iex-ruby-client/pull/120): Upgrade faraday to 2.7.10 - [@esarmstrong](https://github.com/esarmstrong).
3
+
4
+ ### 2.0.0 (2022/07/24)
5
+ * [#111](https://github.com/dblock/iex-ruby-client/pull/111): Added support for fetching symbols for a region - [@mathu97](https://github.com/mathu97).
6
+ * [#111](https://github.com/dblock/iex-ruby-client/pull/111): Added `Symbols#exchange_suffix`, `exchange_name`, `exchange_segment`, `exchange_segment_name`, and `lei` - [@mathu97](https://github.com/mathu97).
7
+ * [#113](https://github.com/dblock/iex-ruby-client/pull/113): Explicitly require Ruby >= 2.4 - [@agrberg](https://github.com/agrberg).
8
+ * [#113](https://github.com/dblock/iex-ruby-client/pull/113): Remove default SSL options for `ca_file` and `ca_path` - [@agrberg](https://github.com/agrberg).
9
+
1
10
  ### 1.6.0 (2021/10/17)
2
11
  * [#110](https://github.com/dblock/iex-ruby-client/pull/110): Drop `money_helper` dependency and utilize `money` gem directly - [@agrberg](https://github.com/agrberg).
3
12
 
data/CONTRIBUTING.md CHANGED
@@ -114,7 +114,7 @@ git push origin my-feature-branch -f
114
114
 
115
115
  ### Check on Your Pull Request
116
116
 
117
- Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
117
+ Go back to your pull request after a few minutes and see whether it passed muster with GitHub Actions. Everything should look green, otherwise fix issues and amend your commit as described above.
118
118
 
119
119
  ### Be Patient
120
120
 
data/Gemfile.danger ADDED
@@ -0,0 +1,6 @@
1
+ source 'http://rubygems.org'
2
+
3
+ group :test do
4
+ gem 'danger-changelog', '~> 0.6.0', require: false
5
+ gem 'danger-toc', '~> 0.2.0', require: false
6
+ end
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # IEX Finance API
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/iex-ruby-client.svg)](https://badge.fury.io/rb/iex-ruby-client)
4
- [![Build Status](https://travis-ci.org/dblock/iex-ruby-client.svg?branch=master)](https://travis-ci.org/dblock/iex-ruby-client)
4
+ [![Build Status](https://github.com/dblock/iex-ruby-client/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/dblock/iex-ruby-client/actions/workflows/test.yml)
5
5
 
6
6
  A Ruby client for the [The IEX Cloud API](https://iexcloud.io/docs/api/).
7
7
 
@@ -33,6 +33,7 @@ A Ruby client for the [The IEX Cloud API](https://iexcloud.io/docs/api/).
33
33
  - [ISIN Mapping](#isin-mapping)
34
34
  - [Get Symbols](#get-symbols)
35
35
  - [Get Symbols for an Exchange](#get-symbols-for-an-exchange)
36
+ - [Get Symbols for a Region](#get-symbols-for-a-region)
36
37
  - [Get Latest Foreign Exchange Rates](#get-latest-foreign-exchange-rates)
37
38
  - [Get List](#get-list)
38
39
  - [Other Requests](#other-requests)
@@ -578,13 +579,13 @@ See [#symbols](https://iexcloud.io/docs/api/#symbols) for detailed documentation
578
579
 
579
580
  ### Get Symbols for an Exchange
580
581
 
581
- Returns an array of symbols for a given exchange.
582
+ Returns an array of symbols for an exchange identified by a market identifier code.
582
583
 
583
584
  ```ruby
584
- symbols = client.ref_data_symbols_for_exchange('TSX')
585
+ symbols = client.ref_data_symbols_for_exchange('XTSE')
585
586
 
586
587
  symbol = symbols.first
587
- symbol.exchange # TSX
588
+ symbol.exchange # XTSE
588
589
  symbol.iex_id # IEX_4656374258322D52
589
590
  symbol.region # CA
590
591
  symbol.symbol # A-CV
@@ -592,6 +593,20 @@ symbol.symbol # A-CV
592
593
 
593
594
  See [#international-symbols](https://iexcloud.io/docs/api/#international-symbols) for returned fields.
594
595
 
596
+ ### Get Symbols for a Region
597
+
598
+ Returns an array of symbols for a region.
599
+
600
+ ```ruby
601
+ symbols = client.ref_data_symbols_for_region('ca')
602
+
603
+ symbol = symbols.first
604
+ symbol.exchange # XTSE
605
+ symbol.iex_id # IEX_4656374258322D53
606
+ symbol.region # CA
607
+ symbol.symbol # A-CT
608
+ ```
609
+
595
610
  ### Get Latest Foreign Exchange Rates
596
611
 
597
612
  Returns an array of foreign exchange rates for a given list of symbols.
data/RELEASING.md CHANGED
@@ -11,7 +11,7 @@ bundle install
11
11
  rake
12
12
  ```
13
13
 
14
- Check that the last build succeeded in [Travis CI](https://travis-ci.com/github/dblock/iex-ruby-client) for all supported platforms.
14
+ Check that the last build succeeded in [GitHub Actions](https://github.com/dblock/iex-ruby-client/actions/workflows/test.yml) for all supported platforms.
15
15
 
16
16
  Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date.
17
17
 
data/UPGRADING.md CHANGED
@@ -1,6 +1,21 @@
1
1
  Upgrading iex-ruby-client
2
2
  =========================
3
3
 
4
+ ### Upgrading to >= 2.0.0
5
+
6
+ [#113](https://github.com/dblock/iex-ruby-client/pull/113) Minimum Ruby version is 2.4
7
+
8
+ [#113](https://github.com/dblock/iex-ruby-client/pull/113) Removes default values for Faraday's SSL settings `ca_file` and `ca_path`.
9
+
10
+ If you previously relied on `OpenSSL::X509::DEFAULT_CERT_FILE` or `OpenSSL::X509::DEFAULT_CERT_DIR` to set these values you must now do so explicitly. E.g.:
11
+
12
+ ```ruby
13
+ IEX::Api.configure do |config|
14
+ config.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE
15
+ config.ca_path = OpenSSL::X509::DEFAULT_CERT_DIR
16
+ end
17
+ ```
18
+
4
19
  ### Upgrading to >= 1.6.0
5
20
 
6
21
  [#110](https://github.com/dblock/iex-ruby-client/pull/110) drops the dependency on `money_helper` in favor of using the `money` library directly.
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.email = 'dblock@dblock.org'
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.required_rubygems_version = '>= 1.3.6'
12
- s.required_ruby_version = '>= 2.3.0'
12
+ s.required_ruby_version = '>= 2.4.0'
13
13
  s.files = `git ls-files`.split("\n")
14
14
  s.test_files = `git ls-files -- spec/*`.split("\n")
15
15
  s.require_paths = ['lib']
@@ -17,12 +17,12 @@ Gem::Specification.new do |s|
17
17
  s.licenses = ['MIT']
18
18
  s.summary = 'IEX Finance API Ruby client with support for retrieving stock quotes.'
19
19
  s.add_dependency 'faraday', '>= 0.17'
20
- s.add_dependency 'faraday_middleware'
20
+ s.add_dependency 'faraday-multipart'
21
21
  s.add_dependency 'hashie'
22
22
  s.add_dependency 'money', '~> 6.0'
23
23
  s.add_development_dependency 'rake', '~> 10'
24
24
  s.add_development_dependency 'rspec'
25
- s.add_development_dependency 'rubocop', '0.72.0'
25
+ s.add_development_dependency 'rubocop', '0.75.0'
26
26
  s.add_development_dependency 'vcr'
27
27
  s.add_development_dependency 'webmock'
28
28
  end
@@ -21,13 +21,13 @@ module IEX
21
21
  attr_accessor(*ATTRIBUTES)
22
22
 
23
23
  def reset!
24
- self.ca_file = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_FILE : nil
25
- self.ca_path = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_DIR : nil
26
24
  self.endpoint = 'https://cloud.iexapis.com/v1'
27
25
  self.publishable_token = ENV['IEX_API_PUBLISHABLE_TOKEN']
28
26
  self.secret_token = ENV['IEX_API_SECRET_TOKEN']
29
27
  self.user_agent = "IEX Ruby Client/#{IEX::VERSION}"
30
28
 
29
+ self.ca_file = nil
30
+ self.ca_path = nil
31
31
  self.open_timeout = nil
32
32
  self.proxy = nil
33
33
  self.referer = nil
@@ -9,11 +9,13 @@ module IEX
9
9
 
10
10
  def connection
11
11
  @connection ||= begin
12
- options = {}
12
+ options = {
13
+ headers: {
14
+ 'Accept' => 'application/json; charset=utf-8',
15
+ 'Content-Type' => 'application/json; charset=utf-8'
16
+ }
17
+ }
13
18
 
14
- options[:headers] = {}
15
- options[:headers]['Accept'] = 'application/json; charset=utf-8'
16
- options[:headers]['Content-Type'] = 'application/json; charset=utf-8'
17
19
  options[:headers]['User-Agent'] = user_agent if user_agent
18
20
  options[:headers]['Referer'] = referer if referer
19
21
  options[:proxy] = proxy if proxy
@@ -26,10 +28,10 @@ module IEX
26
28
  options[:request] = request_options if request_options.any?
27
29
 
28
30
  ::Faraday::Connection.new(endpoint, options) do |connection|
29
- connection.use ::Faraday::Request::Multipart
30
- connection.use ::Faraday::Request::UrlEncoded
31
+ connection.request :multipart
32
+ connection.request :url_encoded
31
33
  connection.use ::IEX::Cloud::Response::RaiseError
32
- connection.use ::FaradayMiddleware::ParseJson, content_type: /\bjson$/
34
+ connection.response :json
33
35
  connection.response(:logger, logger.instance, logger.options, &logger.proc) if logger.instance
34
36
  connection.adapter ::Faraday.default_adapter
35
37
  end
@@ -22,6 +22,11 @@ module IEX
22
22
  response = get("ref-data/exchange/#{exchange}/symbols", { token: publishable_token }.merge(options))
23
23
  response.map { |row| IEX::Resources::Symbols.new(row) }
24
24
  end
25
+
26
+ def ref_data_symbols_for_region(region, options = {})
27
+ response = get("ref-data/region/#{region}/symbols", { token: publishable_token }.merge(options))
28
+ response.map { |row| IEX::Resources::Symbols.new(row) }
29
+ end
25
30
  end
26
31
  end
27
32
  end
@@ -3,6 +3,10 @@ module IEX
3
3
  class Symbols < Resource
4
4
  property 'symbol'
5
5
  property 'exchange'
6
+ property 'exchange_suffix', from: 'exchangeSuffix'
7
+ property 'exchange_name', from: 'exchangeName'
8
+ property 'exchange_segment', from: 'exchangeSegment'
9
+ property 'exchange_segment_name', from: 'exchangeSegmentName'
6
10
  property 'name'
7
11
  property 'date', transform_with: ->(v) { Date.parse(v) }
8
12
  property 'enabled', from: 'isEnabled'
@@ -12,6 +16,7 @@ module IEX
12
16
  property 'iex_id', from: 'iexId'
13
17
  property 'figi'
14
18
  property 'cik'
19
+ property 'lei'
15
20
 
16
21
  alias :enabled? enabled
17
22
  end
data/lib/iex/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module IEX
2
- VERSION = '1.6.0'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
@@ -1,6 +1,5 @@
1
1
  require 'faraday'
2
- require 'faraday_middleware'
3
- require 'faraday_middleware/response_middleware'
2
+ require 'faraday/multipart'
4
3
  require 'hashie'
5
4
  require 'money'
6
5
  require 'date'