sec_query 1.4.0 → 1.5.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
- SHA1:
3
- metadata.gz: 85944bfa167ef27d49aee0beaeed632b44a44fa0
4
- data.tar.gz: 536db81b013206c45038b8f10d697ffc4158621c
2
+ SHA256:
3
+ metadata.gz: e05c826068c7e3b70b62043aa111e83bd01118130116a9db4d6e7991ea923231
4
+ data.tar.gz: 38465104422bc0096f3c4a432f0b6801da6282e87c8f7e5e0e6468b7606f5d30
5
5
  SHA512:
6
- metadata.gz: baccb44f714eb163c13aa2f5313d8e6fd34794ee4cdb92bd386dc1c0e2c9e666475983d8662de49c8f99d42daf44a7bfbd429bfd00dd585140424770e3dc8295
7
- data.tar.gz: 26a9c698c541f28f980c7937921f761665c721ffb4c86021b42b89bfcf0e911d1adf7c925099e09919060b982a26bde7ac541b5f54343b7ffe013f9d9415b02c
6
+ metadata.gz: 538a894e0910434e9ed11c604485342919d6d9de42da73b3d86b2da57e1cd7b7b4b04bdeb51f405e5c1d5b7ff0e01eed6ae8e9eaa919c73ccc7af98af102a44f
7
+ data.tar.gz: 46ea472a4334afca91affa041ba5ee2bbc5879b9009c7ab2d27e05e2f884c056e77146e9ca88dbb9785c8774f4662b6c178e6995986f2a22a898307d754ef8ef
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.6', '2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rake
@@ -19,8 +19,8 @@ module SecQuery
19
19
  end
20
20
 
21
21
  def self.fetch(uri, &blk)
22
- open(uri) do |rss|
23
- parse_rss(rss, &blk)
22
+ RestClient::Request.execute(method: :get, url: uri.to_s, timeout: 10) do |response, request, result, &block|
23
+ parse_rss(response.body, &blk)
24
24
  end
25
25
  end
26
26
 
@@ -50,11 +50,10 @@ module SecQuery
50
50
  end
51
51
 
52
52
  def self.for_date(date, &blk)
53
- open(SecURI.for_date(date).to_s) do |file|
54
- filings_for_index(file.read).each(&blk)
53
+ url = SecURI.for_date(date).to_s
54
+ RestClient::Request.execute(method: :get, url: url, timeout: 10) do |response, request, result, &block|
55
+ filings_for_index(response.body).each(&blk)
55
56
  end
56
- rescue OpenURI::HTTPError
57
- return
58
57
  end
59
58
 
60
59
  def self.filings_for_index(index)
@@ -151,7 +150,7 @@ module SecQuery
151
150
  filings = []
152
151
  if document.xpath('//content').to_s.length > 0
153
152
  document.xpath('//content').each do |e|
154
- if e.xpath('//content/accession-nunber').to_s.length > 0
153
+ if e.xpath('//content/accession-number').to_s.length > 0
155
154
  content = Hash.from_xml(e.to_s)['content']
156
155
  content[:cik] = cik
157
156
  content[:file_id] = content.delete('accession_nunber')
@@ -15,7 +15,8 @@ module SecQuery
15
15
  end
16
16
 
17
17
  def self.fetch(uri)
18
- document = Nokogiri::HTML(open(uri.gsub('http:', 'https:')))
18
+ response = RestClient::Request.execute(method: :get, url: uri.to_s.gsub('http:', 'https:'), timeout: 10)
19
+ document = Nokogiri::HTML(response.body)
19
20
  filing_date = document.xpath('//*[@id="formDiv"]/div[2]/div[1]/div[2]').text
20
21
  accepted_date = document.xpath('//*[@id="formDiv"]/div[2]/div[1]/div[4]').text
21
22
  period_of_report = document.xpath('//*[@id="formDiv"]/div[2]/div[2]/div[2]').text
