Class: ThirteenF::Filing
- Inherits:
-
Object
- Object
- ThirteenF::Filing
- Defined in:
- lib/thirteen_f/filing.rb
Constant Summary collapse
- BASE_URL =
'https://www.sec.gov'
Instance Attribute Summary collapse
-
#complete_text_file_url ⇒ Object
readonly
Returns the value of attribute complete_text_file_url.
-
#cover_page_html_url ⇒ Object
readonly
Returns the value of attribute cover_page_html_url.
-
#cover_page_xml_url ⇒ Object
readonly
Returns the value of attribute cover_page_xml_url.
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#form_type ⇒ Object
readonly
Returns the value of attribute form_type.
-
#index_url ⇒ Object
readonly
Returns the value of attribute index_url.
-
#positions ⇒ Object
readonly
Returns the value of attribute positions.
-
#report_date ⇒ Object
(also: #period_of_report)
readonly
Returns the value of attribute report_date.
-
#table_html_url ⇒ Object
readonly
Returns the value of attribute table_html_url.
-
#table_xml_url ⇒ Object
readonly
Returns the value of attribute table_xml_url.
-
#time_accepted ⇒ Object
readonly
Returns the value of attribute time_accepted.
Instance Method Summary collapse
- #assemble_index_url(accession_number) ⇒ Object
- #get_positions ⇒ Object
-
#initialize(entity, columnar_data) ⇒ Filing
constructor
A new instance of Filing.
- #set_attributes_from_index_url ⇒ Object
Constructor Details
#initialize(entity, columnar_data) ⇒ Filing
Returns a new instance of Filing.
16 17 18 19 20 21 22 23 |
# File 'lib/thirteen_f/filing.rb', line 16 def initialize(entity, columnar_data) @entity = entity @index_url = assemble_index_url columnar_data[0] @report_date = Date.parse columnar_data[2] @time_accepted = DateTime.parse columnar_data[3] @form_type = columnar_data[5] true end |
Instance Attribute Details
#complete_text_file_url ⇒ Object (readonly)
Returns the value of attribute complete_text_file_url.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def complete_text_file_url @complete_text_file_url end |
#cover_page_html_url ⇒ Object (readonly)
Returns the value of attribute cover_page_html_url.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def cover_page_html_url @cover_page_html_url end |
#cover_page_xml_url ⇒ Object (readonly)
Returns the value of attribute cover_page_xml_url.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def cover_page_xml_url @cover_page_xml_url end |
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def entity @entity end |
#form_type ⇒ Object (readonly)
Returns the value of attribute form_type.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def form_type @form_type end |
#index_url ⇒ Object (readonly)
Returns the value of attribute index_url.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def index_url @index_url end |
#positions ⇒ Object (readonly)
Returns the value of attribute positions.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def positions @positions end |
#report_date ⇒ Object (readonly) Also known as: period_of_report
Returns the value of attribute report_date.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def report_date @report_date end |
#table_html_url ⇒ Object (readonly)
Returns the value of attribute table_html_url.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def table_html_url @table_html_url end |
#table_xml_url ⇒ Object (readonly)
Returns the value of attribute table_xml_url.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def table_xml_url @table_xml_url end |
#time_accepted ⇒ Object (readonly)
Returns the value of attribute time_accepted.
7 8 9 |
# File 'lib/thirteen_f/filing.rb', line 7 def time_accepted @time_accepted end |
Instance Method Details
#assemble_index_url(accession_number) ⇒ Object
25 26 27 |
# File 'lib/thirteen_f/filing.rb', line 25 def assemble_index_url(accession_number) "#{BASE_URL}/Archives/edgar/data/#{entity.cik}/#{accession_number.delete('-')}/#{accession_number}-index.htm" end |
#get_positions ⇒ Object
29 30 31 32 33 |
# File 'lib/thirteen_f/filing.rb', line 29 def get_positions set_attributes_from_index_url unless table_xml_url @positions = Position.from_xml_filing self true end |
#set_attributes_from_index_url ⇒ Object
35 36 37 38 39 |
# File 'lib/thirteen_f/filing.rb', line 35 def set_attributes_from_index_url return unless index_url response = SecRequest.get index_url, response_type: :html assign_attributes(**set_attributes(response)) end |