Class: Edgar::EntityData
- Inherits:
-
Object
- Object
- Edgar::EntityData
- Defined in:
- lib/edgar/entity_data.rb
Overview
Fetches and parses SEC submissions JSON for a CIK entity.
Instance Attribute Summary collapse
-
#cik ⇒ Object
readonly
Returns the value of attribute cik.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #all_filings ⇒ Object
- #bdc? ⇒ Boolean
- #business_address ⇒ Object
- #category ⇒ Object
- #company? ⇒ Boolean
- #description ⇒ Object
- #ein ⇒ Object
- #entity_type ⇒ Object
- #exchanges ⇒ Object
- #filing_count ⇒ Object
- #filings_files ⇒ Object
- #fiscal_year_end ⇒ Object
- #individual? ⇒ Boolean
-
#initialize(cik:) ⇒ EntityData
constructor
A new instance of EntityData.
- #mailing_address ⇒ Object
- #name ⇒ Object
- #not_found? ⇒ Boolean
- #phone ⇒ Object
- #recent_filings ⇒ Object
- #sic ⇒ Object
- #sic_description ⇒ Object
- #state_of_incorporation ⇒ Object
- #tickers ⇒ Object
- #to_h ⇒ Object
- #website ⇒ Object
Constructor Details
#initialize(cik:) ⇒ EntityData
Returns a new instance of EntityData.
8 9 10 11 |
# File 'lib/edgar/entity_data.rb', line 8 def initialize(cik:) @cik = cik.to_i @raw = fetch_data end |
Instance Attribute Details
#cik ⇒ Object (readonly)
Returns the value of attribute cik.
6 7 8 |
# File 'lib/edgar/entity_data.rb', line 6 def cik @cik end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/edgar/entity_data.rb', line 6 def raw @raw end |
Instance Method Details
#all_filings ⇒ Object
99 100 101 |
# File 'lib/edgar/entity_data.rb', line 99 def all_filings @all_filings ||= merge_all_filings end |
#bdc? ⇒ Boolean
73 74 75 |
# File 'lib/edgar/entity_data.rb', line 73 def bdc? entity_type == "bdc" end |
#business_address ⇒ Object
86 87 88 89 |
# File 'lib/edgar/entity_data.rb', line 86 def business_address addr = @raw.dig("addresses", "business") Address.new(addr) if addr end |
#category ⇒ Object
57 58 59 |
# File 'lib/edgar/entity_data.rb', line 57 def category @raw["category"] end |
#company? ⇒ Boolean
65 66 67 |
# File 'lib/edgar/entity_data.rb', line 65 def company? %w[operating company].include?(entity_type) end |
#description ⇒ Object
53 54 55 |
# File 'lib/edgar/entity_data.rb', line 53 def description @raw["description"] end |
#ein ⇒ Object
33 34 35 |
# File 'lib/edgar/entity_data.rb', line 33 def ein @raw["ein"] end |
#entity_type ⇒ Object
37 38 39 |
# File 'lib/edgar/entity_data.rb', line 37 def entity_type @raw["entityType"] end |
#exchanges ⇒ Object
21 22 23 |
# File 'lib/edgar/entity_data.rb', line 21 def exchanges @raw["exchanges"] || [] end |
#filing_count ⇒ Object
95 96 97 |
# File 'lib/edgar/entity_data.rb', line 95 def filing_count (all_filings_hash["form"] || []).length end |
#filings_files ⇒ Object
103 104 105 |
# File 'lib/edgar/entity_data.rb', line 103 def filings_files @raw.dig("filings", "files") || [] end |
#fiscal_year_end ⇒ Object
41 42 43 |
# File 'lib/edgar/entity_data.rb', line 41 def fiscal_year_end @raw["fiscalYearEnd"] end |
#individual? ⇒ Boolean
69 70 71 |
# File 'lib/edgar/entity_data.rb', line 69 def individual? entity_type == "individual" end |
#mailing_address ⇒ Object
81 82 83 84 |
# File 'lib/edgar/entity_data.rb', line 81 def mailing_address addr = @raw.dig("addresses", "mailing") Address.new(addr) if addr end |
#name ⇒ Object
13 14 15 |
# File 'lib/edgar/entity_data.rb', line 13 def name @raw["name"] end |
#not_found? ⇒ Boolean
77 78 79 |
# File 'lib/edgar/entity_data.rb', line 77 def not_found? @raw.key?("error") || @raw.empty? end |
#phone ⇒ Object
45 46 47 |
# File 'lib/edgar/entity_data.rb', line 45 def phone @raw["phone"] end |
#recent_filings ⇒ Object
91 92 93 |
# File 'lib/edgar/entity_data.rb', line 91 def recent_filings @raw.dig("filings", "recent") || {} end |
#sic ⇒ Object
25 26 27 |
# File 'lib/edgar/entity_data.rb', line 25 def sic @raw["sic"] end |
#sic_description ⇒ Object
29 30 31 |
# File 'lib/edgar/entity_data.rb', line 29 def sic_description @raw["sicDescription"] end |
#state_of_incorporation ⇒ Object
61 62 63 |
# File 'lib/edgar/entity_data.rb', line 61 def state_of_incorporation @raw["stateOfIncorporation"] end |
#tickers ⇒ Object
17 18 19 |
# File 'lib/edgar/entity_data.rb', line 17 def tickers @raw["tickers"] || [] end |
#to_h ⇒ Object
107 108 109 |
# File 'lib/edgar/entity_data.rb', line 107 def to_h @raw end |
#website ⇒ Object
49 50 51 |
# File 'lib/edgar/entity_data.rb', line 49 def website @raw["website"] end |