@@ -49,7 +49,7 @@ module SecQuery
49
49
  begin Float(string_arg)
50
50
  options[:CIK] = string_arg
51
51
  rescue
52
- if string_arg.length <= 4
52
+ if string_arg.length <= 5
53
53
  options[:CIK] = string_arg
54
54
  else
55
55
  options[:company] = string_arg.gsub(/[(,?!\''"":.)]/, '')
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
  # => SecQuery::VERSION
3
3
  module SecQuery
4
- VERSION = "1.4.0"
4
+ VERSION = "1.5.0"
5
5
  end
data/sec_query.gemspec CHANGED
@@ -19,15 +19,15 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ['lib']
21
21
 
22
- s.add_development_dependency 'bundler', '~> 2.0.1'
22
+ s.add_development_dependency 'bundler', '~> 2.2.14'
23
23
  s.add_development_dependency 'rake'
24
- s.add_development_dependency 'rspec', '~> 3.5'
25
- s.add_development_dependency 'vcr', '~> 3.0'
26
- s.add_development_dependency 'webmock', '~> 2.3'
27
- s.add_development_dependency 'rubocop', '~> 0.52'
28
- s.add_development_dependency 'byebug', '~> 9.0'
29
- s.add_runtime_dependency 'rest-client', '~> 2.0'
30
- s.add_runtime_dependency 'addressable', '~> 2.5'
31
- s.add_runtime_dependency 'nokogiri', '>= 1.8.5'
32
- s.add_runtime_dependency 'activesupport', '>= 0'
24
+ s.add_development_dependency 'rspec', '~> 3.10'
25
+ s.add_development_dependency 'vcr', '~> 6.0'
26
+ s.add_development_dependency 'webmock', '~> 3.12'
27
+ s.add_development_dependency 'rubocop', '~> 1.11'
28
+ s.add_runtime_dependency 'rest-client', '~> 2.1.0'
29
+ s.add_runtime_dependency 'addressable', '~> 2.7'
30
+ s.add_runtime_dependency 'nokogiri', '~> 1'
31
+ s.add_runtime_dependency 'activesupport', '~> 5.2'
32
+ s.add_runtime_dependency 'rss', '~> 0.2'
33
33
  end
@@ -7,7 +7,7 @@ describe SecQuery::Entity do
7
7
 
8
8
  describe "Company Queries", vcr: { cassette_name: "aapl"} do
9
9
 
10
- let(:query){{name: "APPLE INC", sic: "3571", symbol: "aapl", cik:"0000320193"}}
10
+ let(:query){{name: "Apple Inc.", sic: "3571", symbol: "aapl", cik:"0000320193"}}
11
11
 
12
12
  [:symbol, :cik, :name].each do |key|
13
13
  context "when quering by #{key}" do
@@ -37,7 +37,40 @@ describe SecQuery::Entity do
37
37
  end
38
38
  end
39
39
  end
40
-
40
+
41
+ describe "Company Queries - Alphabet Inc.", vcr: { cassette_name: "googl"} do
42
+
43
+ let(:query){{name: "Alphabet Inc.", sic: "7370", symbol: "googl", cik:"0001652044"}}
44
+
45
+ [:symbol, :cik, :name].each do |key|
46
+ context "when quering by #{key}" do
47
+ describe "as hash" do
48
+
49
+ let(:entity){ SecQuery::Entity.find({ key => query[key] }) }
50
+
51
+ it "should be valid" do
52
+ is_valid?(entity)
53
+ end
54
+
55
+ it "should have a valid mailing address" do
56
+ is_valid_address?(entity.mailing_address)
57
+ end
58
+
59
+ it "should have a valid business address" do
60
+ is_valid_address?(entity.business_address)
61
+ end
62
+ end
63
+
64
+ describe "as string" do
65
+ it "should be valid" do
66
+ entity = SecQuery::Entity.find(query[key])
67
+ is_valid?(entity)
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+
41
74
  describe "People Queries", vcr: { cassette_name: "Steve Jobs"} do
