sec_query 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sec_query (1.0.1)
4
+ sec_query (1.0.2)
5
5
  hpricot
6
6
  rest-client
7
7
 
@@ -9,8 +9,8 @@ GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
11
  diff-lcs (1.1.3)
12
- hpricot (0.8.5)
13
- mime-types (1.17.2)
12
+ hpricot (0.8.6)
13
+ mime-types (1.21)
14
14
  rest-client (1.6.7)
15
15
  mime-types (>= 1.16)
16
16
  rspec (2.7.0)
@@ -97,7 +97,7 @@ module SecQuery
97
97
  def self.cik(url, entity)
98
98
  response = Entity.query(url+"&output=atom")
99
99
  doc = Hpricot::XML(response)
100
- data = doc.search(:title)[0];
100
+ data = doc.search("//feed/title")[0];
101
101
  if data.inner_text == "EDGAR Search Results"
102
102
  tbl = doc.search("//span[@class='companyMatch']")
103
103
  if tbl && tbl.innerHTML != ""
@@ -1,3 +1,3 @@
1
1
  module SecQuery
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
Binary file
@@ -1,65 +1,109 @@
1
+ include SecQuery
1
2
 
2
- #cfr_directors = ["Carla A. Hills", "Robert E. Rubin", "Richard E. Salomon", "Richard N. Haass", "John P. Abizaid", "Peter Ackerman", "Fouad Ajami", "Madeleine K. Albright", "Alan S. Blinder", "Mary Boies", "David G. Bradley", "Tom Brokaw", "Sylvia Mathews Burwell", "Kenneth M. Duberstein", "Martin S. Feldstein", "Stephen Friedman","Ann M. Fudge", "Pamela Gann", "Thomas H. Glocer", "J. Tomilson Hill","Donna J. Hrinak", "Alberto Ibargüen", "Shirley Ann Jackson", "Henry R. Kravis", "Jami Miscik", "Joseph S. Nye", "James W. Owens", "Eduardo J. Padrón", "Colin L. Powell", "Penny Pritzker", "David M. Rubenstein", "George Rupp", "Frederick W. Smith", "Christine Todd Whitman", "Fareed Zakaria", "Leslie H. Gelb", "Maurice R. Greenberg", "Peter G. Peterson","David Rockefeller"]
3
+ describe SecQuery::Entity do
4
+ puts "SecQuery Tests for all methods listed in the readme"
3
5
 
4
-
6
+ describe "Company Queries" do
5
7
 
6
- cfr_directors = [
7
- {:middle=>"A", :first=>"Carla", :last=>"Hills", :cik_id=> "0001194913"},
8
- {:middle=>"E", :first=>"Robert", :last=>"Rubin", :cik_id=> "0001225178"},
9
- {:middle=>"E", :first=>"Richard", :last=>"Salomon", :cik_id => "0001217109"},
10
- {:middle=>"N", :first=>"Richard", :last=>"Haass", :cik_id => "0001123553"},
11
- {:middle=>"P", :first=>"John", :last=>"Abizaid", :cik_id => "0001425152"},
12
- {:first=>"Peter", :last=>"Ackerman", :cik_id => "0001111564"},
13
- {:first=>"Fouad", :last=>"Ajami"},
14
- {:middle=>"K", :first=>"Madeleine", :last=>"Albright"},
15
- {:middle=>"S", :first=>"Alan", :last=>"Blinder"},
16
- {:first=>"Mary", :last=>"Boies", :cik_id => "0001291933"},
17
- {:middle=>"G", :first=>"David", :last=>"Bradley", :cik_id=> "0001106734"},
18
- {:first=>"Tom", :last=>"Brokaw"},
19
- {:first=>"Sylvia", :last=>"Burwell"},
20
- {:middle=>"M", :first=>"Kenneth", :last=>"Duberstein", :cik_id=> "0001179625"},
21
- {:middle=>"S", :first=>"Martin", :last=>"Feldstein", :cik_id=> "0001236596"},
22
- {:first=>"Stephen", :last=>"Friedman", :cik_id=> "0001029607"},
23
- {:middle=>"M", :first=>"Ann", :last=>"Fudge", :cik_id=> "0001198098"},
24
- {:first=>"Pamela", :last=>"Gann"},
25
- {:middle=>"H", :first=>"Thomas", :last=>"Glocer", :cik_id=> "0001140799"},
26
- {:middle=>"J", :first=>"J.", :last=>"Hill"},
27
- {:middle=>"J", :first=>"Donna", :last=>"Hrinak", :cik_id=> "0001296811"},
28
- {:first=>"Alberto", :last=>"Ibarguen", :cik_id=> "0001339732"},
29
- {:first=>"Shirley", :last=>"Jackson", :cik_id=> "0001168019"},
30
- {:middle=>"R", :first=>"Henry", :last=>"Kravis", :cik_id=> "0001081714"},
31
- {:first=>"Jami", :last=>"Miscik"},
32
- {:middle=>"S", :first=>"Joseph", :last=>"Nye", :cik_id=> "0001299821"},
33
- {:middle=>"W", :first=>"James", :last=>"Owens", :cik_id=> "0001443909"},
34
- {:middle=>"J", :first=>"Eduardo", :last=>"Padron"},
35
- {:middle=>"L", :first=>"Colin", :last=>"Powell"},
36
- {:first=>"Penny", :last=>"Pritzker", :cik_id=> "0001087398"},
37
- {:middle=>"M", :first=>"David", :last=>"Rubenstein"},
38
- {:first=>"George", :last=>"Rupp"},
39
- {:middle=>"W", :first=>"Frederick", :last=>"Smith", :cik_id=> "0001033677"},
40
- {:first=>"Christine", :last=>"Whitman", :cik_id=> "0001271384"},
41
- {:first=>"Fareed", :last=>"Zakaria"},
42
- {:middle=>"H", :first=>"Leslie", :last=>"Gelb", :cik_id=> "0001240500"},
43
- {:middle=>"R", :first=>"Maurice", :last=>"Greenberg", :cik_id=> "0001236599"},
44
- {:middle=>"G", :first=>"Peter", :last=>"Peterson", :cik_id=> "0001070843"},
45
- {:first=>"David", :last=>"Rockefeller", :cik_id=> "0001204357"}
46
- ]
8
+ let(:apple){{name: "APPLE INC",sic: "3571", symbol: "aapl", cik:"0000320193"}}
47
9
 
