Class: SecQuery::Filing
- Inherits:
-
Object
- Object
- SecQuery::Filing
- Defined in:
- lib/sec_query/filing.rb
Instance Attribute Summary collapse
-
#cik ⇒ Object
Returns the value of attribute cik.
-
#date ⇒ Object
Returns the value of attribute date.
-
#file_id ⇒ Object
Returns the value of attribute file_id.
-
#link ⇒ Object
Returns the value of attribute link.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#term ⇒ Object
Returns the value of attribute term.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filing) ⇒ Filing
constructor
A new instance of Filing.
Constructor Details
#initialize(filing) ⇒ Filing
Returns a new instance of Filing.
4 5 6 7 8 9 10 11 12 |
# File 'lib/sec_query/filing.rb', line 4 def initialize(filing) @cik = filing[:cik] @title = filing[:title] @summary = filing[:summary] @link = filing[:link] @term = filing[:term] @date = filing[:date] @file_id = filing[:file_id] end |
Instance Attribute Details
#cik ⇒ Object
Returns the value of attribute cik.
3 4 5 |
# File 'lib/sec_query/filing.rb', line 3 def cik @cik end |
#date ⇒ Object
Returns the value of attribute date.
3 4 5 |
# File 'lib/sec_query/filing.rb', line 3 def date @date end |
#file_id ⇒ Object
Returns the value of attribute file_id.
3 4 5 |
# File 'lib/sec_query/filing.rb', line 3 def file_id @file_id end |
#link ⇒ Object
Returns the value of attribute link.
3 4 5 |
# File 'lib/sec_query/filing.rb', line 3 def link @link end |
#summary ⇒ Object
Returns the value of attribute summary.
3 4 5 |
# File 'lib/sec_query/filing.rb', line 3 def summary @summary end |
#term ⇒ Object
Returns the value of attribute term.
3 4 5 |
# File 'lib/sec_query/filing.rb', line 3 def term @term end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/sec_query/filing.rb', line 3 def title @title end |
Class Method Details
.find(entity, start, count, limit) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sec_query/filing.rb', line 15 def self.find(entity, start, count, limit) if start == nil; start = 0; end if count == nil; count = 80; end url ="http://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK="+entity[:cik]+"&output=atom&count="+count.to_s+"&start="+start.to_s response = Entity.query(url) doc = Hpricot::XML(response) entries = doc.search(:entry); query_more = false; for entry in entries query_more = true; filing={} filing[:cik] = entity[:cik] filing[:title] = (entry/:title).innerHTML filing[:summary] = (entry/:summary).innerHTML filing[:link] = (entry/:link)[0].get_attribute("href") filing[:term] = (entry/:category)[0].get_attribute("term") filing[:date] = (entry/:updated).innerHTML filing[:file_id] = (entry/:id).innerHTML.split("=").last entity[:filings] << Filing.new(filing) end if query_more and limit == nil || query_more and !limit Filing.find(entity, start+count, count, limit); else return entity end end |