sec_query 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +17 -0
- data/Rakefile +1 -1
- data/lib/sec_query.rb +14 -9
- data/lib/sec_query/entity.rb +285 -291
- data/lib/sec_query/filing.rb +45 -40
- data/lib/sec_query/relationship.rb +67 -58
- data/lib/sec_query/sec_uri.rb +98 -0
- data/lib/sec_query/transaction.rb +99 -82
- data/lib/sec_query/version.rb +3 -1
- data/sec_query.gemspec +17 -15
- data/spec/sec_query_spec.rb +84 -64
- data/spec/sec_uri_spec.rb +37 -0
- data/spec/spec_helper.rb +6 -1
- data/spec/support/vcr.rb +10 -0
- metadata +58 -6
- data/Gemfile.lock +0 -30
- data/lib/.DS_Store +0 -0
- data/lib/sec_query/.DS_Store +0 -0
data/lib/sec_query/version.rb
CHANGED
data/sec_query.gemspec
CHANGED
@@ -1,27 +1,29 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require 'sec_query/version'
|
5
|
+
require 'sec_query'
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name =
|
8
|
+
s.name = 'sec_query'
|
9
9
|
s.version = SecQuery::VERSION
|
10
|
-
s.authors = [
|
11
|
-
s.email = [
|
12
|
-
s.homepage =
|
13
|
-
s.summary =
|
14
|
-
s.description =
|
15
|
-
|
16
|
-
s.rubyforge_project = "sec_query"
|
10
|
+
s.authors = ['Ty Rauber']
|
11
|
+
s.email = ['tyrauber@mac.com']
|
12
|
+
s.homepage = 'https://github.com/tyrauber/sec_query'
|
13
|
+
s.summary = 'A ruby gem for querying the United States Securities and Exchange Commission Edgar System.'
|
14
|
+
s.description = 'Search for company or person, by name, symbol or Central Index Key (CIK), and retrieve relationships, transactions and filings.'
|
17
15
|
|
16
|
+
s.rubyforge_project = 'sec_query'
|
18
17
|
s.files = `git ls-files`.split("\n")
|
19
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
-
s.require_paths = [
|
20
|
+
s.require_paths = ['lib']
|
22
21
|
|
23
22
|
# specify any dependencies here; for example:
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
s.add_development_dependency 'rspec', '>= 2.14'
|
24
|
+
s.add_development_dependency 'vcr'
|
25
|
+
s.add_development_dependency 'webmock'
|
26
|
+
s.add_development_dependency 'rubocop'
|
27
|
+
s.add_runtime_dependency 'rest-client'
|
28
|
+
s.add_runtime_dependency 'hpricot'
|
27
29
|
end
|
data/spec/sec_query_spec.rb
CHANGED
@@ -1,105 +1,125 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
include SecQuery
|
4
|
+
require 'spec_helper'
|
2
5
|
|
3
6
|
describe SecQuery::Entity do
|
4
|
-
puts "SecQuery Tests for all methods listed in the readme"
|
5
7
|
|
6
|
-
describe
|
8
|
+
describe 'Company Queries', vcr: { cassette_name: 'aapl' } do
|
7
9
|
|
8
|
-
let(:apple)
|
10
|
+
let(:apple) do
|
11
|
+
{ name: 'APPLE INC', sic: '3571', symbol: 'aapl', cik: '0000320193' }
|
12
|
+
end
|
9
13
|
|
10
|
-
context
|
11
|
-
it
|
14
|
+
context 'when quering by stock symbol' do
|
15
|
+
it 'lazely' do
|
12
16
|
entity = SecQuery::Entity.find(apple[:symbol])
|
13
17
|
entity.cik.should eql(apple[:cik])
|
14
18
|
end
|
15
|
-
|
16
|
-
|
19
|
+
|
20
|
+
it 'explicitly' do
|
21
|
+
entity = SecQuery::Entity.find(symbol: apple[:symbol])
|
17
22
|
entity.cik.should eql(apple[:cik])
|
18
23
|
end
|
19
24
|
end
|
20
|
-
|
21
|
-
context
|
22
|
-
it
|
25
|
+
|
26
|
+
context 'when querying by entity name' do
|
27
|
+
it 'lazely' do
|
23
28
|
entity = SecQuery::Entity.find(apple[:name])
|
24
29
|
entity.cik.should eql(apple[:cik])
|
25
30
|
end
|
26
|
-
|
27
|
-
|
31
|
+
|
32
|
+
it 'explicitly' do
|
33
|
+
entity = SecQuery::Entity.find(name: apple[:name])
|
28
34
|
entity.cik.should eql(apple[:cik])
|
29
35
|
end
|
30
36
|
end
|
31
|
-
|
32
|
-
context
|
33
|
-
it
|
37
|
+
|
38
|
+
context 'when querying by cik' do
|
39
|
+
it 'lazely' do
|
34
40
|
entity = SecQuery::Entity.find(apple[:cik])
|
35
41
|
entity.name.should match(apple[:name])
|
36
42
|
end
|
37
|
-
|
38
|
-
|
43
|
+
|
44
|
+
it 'explicitly' do
|
45
|
+
entity = SecQuery::Entity.find(cik: apple[:cik])
|
39
46
|
entity.name.should match(apple[:name])
|
40
47
|
end
|
41
48
|
end
|
42
49
|
end
|
43
|
-
|
44
|
-
describe
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
|
51
|
+
describe 'People Queries', vcr: { cassette_name: 'Steve Jobs' } do
|
52
|
+
let(:jobs) do
|
53
|
+
{ first: 'Steve', middle: 'P', last: 'Jobs', cik: '0001007844' }
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when querying by name' do
|
57
|
+
it 'first, middle and last name' do
|
58
|
+
entity = SecQuery::Entity.find(
|
59
|
+
first: jobs[:first],
|
60
|
+
middle: jobs[:middle],
|
61
|
+
last: jobs[:last])
|
51
62
|
entity.cik.should eql(jobs[:cik])
|
52
63
|
end
|
53
64
|
end
|
54
65
|
end
|
55
|
-
|
56
|
-
describe
|
57
|
-
|
66
|
+
|
67
|
+
describe 'Relationships, Transactions and Filings', vcr: { cassette_name: 'Steve Jobs' } do
|
58
68
|
## Using Steve, because data should not change in the future. RIP.
|
59
|
-
|
60
|
-
let(:jobs)
|
61
|
-
first:
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
69
|
+
|
70
|
+
let(:jobs) do
|
71
|
+
{ first: 'Steve', middle: 'P', last: 'Jobs', cik: '0001007844',
|
72
|
+
relationships: [
|
73
|
+
{ cik: '0000320193', name: 'APPLE INC' },
|
74
|
+
{ cik: '0001001039', name: 'WALT DISNEY CO/' },
|
75
|
+
{ cik: '0001002114', name: 'PIXAR \\CA\\' }
|
76
|
+
],
|
77
|
+
transactions: [
|
78
|
+
{ filing_number: '0001181431-07-052839', reporting_owner: 'APPLE INC', shares: 120000.0 },
|
79
|
+
{ filing_number: '0001181431-07-052839', reporting_owner: 'APPLE INC', shares: 40000.0 },
|
80
|
+
{ filing_number: '0001181431-07-052839', reporting_owner: 'APPLE INC', shares: 40000.0 },
|
81
|
+
{ filing_number: '0001181431-07-052839', reporting_owner: 'APPLE INC', shares: 40000.0 },
|
82
|
+
{ filing_number: '0001181431-06-028746', reporting_owner: 'WALT DISNEY CO/', shares: 138000004.0 },
|
83
|
+
{ filing_number: '0001356184-06-000008', reporting_owner: 'PIXAR \\CA\\', shares: 60000002.0 },
|
84
|
+
{ filing_number: '0001181431-06-019230', reporting_owner: 'APPLE COMPUTER INC', shares: 4573553.0 },
|
85
|
+
{ filing_number: '0001181431-06-028747', reporting_owner: 'WALT DISNEY CO/', shares: 0.0 }
|
86
|
+
],
|
87
|
+
filings: [
|
88
|
+
{ cik: '0001007844', file_id: '0001181431-07-052839' },
|
89
|
+
{ cik: '0001007844', file_id: '0001356184-06-000008' },
|
90
|
+
{ cik: '0001007844', file_id: '0001193125-06-103741' },
|
91
|
+
{ cik: '0001007844', file_id: '0001181431-06-028747' },
|
92
|
+
{ cik: '0001007844', file_id: '0001181431-06-028746' },
|
93
|
+
{ cik: '0001007844', file_id: '0001181431-06-019230' },
|
94
|
+
{ cik: '0001007844', file_id: '0001193125-06-019727' },
|
95
|
+
{ cik: '0001007844', file_id: '0001104659-03-004723' }
|
96
|
+
]
|
97
|
+
}
|
98
|
+
end
|
99
|
+
|
100
|
+
let(:entity) do
|
101
|
+
SecQuery::Entity.find(
|
102
|
+
{ first: 'Steve',
|
103
|
+
middle: 'P',
|
104
|
+
last: 'Jobs',
|
105
|
+
cik: '0001007844' },
|
106
|
+
true)
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'when quering entities with option "true"' do
|
110
|
+
it 'should provide relationships' do
|
93
111
|
entity.relationships.each_with_index do |r, i|
|
94
112
|
r.cik.should eql(jobs[:relationships][i][:cik])
|
95
113
|
end
|
96
114
|
end
|
97
|
-
|
115
|
+
|
116
|
+
it 'should provide transactions' do
|
98
117
|
entity.transactions.each_with_index do |t, i|
|
99
118
|
t.filing_number.should eql(jobs[:transactions][i][:filing_number])
|
100
119
|
end
|
101
120
|
end
|
102
|
-
|
121
|
+
|
122
|
+
it 'should provide filings' do
|
103
123
|
entity.filings.each_with_index do |f, i|
|
104
124
|
f.file_id.should eql(jobs[:filings][i][:file_id])
|
105
125
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
include SecQuery
|
4
|
+
require 'spec_helper'
|
5
|
+
|
6
|
+
describe SecQuery::SecURI do
|
7
|
+
describe '#browse_edgar_uri' do
|
8
|
+
it 'builds a default /browse-edgar/ url' do
|
9
|
+
uri = SecQuery::SecURI.browse_edgar_uri
|
10
|
+
expect(uri.to_s).to eq('http://www.sec.gov/cgi-bin/browse-edgar')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'builds a default /browse-edgar/ url with options: {symbol: "AAPL"}' do
|
14
|
+
uri = SecQuery::SecURI.browse_edgar_uri(symbol: 'AAPL')
|
15
|
+
expect(uri.to_s)
|
16
|
+
.to include('http://www.sec.gov/cgi-bin/browse-edgar?CIK=AAPL')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'builds a default /browse-edgar/ url with options: {cik: "AAPL"}' do
|
20
|
+
uri = SecQuery::SecURI.browse_edgar_uri(cik: 'AAPL')
|
21
|
+
expect(uri.to_s)
|
22
|
+
.to include('http://www.sec.gov/cgi-bin/browse-edgar?CIK=AAPL')
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'builds a default /browse-edgar/ url with options: "AAPL"' do
|
26
|
+
uri = SecQuery::SecURI.browse_edgar_uri('AAPL')
|
27
|
+
expect(uri.to_s)
|
28
|
+
.to eq('http://www.sec.gov/cgi-bin/browse-edgar?CIK=AAPL')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'builds a default /browse-edgar/ url with options: "Apple"' do
|
32
|
+
uri = SecQuery::SecURI.browse_edgar_uri('Apple')
|
33
|
+
expect(uri.to_s)
|
34
|
+
.to eq('http://www.sec.gov/cgi-bin/browse-edgar?company=Apple')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/vcr.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sec_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,10 +9,58 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.14'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.14'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: vcr
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: webmock
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rubocop
|
16
64
|
requirement: !ruby/object:Gem::Requirement
|
17
65
|
none: false
|
18
66
|
requirements:
|
@@ -67,24 +115,25 @@ executables: []
|
|
67
115
|
extensions: []
|
68
116
|
extra_rdoc_files: []
|
69
117
|
files:
|
118
|
+
- .gitignore
|
70
119
|
- Gemfile
|
71
|
-
- Gemfile.lock
|
72
120
|
- README.md
|
73
121
|
- Rakefile
|
74
|
-
- lib/.DS_Store
|
75
122
|
- lib/sec_query.rb
|
76
|
-
- lib/sec_query/.DS_Store
|
77
123
|
- lib/sec_query/entity.rb
|
78
124
|
- lib/sec_query/filing.rb
|
79
125
|
- lib/sec_query/relationship.rb
|
126
|
+
- lib/sec_query/sec_uri.rb
|
80
127
|
- lib/sec_query/transaction.rb
|
81
128
|
- lib/sec_query/version.rb
|
82
129
|
- pkg/sec_query-1.0.1.gem
|
83
130
|
- pkg/sec_query-1.0.2.gem
|
84
|
-
- sec_query-1.0.3.gem
|
131
|
+
- pkg/sec_query-1.0.3.gem
|
85
132
|
- sec_query.gemspec
|
86
133
|
- spec/sec_query_spec.rb
|
134
|
+
- spec/sec_uri_spec.rb
|
87
135
|
- spec/spec_helper.rb
|
136
|
+
- spec/support/vcr.rb
|
88
137
|
homepage: https://github.com/tyrauber/sec_query
|
89
138
|
licenses: []
|
90
139
|
post_install_message:
|
@@ -112,4 +161,7 @@ summary: A ruby gem for querying the United States Securities and Exchange Commi
|
|
112
161
|
Edgar System.
|
113
162
|
test_files:
|
114
163
|
- spec/sec_query_spec.rb
|
164
|
+
- spec/sec_uri_spec.rb
|
115
165
|
- spec/spec_helper.rb
|
166
|
+
- spec/support/vcr.rb
|
167
|
+
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
sec_query (1.0.2)
|
5
|
-
hpricot
|
6
|
-
rest-client
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
diff-lcs (1.1.3)
|
12
|
-
hpricot (0.8.6)
|
13
|
-
mime-types (1.21)
|
14
|
-
rest-client (1.6.7)
|
15
|
-
mime-types (>= 1.16)
|
16
|
-
rspec (2.7.0)
|
17
|
-
rspec-core (~> 2.7.0)
|
18
|
-
rspec-expectations (~> 2.7.0)
|
19
|
-
rspec-mocks (~> 2.7.0)
|
20
|
-
rspec-core (2.7.1)
|
21
|
-
rspec-expectations (2.7.0)
|
22
|
-
diff-lcs (~> 1.1.2)
|
23
|
-
rspec-mocks (2.7.0)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
rspec
|
30
|
-
sec_query!
|
data/lib/.DS_Store
DELETED
Binary file
|
data/lib/sec_query/.DS_Store
DELETED
Binary file
|