48
- include SecQuery
10
+ context "when quering by stock symbol" do
11
+ it "lazely" do
12
+ entity = SecQuery::Entity.find(apple[:symbol])
13
+ entity.cik.should eql(apple[:cik])
14
+ end
15
+ it "explicitly" do
16
+ entity = SecQuery::Entity.find({:symbol=> apple[:symbol]})
17
+ entity.cik.should eql(apple[:cik])
18
+ end
19
+ end
20
+
21
+ context "when querying by entity name" do
22
+ it "lazely" do
23
+ entity = SecQuery::Entity.find(apple[:name])
24
+ entity.cik.should eql(apple[:cik])
25
+ end
26
+ it "explicitly" do
27
+ entity = SecQuery::Entity.find({:name=> apple[:name]})
28
+ entity.cik.should eql(apple[:cik])
29
+ end
30
+ end
31
+
32
+ context "when querying by cik" do
33
+ it "lazely" do
34
+ entity = SecQuery::Entity.find(apple[:cik])
35
+ entity.name.should match(apple[:name])
36
+ end
37
+ it "explicitly" do
38
+ entity = SecQuery::Entity.find({:cik=> apple[:cik]})
39
+ entity.name.should match(apple[:name])
40
+ end
41
+ end
42
+ end
43
+
44
+ describe "People Queries" do
49
45
 