42
75
 
43
76
  let(:query){ { name: "JOBS STEVEN P", :cik => "0001007844" } }
@@ -28,10 +28,10 @@ describe SecQuery::SecURI do
28
28
  .to eq('https://www.sec.gov/cgi-bin/browse-edgar?CIK=AAPL')
29
29
  end
30
30
 
31
- it 'builds a default /browse-edgar/ url with options: "Apple"' do
32
- uri = SecQuery::SecURI.browse_edgar_uri('Apple')
31
+ it 'builds a default /browse-edgar/ url with options: "Apple Inc"' do
32
+ uri = SecQuery::SecURI.browse_edgar_uri('Apple Inc')
33
33
  expect(uri.to_s)
34
- .to eq('https://www.sec.gov/cgi-bin/browse-edgar?company=Apple')
34
+ .to eq('https://www.sec.gov/cgi-bin/browse-edgar?company=Apple%20Inc')
35
35
  end
36
36
  end
37
37
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sec_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ty Rauber
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-29 00:00:00.000000000 Z
11
+ date: 2021-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.1
19
+ version: 2.2.14
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.1
26
+ version: 2.2.14
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,126 +44,126 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.5'
47
+ version: '3.10'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.5'
54
+ version: '3.10'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: vcr
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: '6.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
68
+ version: '6.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2.3'
75
+ version: '3.12'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '2.3'
82
+ version: '3.12'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.52'
89
+ version: '1.11'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.52'
96
+ version: '1.11'
97
97
  - !ruby/object:Gem::Dependency
98
- name: byebug
98
+ name: rest-client
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '9.0'
104
- type: :development
103
+ version: 2.1.0
104
+ type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '9.0'
110
+ version: 2.1.0
111
111
  - !ruby/object:Gem::Dependency
112
- name: rest-client
112
+ name: addressable
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.0'
117
+ version: '2.7'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '2.0'
124
+ version: '2.7'
125
125
  - !ruby/object:Gem::Dependency
126
- name: addressable
126
+ name: nokogiri
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '2.5'
131
+ version: '1'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '2.5'
138
+ version: '1'
139
139
  - !ruby/object:Gem::Dependency
140
- name: nokogiri
140
+ name: activesupport
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.8.5
145
+ version: '5.2'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.8.5
152
+ version: '5.2'
153
153
  - !ruby/object:Gem::Dependency
154
- name: activesupport
154
+ name: rss
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: '0.2'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: '0.2'
167
167
  description: Search for company or person, by name, symbol or Central Index Key (CIK),
168
168
  and retrieve filings.
169
169
  email:
@@ -172,8 +172,8 @@ executables: []
172
172
  extensions: []
173
173
  extra_rdoc_files: []
174
174
  files:
175
+ - ".github/workflows/ruby.yml"
175
176
  - ".gitignore"
176
- - ".travis.yml"
177
177
  - Gemfile
178
178
  - README.md
179
179
  - Rakefile
@@ -193,7 +193,7 @@ homepage: https://github.com/tyrauber/sec_query
193
193
  licenses:
194
194
  - MIT
195
195
  metadata: {}
196
- post_install_message:
196
+ post_install_message:
197
197
  rdoc_options: []
198
198
  require_paths:
199
199
  - lib
@@ -208,9 +208,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
210
  requirements: []
211
- rubyforge_project: sec_query
212
- rubygems_version: 2.6.14
213
- signing_key:
211
+ rubygems_version: 3.0.6
212
+ signing_key:
214
213
  specification_version: 4
215
214
  summary: A ruby gem for querying the United States Securities and Exchange Commission
216
215
  Edgar System.
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- bundler_args: ''
4
- rvm:
5
- - 2.5.1
6
- - 2.4.4
7
- - 2.3.4
8
- - 2.3.7
9
- before_install:
10
- - gem install bundler --version '~> 2.0.1'
11
-