Class: Edgar::Filing
- Inherits:
-
Object
- Object
- Edgar::Filing
- Defined in:
- lib/edgar/filing.rb
Overview
A single SEC filing: form type, date, text, attachments, and XBRL data.
Instance Attribute Summary collapse
-
#accession_number ⇒ Object
readonly
Returns the value of attribute accession_number.
-
#cik ⇒ Object
readonly
Returns the value of attribute cik.
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#filing_date ⇒ Object
readonly
Returns the value of attribute filing_date.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
Instance Method Summary collapse
- #accession_no ⇒ Object
- #all_ciks ⇒ Object
- #attachments ⇒ Object
- #base_dir ⇒ Object
- #exhibits ⇒ Object
- #filing_url ⇒ Object
- #header ⇒ Object
- #homepage ⇒ Object
- #homepage_url ⇒ Object
- #html ⇒ Object
-
#initialize(cik:, company:, form:, filing_date:, accession_number:) ⇒ Filing
constructor
A new instance of Filing.
- #markdown ⇒ Object
- #multi_entity? ⇒ Boolean
- #obj ⇒ Object
- #period_of_report ⇒ Object
- #reports ⇒ Object
- #section_markers ⇒ Object
- #sections ⇒ Object
- #sgml ⇒ Object
- #statements ⇒ Object
- #text ⇒ Object
- #text_url ⇒ Object
- #to_s ⇒ Object
- #xbrl ⇒ Object
- #xml ⇒ Object
Constructor Details
#initialize(cik:, company:, form:, filing_date:, accession_number:) ⇒ Filing
Returns a new instance of Filing.
8 9 10 11 12 13 14 15 16 |
# File 'lib/edgar/filing.rb', line 8 def initialize(cik:, company:, form:, filing_date:, accession_number:) @cik = cik.to_i @company = company @form = form @filing_date = filing_date.is_a?(Date) ? filing_date : Date.parse(filing_date.to_s) @accession_number = accession_number @sgml = nil @homepage_soup = nil end |
Instance Attribute Details
#accession_number ⇒ Object (readonly)
Returns the value of attribute accession_number.
6 7 8 |
# File 'lib/edgar/filing.rb', line 6 def accession_number @accession_number end |
#cik ⇒ Object (readonly)
Returns the value of attribute cik.
6 7 8 |
# File 'lib/edgar/filing.rb', line 6 def cik @cik end |
#company ⇒ Object (readonly)
Returns the value of attribute company.
6 7 8 |
# File 'lib/edgar/filing.rb', line 6 def company @company end |
#filing_date ⇒ Object (readonly)
Returns the value of attribute filing_date.
6 7 8 |
# File 'lib/edgar/filing.rb', line 6 def filing_date @filing_date end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
6 7 8 |
# File 'lib/edgar/filing.rb', line 6 def form @form end |
Instance Method Details
#accession_no ⇒ Object
115 116 117 |
# File 'lib/edgar/filing.rb', line 115 def accession_no @accession_number end |
#all_ciks ⇒ Object
18 19 20 |
# File 'lib/edgar/filing.rb', line 18 def all_ciks [@cik] end |
#attachments ⇒ Object
79 80 81 |
# File 'lib/edgar/filing.rb', line 79 def homepage. end |
#base_dir ⇒ Object
41 42 43 44 |
# File 'lib/edgar/filing.rb', line 41 def base_dir no_dashes = @accession_number.delete("-") "#{Config::SEC_ARCHIVE_URL}/data/#{@cik}/#{no_dashes}" end |
#exhibits ⇒ Object
83 84 85 |
# File 'lib/edgar/filing.rb', line 83 def exhibits .exhibits end |
#filing_url ⇒ Object
26 27 28 29 30 31 |
# File 'lib/edgar/filing.rb', line 26 def filing_url primary = homepage.primary_html_document return primary.url if primary text_url end |
#header ⇒ Object
46 47 48 |
# File 'lib/edgar/filing.rb', line 46 def header @header ||= FilingHeader.new(sgml) end |
#homepage ⇒ Object
58 59 60 |
# File 'lib/edgar/filing.rb', line 58 def homepage @homepage ||= fetch_homepage end |
#homepage_url ⇒ Object
33 34 35 |
# File 'lib/edgar/filing.rb', line 33 def homepage_url Config.filing_homepage_url(@cik, @accession_number) end |
#html ⇒ Object
62 63 64 65 |
# File 'lib/edgar/filing.rb', line 62 def html doc = homepage.primary_html_document doc ? (doc) : "" end |
#markdown ⇒ Object
119 120 121 122 123 124 125 126 127 128 |
# File 'lib/edgar/filing.rb', line 119 def markdown text = sgml return "" if text.empty? text .gsub(/<[^>]+>/, "") .gsub(/&[a-zA-Z]+;/, " ") .gsub(/\n{3,}/, "\n\n") .strip end |
#multi_entity? ⇒ Boolean
22 23 24 |
# File 'lib/edgar/filing.rb', line 22 def multi_entity? all_ciks.length > 1 end |
#obj ⇒ Object
111 112 113 |
# File 'lib/edgar/filing.rb', line 111 def obj DataObjects.for(self) end |
#period_of_report ⇒ Object
50 51 52 |
# File 'lib/edgar/filing.rb', line 50 def period_of_report header.period_of_report end |
#reports ⇒ Object
87 88 89 |
# File 'lib/edgar/filing.rb', line 87 def reports .reports end |
#section_markers ⇒ Object
103 104 105 |
# File 'lib/edgar/filing.rb', line 103 def section_markers @section_markers ||= Edgar::FilingSections.extract_sections(sgml) end |
#sections ⇒ Object
107 108 109 |
# File 'lib/edgar/filing.rb', line 107 def sections Edgar::FilingSections.find_sections(sgml, form_type: @form) end |
#sgml ⇒ Object
54 55 56 |
# File 'lib/edgar/filing.rb', line 54 def sgml @sgml ||= fetch_sgml end |
#statements ⇒ Object
91 92 93 |
# File 'lib/edgar/filing.rb', line 91 def statements .statements end |
#text ⇒ Object
72 73 74 75 76 77 |
# File 'lib/edgar/filing.rb', line 72 def text sgml_text = sgml_raw_text return sgml_text if sgml_text download_text_file end |
#text_url ⇒ Object
37 38 39 |
# File 'lib/edgar/filing.rb', line 37 def text_url Config.filing_text_url(@cik, @accession_number) end |
#to_s ⇒ Object
130 131 132 |
# File 'lib/edgar/filing.rb', line 130 def to_s "#<Filing #{@form} #{@company} #{@filing_date} #{@accession_number}>" end |
#xbrl ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/edgar/filing.rb', line 95 def xbrl doc = homepage.xbrl_document return nil unless doc content = (doc) XBRL::XBRL.new(content) end |
#xml ⇒ Object
67 68 69 70 |
# File 'lib/edgar/filing.rb', line 67 def xml doc = homepage.primary_xml_document doc ? (doc) : "" end |