50
- describe SecQuery::Entity do
51
- puts "\n\nCOUNCIL ON FOREIGN RELATIONS' DIRECTORS\nAs perceived by the Security and Exchange Commission Edgar System:\n"
52
- for t in cfr_directors
53
- entity = SecQuery::Entity.find(t, true)
54
- # entity = SecQuery::Entity.find(t, true, {:start => 0, :count => 20, :limit => 20}, {:start => 0, :count => 20, :limit => 20})
55
- if entity != false
56
- Entity.log(entity)
57
- it t[:cik].to_s+" is company "+entity.name.to_s do
58
- if t[:cik] != nil
59
- entity.cik.should eql(t[:cik_id])
60
- end
61
-
62
- end
46
+ let(:jobs){{first: "Steve", middle: "P", last: "Jobs", :cik => "0001007844"}}
47
+
48
+ context "when querying by name" do
49
+ it "first, middle and last name" do
50
+ entity = SecQuery::Entity.find({:first=> jobs[:first], :middle=> jobs[:middle], :last=> jobs[:last]})
51
+ entity.cik.should eql(jobs[:cik])
52
+ end
53
+ end
54
+ end
55
+
56
+ describe "Relationships, Transactions and Filings" do
57
+
58
+ ## Using Steve, because data should not change in the future. RIP.
59
+
60
+ let(:jobs){{
61
+ first: "Steve", middle: "P", last: "Jobs", :cik => "0001007844",
62
+ relationships:[
63
+ {cik: "0000320193", name: "APPLE INC"},
64
+ {cik: "0001001039", name: "WALT DISNEY CO/"},
65
+ {cik: "0001002114", name: "PIXAR \\CA\\"}
66
+ ],
67
+ transactions:[
68
+ {filing_number: "0001181431-07-052839", reporting_owner: "APPLE INC", shares:120000.0},
69
+ {filing_number: "0001181431-07-052839", reporting_owner: "APPLE INC", shares: 40000.0},
70
+ {filing_number: "0001181431-07-052839", reporting_owner: "APPLE INC", shares: 40000.0},
71
+ {filing_number: "0001181431-07-052839", reporting_owner: "APPLE INC", shares: 40000.0},
72
+ {filing_number: "0001181431-06-028746", reporting_owner: "WALT DISNEY CO/", shares: 138000004.0},
73
+ {filing_number: "0001356184-06-000008", reporting_owner: "PIXAR \\CA\\", shares: 60000002.0},
74
+ {filing_number: "0001181431-06-019230", reporting_owner: "APPLE COMPUTER INC", shares: 4573553.0},
75
+ {filing_number: "0001181431-06-028747", reporting_owner: "WALT DISNEY CO/", shares: 0.0}
76
+ ],
77
+ filings:[
78
+ {cik: "0001007844", file_id: "0001181431-07-052839"},
79
+ {cik: "0001007844", file_id: "0001356184-06-000008"},
80
+ {cik: "0001007844", file_id: "0001193125-06-103741"},
81
+ {cik: "0001007844", file_id: "0001181431-06-028747"},
82
+ {cik: "0001007844", file_id: "0001181431-06-028746"},
83
+ {cik: "0001007844", file_id: "0001181431-06-019230"},
84
+ {cik: "0001007844", file_id: "0001193125-06-019727"},
85
+ {cik: "0001007844", file_id: "0001104659-03-004723"}
86
+ ]
87
+ }}
88
+
89
+ let(:entity) {SecQuery::Entity.find({:first=> "Steve", middle: "P", last: "Jobs", :cik => "0001007844"}, true)}
90
+
91
+ context "when quering entities with option 'true'" do
92
+ it "should provide relationships" do
93
+ entity.relationships.each_with_index do |r, i|
94
+ r.cik.should eql(jobs[:relationships][i][:cik])
95
+ end
96
+ end
97
+ it "should provide transactions" do
98
+ entity.transactions.each_with_index do |t, i|
99
+ t.filing_number.should eql(jobs[:transactions][i][:filing_number])
100
+ end
101
+ end
102
+ it "should provide filings" do
103
+ entity.filings.each_with_index do |f, i|
104
+ f.file_id.should eql(jobs[:filings][i][:file_id])
63
105
  end
64
- end
106
+ end
107
+ end
108
+ end
65
109
  end
metadata CHANGED
@@ -1,75 +1,72 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sec_query
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 2
10
- version: 1.0.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ty Rauber
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-13 00:00:00 -08:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2013-03-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rspec
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rest-client
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
39
25
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rest-client
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
47
38
  type: :runtime
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: hpricot
51
39
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
53
41
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: hpricot
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
61
54
  type: :runtime
62
- version_requirements: *id003
63
- description: Search for company or person, by name, symbol or Central Index Key (CIK), and retrieve relationships, transactions and filings.
64
- email:
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
+ description: Search for company or person, by name, symbol or Central Index Key (CIK),
63
+ and retrieve relationships, transactions and filings.
64
+ email:
65
65
  - tyrauber@mac.com
66
66
  executables: []
67
-
68
67
  extensions: []
69
-
70
68
  extra_rdoc_files: []
71
-
72
- files:
69
+ files:
73
70
  - Gemfile
74
71
  - Gemfile.lock
75
72
  - README.md
@@ -83,44 +80,36 @@ files:
83
80
  - lib/sec_query/transaction.rb
84
81
  - lib/sec_query/version.rb
85
82
  - pkg/sec_query-1.0.1.gem
86
- - sec_query-1.0.2.gem
83
+ - pkg/sec_query-1.0.2.gem
84
+ - sec_query-1.0.3.gem
87
85
  - sec_query.gemspec
88
86
  - spec/sec_query_spec.rb
89
87
  - spec/spec_helper.rb
90
- has_rdoc: true
91
88
  homepage: https://github.com/tyrauber/sec_query
92
89
  licenses: []
93
-
94
90
  post_install_message:
95
91
  rdoc_options: []
96
-
97
- require_paths:
92
+ require_paths:
98
93
  - lib
99
- required_ruby_version: !ruby/object:Gem::Requirement
94
+ required_ruby_version: !ruby/object:Gem::Requirement
100
95
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
106
- - 0
107
- version: "0"
108
- required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
101
  none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
- version: "0"
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
117
106
  requirements: []
118
-
119
107
  rubyforge_project: sec_query
120
- rubygems_version: 1.5.3
108
+ rubygems_version: 1.8.24
121
109
  signing_key:
122
110
  specification_version: 3
123
- summary: A ruby gem for querying the United States Securities and Exchange Commission Edgar System.
124
- test_files:
111
+ summary: A ruby gem for querying the United States Securities and Exchange Commission
112
+ Edgar System.
113
+ test_files:
125
114
  - spec/sec_query_spec.rb
126
115
  - spec/spec_helper.rb