Class: ThirteenF::Entity
- Inherits:
-
Object
- Object
- ThirteenF::Entity
- Defined in:
- lib/thirteen_f/entity.rb
Constant Summary collapse
- BASE_URL =
'https://www.sec.gov'
Instance Attribute Summary collapse
-
#business_state_or_country ⇒ Object
readonly
Returns the value of attribute business_state_or_country.
-
#cik ⇒ Object
readonly
Returns the value of attribute cik.
-
#exchanges ⇒ Object
readonly
Returns the value of attribute exchanges.
-
#filings ⇒ Object
readonly
Returns the value of attribute filings.
-
#fiscal_year_end ⇒ Object
readonly
Returns the value of attribute fiscal_year_end.
-
#most_recent_positions ⇒ Object
readonly
Returns the value of attribute most_recent_positions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sic ⇒ Object
readonly
Returns the value of attribute sic.
-
#sic_description ⇒ Object
readonly
Returns the value of attribute sic_description.
-
#tickers ⇒ Object
readonly
Returns the value of attribute tickers.
Class Method Summary collapse
Instance Method Summary collapse
- #get_most_recent_positions ⇒ Object
- #human_fiscal_year_end ⇒ Object
-
#initialize(sec_entity) ⇒ Entity
constructor
A new instance of Entity.
- #most_recent_filing ⇒ Object
Constructor Details
#initialize(sec_entity) ⇒ Entity
Returns a new instance of Entity.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/thirteen_f/entity.rb', line 22 def initialize(sec_entity) @name = sec_entity[:name] @cik = cik_from_id sec_entity[:cik] @tickers = sec_entity[:tickers] @exchanges = sec_entity[:exchanges] @sic = sec_entity[:sic] @sic_description = sec_entity[:sicDescription] @fiscal_year_end = sec_entity[:fiscalYearEnd] @business_state_or_country = sec_entity[:addresses][:business][:stateOrCountry] @filings = thirteen_f_filing_data sec_entity[:filings][:recent] true end |
Instance Attribute Details
#business_state_or_country ⇒ Object (readonly)
Returns the value of attribute business_state_or_country.
7 8 9 |
# File 'lib/thirteen_f/entity.rb', line 7 def business_state_or_country @business_state_or_country end |
#cik ⇒ Object (readonly)
Returns the value of attribute cik.
7 8 9 |
# File 'lib/thirteen_f/entity.rb', line 7 def cik @cik end |
#exchanges ⇒ Object (readonly)
Returns the value of attribute exchanges.
7 8 9 |
# File 'lib/thirteen_f/entity.rb', line 7 def exchanges @exchanges end |
#filings ⇒ Object (readonly)
Returns the value of attribute filings.
7 8 9 |
# File 'lib/thirteen_f/entity.rb', line 7 def filings @filings end |
#fiscal_year_end ⇒ Object (readonly)
Returns the value of attribute fiscal_year_end.
7 8 9 |
# File 'lib/thirteen_f/entity.rb', line 7 def fiscal_year_end @fiscal_year_end end |
#most_recent_positions ⇒ Object (readonly)
Returns the value of attribute most_recent_positions.
7 8 9 |
# File 'lib/thirteen_f/entity.rb', line 7 def most_recent_positions @most_recent_positions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/thirteen_f/entity.rb', line 7 def name @name end |
#sic ⇒ Object (readonly)
Returns the value of attribute sic.
7 8 9 |
# File 'lib/thirteen_f/entity.rb', line 7 def sic @sic end |
#sic_description ⇒ Object (readonly)
Returns the value of attribute sic_description.
7 8 9 |
# File 'lib/thirteen_f/entity.rb', line 7 def sic_description @sic_description end |
#tickers ⇒ Object (readonly)
Returns the value of attribute tickers.
7 8 9 |
# File 'lib/thirteen_f/entity.rb', line 7 def tickers @tickers end |
Class Method Details
.from_cik(cik) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/thirteen_f/entity.rb', line 15 def self.from_cik(cik) ten_digit_cik = cik ten_digit_cik.prepend('0') until ten_digit_cik.length >= 10 entity_url = "https://data.sec.gov/submissions/CIK#{ten_digit_cik}.json" new SecRequest.get entity_url end |
Instance Method Details
#get_most_recent_positions ⇒ Object
40 41 42 43 44 |
# File 'lib/thirteen_f/entity.rb', line 40 def get_most_recent_positions most_recent_filing.get_positions @most_recent_positions = most_recent_filing.positions true end |
#human_fiscal_year_end ⇒ Object
36 37 38 |
# File 'lib/thirteen_f/entity.rb', line 36 def human_fiscal_year_end Time.strptime(@fiscal_year_end, '%m%d').strftime('%B %d') end |
#most_recent_filing ⇒ Object
46 47 48 |
# File 'lib/thirteen_f/entity.rb', line 46 def most_recent_filing filings.select(&:period_of_report).max_by(&:period_of_report) end |