Class: ThirteenF::SearchHit
- Inherits:
-
Object
- Object
- ThirteenF::SearchHit
- Defined in:
- lib/thirteen_f/search_hit.rb
Constant Summary collapse
- BASE_URL =
'https://www.sec.gov'
Instance Attribute Summary collapse
-
#cik ⇒ Object
readonly
Returns the value of attribute cik.
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sec_page_url ⇒ Object
readonly
Returns the value of attribute sec_page_url.
Class Method Summary collapse
Instance Method Summary collapse
- #get_entity ⇒ Object
-
#initialize(sec_hit) ⇒ SearchHit
constructor
A new instance of SearchHit.
Constructor Details
#initialize(sec_hit) ⇒ SearchHit
Returns a new instance of SearchHit.
13 14 15 16 17 18 |
# File 'lib/thirteen_f/search_hit.rb', line 13 def initialize(sec_hit) @cik = cik_from_id sec_hit[:_id] @name = sec_hit[:_source][:entity] @sec_page_url = "#{BASE_URL}/edgar/browse/?CIK=#{cik}&owner=exclude" true end |
Instance Attribute Details
#cik ⇒ Object (readonly)
Returns the value of attribute cik.
5 6 7 |
# File 'lib/thirteen_f/search_hit.rb', line 5 def cik @cik end |
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
5 6 7 |
# File 'lib/thirteen_f/search_hit.rb', line 5 def entity @entity end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/thirteen_f/search_hit.rb', line 5 def name @name end |
#sec_page_url ⇒ Object (readonly)
Returns the value of attribute sec_page_url.
5 6 7 |
# File 'lib/thirteen_f/search_hit.rb', line 5 def sec_page_url @sec_page_url end |
Class Method Details
.from_search_hits(hits) ⇒ Object
7 8 9 |
# File 'lib/thirteen_f/search_hit.rb', line 7 def self.from_search_hits(hits) hits.map { |hit| new hit } end |
Instance Method Details
#get_entity ⇒ Object
20 21 22 23 24 25 |
# File 'lib/thirteen_f/search_hit.rb', line 20 def get_entity entity_url = "https://data.sec.gov/submissions/CIK#{cik}.json" response = SecRequest.get entity_url @entity = Entity.new response true end |