sec_id 3.0.0 → 4.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/dependabot.yml +11 -0
- data/.github/workflows/main.yml +39 -0
- data/.rubocop.yml +7 -1
- data/CHANGELOG.md +27 -0
- data/Gemfile +12 -0
- data/README.md +50 -4
- data/lib/sec_id/base.rb +15 -13
- data/lib/sec_id/cik.rb +33 -0
- data/lib/sec_id/cusip.rb +25 -11
- data/lib/sec_id/figi.rb +53 -0
- data/lib/sec_id/isin.rb +28 -11
- data/lib/sec_id/sedol.rb +5 -3
- data/lib/sec_id/version.rb +1 -1
- data/lib/sec_id.rb +2 -0
- data/sec_id.gemspec +2 -7
- metadata +14 -94
- data/.travis.yml +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3391006ed4c0e135a0e94ef0d43da6aae3146a178f13c6237aec8d940931c52
|
4
|
+
data.tar.gz: a572d9b26de1c8c97476cd954caeefacc9fe44ac8ffff7f25d9b4a72ca058e54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d380490f4a25d1044734b7724bf7e752e7dbb43097a468d3210e8fd9f4efd185beac207d9b5adfc5cce0cedfd5ea944be269785f444fd7a4bbb449b63ea9962
|
7
|
+
data.tar.gz: 30434ebe94c7f2c7f3a311ab2a3857af1ae0b66b5993c3b659fd9f6852633171cd7e4ce3c73f7d1e554211cbb53259e1e7679236df243f8dfaf311a0a61cebee
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
3
|
+
# Please see the documentation for all configuration options:
|
4
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
5
|
+
|
6
|
+
version: 2
|
7
|
+
updates:
|
8
|
+
- package-ecosystem: "bundler" # See documentation for possible values
|
9
|
+
directory: "/" # Location of package manifests
|
10
|
+
schedule:
|
11
|
+
interval: "weekly"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
concurrency:
|
4
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
5
|
+
cancel-in-progress: true
|
6
|
+
|
7
|
+
on:
|
8
|
+
push:
|
9
|
+
branches: ["main"]
|
10
|
+
pull_request:
|
11
|
+
branches: ["main"]
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
build:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
name: Ruby ${{ matrix.ruby_version }}
|
17
|
+
strategy:
|
18
|
+
matrix:
|
19
|
+
ruby_version: [ruby-head, '3.3', '3.2', '3.1']
|
20
|
+
|
21
|
+
env:
|
22
|
+
COVERAGE: true
|
23
|
+
CC_TEST_REPORTER_ID: ${{ vars.CC_TEST_REPORTER_ID }}
|
24
|
+
|
25
|
+
steps:
|
26
|
+
- uses: actions/checkout@v4
|
27
|
+
|
28
|
+
- uses: ruby/setup-ruby@v1
|
29
|
+
with:
|
30
|
+
ruby-version: ${{ matrix.ruby_version }}
|
31
|
+
bundler-cache: true
|
32
|
+
continue-on-error: ${{ matrix.ruby_version == 'ruby-head' }}
|
33
|
+
|
34
|
+
- run: bundle exec rake
|
35
|
+
continue-on-error: ${{ matrix.ruby_version == 'ruby-head' }}
|
36
|
+
|
37
|
+
- uses: paambaati/codeclimate-action@v8.0.0
|
38
|
+
# Only upload coverage for the latest Ruby and don't run for PRs from forks
|
39
|
+
if: ${{ matrix.ruby_version == '3.3' && github.event.pull_request.head.repo.fork == false }}
|
data/.rubocop.yml
CHANGED
@@ -2,10 +2,12 @@ require:
|
|
2
2
|
- rubocop-rspec
|
3
3
|
|
4
4
|
AllCops:
|
5
|
-
TargetRubyVersion:
|
5
|
+
TargetRubyVersion: 3.1
|
6
6
|
DisplayCopNames: true
|
7
7
|
DisplayStyleGuide: true
|
8
8
|
ExtraDetails: true
|
9
|
+
SuggestExtensions: false
|
10
|
+
NewCops: enable
|
9
11
|
|
10
12
|
Layout/LineLength:
|
11
13
|
Max: 120
|
@@ -26,6 +28,10 @@ Metrics/BlockLength:
|
|
26
28
|
Exclude:
|
27
29
|
- 'spec/**/*'
|
28
30
|
|
31
|
+
Lint/MissingSuper:
|
32
|
+
AllowedParentClasses:
|
33
|
+
- Base
|
34
|
+
|
29
35
|
RSpec/MultipleExpectations:
|
30
36
|
Max: 5
|
31
37
|
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [4.1.0] - 2024-09-23
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- FIGI support ([@wtn][], #84)
|
8
|
+
- CIK support ([@wtn][], #85)
|
9
|
+
- Convert between CUSIPs and ISINs ([@wtn][], #86, #88)
|
10
|
+
- CINS check method for CUSIPs ([@wtn][], #87)
|
11
|
+
|
12
|
+
### Updated
|
13
|
+
|
14
|
+
- Small internal refactorings
|
15
|
+
|
16
|
+
## [4.0.0] - 2024-07-09
|
17
|
+
|
18
|
+
### Breaking changes
|
19
|
+
|
20
|
+
- Minimum required Ruby version is 3.1 now
|
21
|
+
- Default repository branch renamed to `main`
|
22
|
+
|
23
|
+
### Updated
|
24
|
+
|
25
|
+
- Small internal refactorings
|
26
|
+
- TravisCI -> GitHub Actions
|
27
|
+
- Dropped tests for Ruby below 3.1
|
28
|
+
- Rubocop's Ruby target version changed to 3.1
|
29
|
+
|
3
30
|
## [3.0.0] - 2020-03-10
|
4
31
|
|
5
32
|
### Breaking changes
|
data/Gemfile
CHANGED
@@ -6,3 +6,15 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
6
6
|
|
7
7
|
# Specify your gem's dependencies in sec_id.gemspec
|
8
8
|
gemspec
|
9
|
+
|
10
|
+
# Specify your gem's development dependencies below
|
11
|
+
gem 'rake', '>= 13'
|
12
|
+
|
13
|
+
gem 'rspec', '~> 3.9'
|
14
|
+
gem 'rspec_junit_formatter'
|
15
|
+
|
16
|
+
gem 'rubocop', '~> 1.64'
|
17
|
+
gem 'rubocop-rspec', '~> 3.0'
|
18
|
+
|
19
|
+
gem 'simplecov', '~> 0.22', require: false
|
20
|
+
gem 'simplecov_json_formatter', require: false
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# SecId
|
2
2
|
[](https://badge.fury.io/rb/sec_id)
|
3
|
-
|
4
|
-
[](https://depfu.com/github/svyatov/sec_id?project_id=6878)
|
3
|
+

|
5
4
|
[](https://codeclimate.com/github/svyatov/sec_id/maintainability)
|
6
5
|
[](https://codeclimate.com/github/svyatov/sec_id/test_coverage)
|
7
6
|
|
@@ -12,7 +11,9 @@ Check-digit calculation is also available.
|
|
12
11
|
Currently supported standards:
|
13
12
|
[ISIN](https://en.wikipedia.org/wiki/International_Securities_Identification_Number),
|
14
13
|
[CUSIP](https://en.wikipedia.org/wiki/CUSIP),
|
15
|
-
[SEDOL](https://en.wikipedia.org/wiki/SEDOL)
|
14
|
+
[SEDOL](https://en.wikipedia.org/wiki/SEDOL),
|
15
|
+
[FIGI](https://en.wikipedia.org/wiki/Financial_Instrument_Global_Identifier),
|
16
|
+
[CIK](https://en.wikipedia.org/wiki/Central_Index_Key).
|
16
17
|
|
17
18
|
Work in progress:
|
18
19
|
[IBAN](https://en.wikipedia.org/wiki/International_Bank_Account_Number).
|
@@ -22,7 +23,7 @@ Work in progress:
|
|
22
23
|
Add this line to your application's Gemfile:
|
23
24
|
|
24
25
|
```ruby
|
25
|
-
gem 'sec_id', '~>
|
26
|
+
gem 'sec_id', '~> 4.1'
|
26
27
|
```
|
27
28
|
|
28
29
|
And then execute:
|
@@ -116,6 +117,7 @@ isin.valid? # => true
|
|
116
117
|
isin.valid_format? # => true
|
117
118
|
isin.restore! # => 'US5949181045'
|
118
119
|
isin.calculate_check_digit # => 5
|
120
|
+
isin.to_cusip # => #<SecId::CUSIP>
|
119
121
|
```
|
120
122
|
|
121
123
|
### SecId::CUSIP full example
|
@@ -137,6 +139,8 @@ cusip.valid? # => true
|
|
137
139
|
cusip.valid_format? # => true
|
138
140
|
cusip.restore! # => '594918104'
|
139
141
|
cusip.calculate_check_digit # => 4
|
142
|
+
cusip.to_isin('US') # => #<SecId::ISIN>
|
143
|
+
cusip.cins? # => true
|
140
144
|
```
|
141
145
|
|
142
146
|
### SecId::SEDOL full example
|
@@ -158,6 +162,48 @@ cusip.restore! # => 'B0Z52W5'
|
|
158
162
|
cusip.calculate_check_digit # => 5
|
159
163
|
```
|
160
164
|
|
165
|
+
### SecId::FIGI full example
|
166
|
+
|
167
|
+
```ruby
|
168
|
+
# class level
|
169
|
+
SecId::FIGI.valid?('BBG000DMBXR2') # => true
|
170
|
+
SecId::FIGI.valid_format?('BBG000DMBXR2') # => true
|
171
|
+
SecId::FIGI.restore!('BBG000DMBXR') # => 'BBG000DMBXR2'
|
172
|
+
SecId::FIGI.check_digit('BBG000DMBXR') # => 2
|
173
|
+
|
174
|
+
# instance level
|
175
|
+
figi = SecId::FIGI.new('BBG000DMBXR2')
|
176
|
+
figi.full_number # => 'BBG000DMBXR2'
|
177
|
+
figi.prefix # => 'BB'
|
178
|
+
figi.random_part # => '000DMBXR'
|
179
|
+
figi.check_digit # => 2
|
180
|
+
figi.valid? # => true
|
181
|
+
figi.valid_format? # => true
|
182
|
+
figi.restore! # => 'BBG000DMBXR2'
|
183
|
+
figi.calculate_check_digit # => 2
|
184
|
+
```
|
185
|
+
|
186
|
+
### SecId::CIK full example
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
# class level
|
190
|
+
SecId::CIK.valid?('0001094517') # => true
|
191
|
+
SecId::CIK.valid_format?('0001094517') # => true
|
192
|
+
SecId::CIK.restore!('1094517') # => '0001094517'
|
193
|
+
SecId::CIK.check_digit('0001094517') # raises NotImplementedError
|
194
|
+
|
195
|
+
# instance level
|
196
|
+
cik = SecId::CIK.new('0001094517')
|
197
|
+
cik.full_number # => '0001094517'
|
198
|
+
cik.padding # => '000'
|
199
|
+
cik.identifier # => '1094517'
|
200
|
+
cik.valid? # => true
|
201
|
+
cik.valid_format? # => true
|
202
|
+
cik.restore! # => '0001094517'
|
203
|
+
cik.calculate_check_digit # raises NotImplementedError
|
204
|
+
cik.check_digit # => nil
|
205
|
+
```
|
206
|
+
|
161
207
|
## Development
|
162
208
|
|
163
209
|
After checking out the repo, run `bin/setup` to install dependencies.
|
data/lib/sec_id/base.rb
CHANGED
@@ -26,20 +26,22 @@ module SecId
|
|
26
26
|
class Base
|
27
27
|
attr_reader :full_number, :identifier, :check_digit
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
class << self
|
30
|
+
def valid?(id)
|
31
|
+
new(id).valid?
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
def valid_format?(id)
|
35
|
+
new(id).valid_format?
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
def restore!(id_without_check_digit)
|
39
|
+
new(id_without_check_digit).restore!
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
def check_digit(id)
|
43
|
+
new(id).calculate_check_digit
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
def initialize(_sec_id_number)
|
@@ -89,11 +91,11 @@ module SecId
|
|
89
91
|
SecId::CHAR_TO_DIGIT.fetch(char)
|
90
92
|
end
|
91
93
|
|
92
|
-
def
|
94
|
+
def mod10(sum)
|
93
95
|
(10 - (sum % 10)) % 10
|
94
96
|
end
|
95
97
|
|
96
|
-
def
|
98
|
+
def div10mod10(number)
|
97
99
|
(number / 10) + (number % 10)
|
98
100
|
end
|
99
101
|
end
|
data/lib/sec_id/cik.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SecId
|
4
|
+
# https://en.wikipedia.org/wiki/Central_Index_Key
|
5
|
+
class CIK < Base
|
6
|
+
ID_REGEX = /\A
|
7
|
+
(?=\d{1,10}\z)(?<padding>0*)(?<identifier>[1-9]\d{0,9})
|
8
|
+
\z/x
|
9
|
+
|
10
|
+
attr_reader :padding
|
11
|
+
|
12
|
+
def initialize(cik)
|
13
|
+
cik_parts = parse cik
|
14
|
+
@padding = cik_parts[:padding]
|
15
|
+
@identifier = cik_parts[:identifier]
|
16
|
+
end
|
17
|
+
|
18
|
+
def valid?
|
19
|
+
valid_format?
|
20
|
+
end
|
21
|
+
|
22
|
+
def valid_format?
|
23
|
+
!identifier.nil?
|
24
|
+
end
|
25
|
+
|
26
|
+
def restore!
|
27
|
+
raise InvalidFormatError, "CIK '#{full_number}' is invalid and cannot be restored!" unless valid_format?
|
28
|
+
|
29
|
+
@padding = '0' * (10 - @identifier.length)
|
30
|
+
@full_number = @identifier.rjust(10, '0')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/sec_id/cusip.rb
CHANGED
@@ -8,7 +8,7 @@ module SecId
|
|
8
8
|
(?<cusip6>[A-Z0-9]{5}[A-Z0-9*@#])
|
9
9
|
(?<issue>[A-Z0-9*@#]{2}))
|
10
10
|
(?<check_digit>\d)?
|
11
|
-
\z/x
|
11
|
+
\z/x
|
12
12
|
|
13
13
|
attr_reader :cusip6, :issue
|
14
14
|
|
@@ -21,27 +21,41 @@ module SecId
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def calculate_check_digit
|
24
|
-
|
24
|
+
unless valid_format?
|
25
|
+
raise InvalidFormatError, "CUSIP '#{full_number}' is invalid and check-digit cannot be calculated!"
|
26
|
+
end
|
27
|
+
|
28
|
+
mod10(modified_luhn_sum)
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_isin(country_code)
|
32
|
+
unless ISIN::CGS_COUNTRY_CODES.include?(country_code)
|
33
|
+
raise(InvalidFormatError, "'#{country_code}' is not a CGS country code!")
|
34
|
+
end
|
25
35
|
|
26
|
-
|
36
|
+
restore!
|
37
|
+
isin = ISIN.new(country_code + full_number)
|
38
|
+
isin.restore!
|
39
|
+
isin
|
40
|
+
end
|
41
|
+
|
42
|
+
# CUSIP International Numbering System
|
43
|
+
def cins?
|
44
|
+
cusip6[0] < '0' || cusip6[0] > '9'
|
27
45
|
end
|
28
46
|
|
29
47
|
private
|
30
48
|
|
31
49
|
# https://en.wikipedia.org/wiki/Luhn_algorithm
|
32
50
|
def modified_luhn_sum
|
33
|
-
sum
|
34
|
-
|
35
|
-
id_digits.reverse.each_slice(2) do |even, odd|
|
51
|
+
reversed_id_digits.each_slice(2).reduce(0) do |sum, (even, odd)|
|
36
52
|
double_even = (even || 0) * 2
|
37
|
-
sum
|
53
|
+
sum + div10mod10(double_even) + div10mod10(odd || 0)
|
38
54
|
end
|
39
|
-
|
40
|
-
sum
|
41
55
|
end
|
42
56
|
|
43
|
-
def
|
44
|
-
|
57
|
+
def reversed_id_digits
|
58
|
+
identifier.each_char.map(&method(:char_to_digit)).reverse!
|
45
59
|
end
|
46
60
|
end
|
47
61
|
end
|
data/lib/sec_id/figi.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'set'
|
4
|
+
|
5
|
+
module SecId
|
6
|
+
class FIGI < Base
|
7
|
+
ID_REGEX = /\A
|
8
|
+
(?<identifier>
|
9
|
+
(?<prefix>[B-DF-HJ-NP-TV-Z0-9]{2})
|
10
|
+
G
|
11
|
+
(?<random_part>[B-DF-HJ-NP-TV-Z0-9]{8}))
|
12
|
+
(?<check_digit>\d)?
|
13
|
+
\z/x
|
14
|
+
|
15
|
+
RESTRICTED_PREFIXES = Set.new %w[BS BM GG GB GH KY VG]
|
16
|
+
|
17
|
+
attr_reader :prefix, :random_part
|
18
|
+
|
19
|
+
def initialize(figi)
|
20
|
+
figi_parts = parse figi
|
21
|
+
@identifier = figi_parts[:identifier]
|
22
|
+
@prefix = figi_parts[:prefix]
|
23
|
+
@random_part = figi_parts[:random_part]
|
24
|
+
@check_digit = figi_parts[:check_digit]&.to_i
|
25
|
+
end
|
26
|
+
|
27
|
+
def valid_format?
|
28
|
+
!identifier.nil? && !RESTRICTED_PREFIXES.include?(prefix)
|
29
|
+
end
|
30
|
+
|
31
|
+
def calculate_check_digit
|
32
|
+
unless valid_format?
|
33
|
+
raise InvalidFormatError, "FIGI '#{full_number}' is invalid and check-digit cannot be calculated!"
|
34
|
+
end
|
35
|
+
|
36
|
+
mod10(modified_luhn_sum)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
# https://en.wikipedia.org/wiki/Luhn_algorithm
|
42
|
+
def modified_luhn_sum
|
43
|
+
reversed_id_digits.each_with_index.reduce(0) do |sum, (digit, index)|
|
44
|
+
digit *= 2 if index.odd?
|
45
|
+
sum + digit.divmod(10).sum
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def reversed_id_digits
|
50
|
+
identifier.each_char.map(&method(:char_to_digit)).reverse!
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/sec_id/isin.rb
CHANGED
@@ -8,7 +8,15 @@ module SecId
|
|
8
8
|
(?<country_code>[A-Z]{2})
|
9
9
|
(?<nsin>[A-Z0-9]{9}))
|
10
10
|
(?<check_digit>\d)?
|
11
|
-
\z/x
|
11
|
+
\z/x
|
12
|
+
|
13
|
+
CGS_COUNTRY_CODES = Set.new(
|
14
|
+
%w[
|
15
|
+
US CA AG AI AN AR AS AW BB BL BM BO BQ BR BS BZ CL CO CR CW DM DO EC FM
|
16
|
+
GD GS GU GY HN HT JM KN KY LC MF MH MP MX NI PA PE PH PR PW PY SR SV SX
|
17
|
+
TT UM UY VC VE VG VI YT
|
18
|
+
]
|
19
|
+
).freeze
|
12
20
|
|
13
21
|
attr_reader :country_code, :nsin
|
14
22
|
|
@@ -21,28 +29,37 @@ module SecId
|
|
21
29
|
end
|
22
30
|
|
23
31
|
def calculate_check_digit
|
24
|
-
|
32
|
+
unless valid_format?
|
33
|
+
raise InvalidFormatError, "ISIN '#{full_number}' is invalid and check-digit cannot be calculated!"
|
34
|
+
end
|
25
35
|
|
26
|
-
|
36
|
+
mod10(luhn_sum)
|
37
|
+
end
|
38
|
+
|
39
|
+
# CUSIP Global Services
|
40
|
+
def cgs?
|
41
|
+
CGS_COUNTRY_CODES.include?(country_code)
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_cusip
|
45
|
+
raise InvalidFormatError, "'#{country_code}' is not a CGS country code!" unless cgs?
|
46
|
+
|
47
|
+
CUSIP.new(nsin)
|
27
48
|
end
|
28
49
|
|
29
50
|
private
|
30
51
|
|
31
52
|
# https://en.wikipedia.org/wiki/Luhn_algorithm
|
32
53
|
def luhn_sum
|
33
|
-
sum
|
34
|
-
|
35
|
-
id_digits.reverse.each_slice(2) do |even, odd|
|
54
|
+
reversed_id_digits.each_slice(2).reduce(0) do |sum, (even, odd)|
|
36
55
|
double_even = (even || 0) * 2
|
37
56
|
double_even -= 9 if double_even > 9
|
38
|
-
sum
|
57
|
+
sum + double_even + (odd || 0)
|
39
58
|
end
|
40
|
-
|
41
|
-
sum
|
42
59
|
end
|
43
60
|
|
44
|
-
def
|
45
|
-
|
61
|
+
def reversed_id_digits
|
62
|
+
identifier.each_char.flat_map(&method(:char_to_digits)).reverse!
|
46
63
|
end
|
47
64
|
end
|
48
65
|
end
|
data/lib/sec_id/sedol.rb
CHANGED
@@ -6,7 +6,7 @@ module SecId
|
|
6
6
|
ID_REGEX = /\A
|
7
7
|
(?<identifier>[0-9BCDFGHJKLMNPQRSTVWXYZ]{6})
|
8
8
|
(?<check_digit>\d)?
|
9
|
-
\z/x
|
9
|
+
\z/x
|
10
10
|
|
11
11
|
CHARACTER_WEIGHTS = [1, 3, 1, 7, 3, 9].freeze
|
12
12
|
|
@@ -17,9 +17,11 @@ module SecId
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def calculate_check_digit
|
20
|
-
|
20
|
+
unless valid_format?
|
21
|
+
raise InvalidFormatError, "SEDOL '#{full_number}' is invalid and check-digit cannot be calculated!"
|
22
|
+
end
|
21
23
|
|
22
|
-
|
24
|
+
mod10(weighted_sum)
|
23
25
|
end
|
24
26
|
|
25
27
|
private
|
data/lib/sec_id/version.rb
CHANGED
data/lib/sec_id.rb
CHANGED
data/sec_id.gemspec
CHANGED
@@ -15,17 +15,12 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.homepage = 'https://github.com/svyatov/sec_id'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
|
-
spec.required_ruby_version = '>=
|
18
|
+
spec.required_ruby_version = '>= 3.1.0'
|
19
19
|
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
22
22
|
f.match(%r{^(test|spec|features)/})
|
23
23
|
end
|
24
24
|
|
25
|
-
spec.
|
26
|
-
spec.add_development_dependency 'rake', '>= 10.0'
|
27
|
-
spec.add_development_dependency 'rspec', '~> 3.9'
|
28
|
-
spec.add_development_dependency 'rubocop', '~> 0.80.1'
|
29
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.38'
|
30
|
-
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
25
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
31
26
|
end
|
metadata
CHANGED
@@ -1,99 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sec_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Svyatov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.16'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.16'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.9'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.9'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.80.1
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.80.1
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.38'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.38'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.17.1
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.17.1
|
11
|
+
date: 2024-09-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
97
13
|
description: 'Validate securities identification numbers with ease! Currently supported
|
98
14
|
standards: ISIN, CUSIP, SEDOL.'
|
99
15
|
email:
|
@@ -102,10 +18,11 @@ executables: []
|
|
102
18
|
extensions: []
|
103
19
|
extra_rdoc_files: []
|
104
20
|
files:
|
21
|
+
- ".github/dependabot.yml"
|
22
|
+
- ".github/workflows/main.yml"
|
105
23
|
- ".gitignore"
|
106
24
|
- ".rspec"
|
107
25
|
- ".rubocop.yml"
|
108
|
-
- ".travis.yml"
|
109
26
|
- CHANGELOG.md
|
110
27
|
- Gemfile
|
111
28
|
- LICENSE.txt
|
@@ -115,7 +32,9 @@ files:
|
|
115
32
|
- bin/setup
|
116
33
|
- lib/sec_id.rb
|
117
34
|
- lib/sec_id/base.rb
|
35
|
+
- lib/sec_id/cik.rb
|
118
36
|
- lib/sec_id/cusip.rb
|
37
|
+
- lib/sec_id/figi.rb
|
119
38
|
- lib/sec_id/isin.rb
|
120
39
|
- lib/sec_id/sedol.rb
|
121
40
|
- lib/sec_id/version.rb
|
@@ -123,8 +42,9 @@ files:
|
|
123
42
|
homepage: https://github.com/svyatov/sec_id
|
124
43
|
licenses:
|
125
44
|
- MIT
|
126
|
-
metadata:
|
127
|
-
|
45
|
+
metadata:
|
46
|
+
rubygems_mfa_required: 'true'
|
47
|
+
post_install_message:
|
128
48
|
rdoc_options: []
|
129
49
|
require_paths:
|
130
50
|
- lib
|
@@ -132,15 +52,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
52
|
requirements:
|
133
53
|
- - ">="
|
134
54
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
55
|
+
version: 3.1.0
|
136
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
57
|
requirements:
|
138
58
|
- - ">="
|
139
59
|
- !ruby/object:Gem::Version
|
140
60
|
version: '0'
|
141
61
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
143
|
-
signing_key:
|
62
|
+
rubygems_version: 3.5.15
|
63
|
+
signing_key:
|
144
64
|
specification_version: 4
|
145
65
|
summary: Validate securities identification numbers with ease!
|
146
66
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
---
|
2
|
-
sudo: false
|
3
|
-
cache: bundler
|
4
|
-
language: ruby
|
5
|
-
|
6
|
-
env:
|
7
|
-
global:
|
8
|
-
- CC_TEST_REPORTER_ID=48c33b2bc3ccdc6dafe9ed76482eca03cde47b922a7859074fc2be791247e5fd
|
9
|
-
|
10
|
-
rvm:
|
11
|
-
- 2.5
|
12
|
-
- 2.6
|
13
|
-
- 2.7
|
14
|
-
- ruby-head
|
15
|
-
- truffleruby
|
16
|
-
|
17
|
-
matrix:
|
18
|
-
allow_failures:
|
19
|
-
- rvm: ruby-head
|
20
|
-
- rvm: truffleruby
|
21
|
-
fast_finish: true
|
22
|
-
|
23
|
-
before_script:
|
24
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
25
|
-
- chmod +x ./cc-test-reporter
|
26
|
-
- ./cc-test-reporter before-build
|
27
|
-
|
28
|
-
script:
|
29
|
-
- bundle exec rake
|
30
|
-
|
31
|
-
after_script:
|
32
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|