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 +4 -4
- data/.github/workflows/danger.yml +20 -0
- data/.github/workflows/rubocop.yml +14 -0
- data/.github/workflows/test.yml +25 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +8 -1
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.danger +6 -0
- data/README.md +19 -4
- data/RELEASING.md +1 -1
- data/UPGRADING.md +15 -0
- data/iex-ruby-client.gemspec +3 -3
- data/lib/iex/api/config/client.rb +2 -2
- data/lib/iex/cloud/connection.rb +9 -7
- data/lib/iex/endpoints/ref_data.rb +5 -0
- data/lib/iex/resources/symbols.rb +5 -0
- data/lib/iex/version.rb +1 -1
- data/lib/iex-ruby-client.rb +1 -2
- data/spec/fixtures/iex/ref-data/exchange_symbols.yml +1 -1869
- data/spec/fixtures/iex/ref-data/region_symbols.yml +58 -0
- data/spec/iex/config/client_spec.rb +9 -3
- data/spec/iex/endpoints/ref_data_spec.rb +38 -8
- data/spec/support/client.rb +2 -0
- metadata +13 -8
- data/.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d09a99f0ca87c78ce64bacf0ba8587cda08a9d9f05ca44fc253f755ad2976655
|
4
|
+
data.tar.gz: 148a78b3c9887c700ba119a37bf8ba533906393cabe52e0957288d4536ed2817
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
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
|
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
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://
|
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
|
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('
|
585
|
+
symbols = client.ref_data_symbols_for_exchange('XTSE')
|
585
586
|
|
586
587
|
symbol = symbols.first
|
587
|
-
symbol.exchange #
|
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 [
|
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.
|
data/iex-ruby-client.gemspec
CHANGED
@@ -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.
|
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 '
|
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.
|
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
|
data/lib/iex/cloud/connection.rb
CHANGED
@@ -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.
|
30
|
-
connection.
|
31
|
+
connection.request :multipart
|
32
|
+
connection.request :url_encoded
|
31
33
|
connection.use ::IEX::Cloud::Response::RaiseError
|
32
|
-
connection.
|
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