Class: Edgar::EntityData

Inherits:
Object
  • Object
show all
Defined in:
lib/edgar/entity_data.rb

Overview

Fetches and parses SEC submissions JSON for a CIK entity.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cikObject (readonly)

Returns the value of attribute cik.



6
7
8
# File 'lib/edgar/entity_data.rb', line 6

def cik
  @cik
end

#rawObject (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_filingsObject



99
100
101
# File 'lib/edgar/entity_data.rb', line 99

def all_filings
  @all_filings ||= merge_all_filings
end

#bdc?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/edgar/entity_data.rb', line 73

def bdc?
  entity_type == "bdc"
end

#business_addressObject



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

#categoryObject



57
58
59
# File 'lib/edgar/entity_data.rb', line 57

def category
  @raw["category"]
end

#company?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/edgar/entity_data.rb', line 65

def company?
  %w[operating company].include?(entity_type)
end

#descriptionObject



53
54
55
# File 'lib/edgar/entity_data.rb', line 53

def description
  @raw["description"]
end

#einObject



33
34
35
# File 'lib/edgar/entity_data.rb', line 33

def ein
  @raw["ein"]
end

#entity_typeObject



37
38
39
# File 'lib/edgar/entity_data.rb', line 37

def entity_type
  @raw["entityType"]
end

#exchangesObject



21
22
23
# File 'lib/edgar/entity_data.rb', line 21

def exchanges
  @raw["exchanges"] || []
end

#filing_countObject



95
96
97
# File 'lib/edgar/entity_data.rb', line 95

def filing_count
  (all_filings_hash["form"] || []).length
end

#filings_filesObject



103
104
105
# File 'lib/edgar/entity_data.rb', line 103

def filings_files
  @raw.dig("filings", "files") || []
end

#fiscal_year_endObject



41
42
43
# File 'lib/edgar/entity_data.rb', line 41

def fiscal_year_end
  @raw["fiscalYearEnd"]
end

#individual?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/edgar/entity_data.rb', line 69

def individual?
  entity_type == "individual"
end

#mailing_addressObject



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

#nameObject



13
14
15
# File 'lib/edgar/entity_data.rb', line 13

def name
  @raw["name"]
end

#not_found?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/edgar/entity_data.rb', line 77

def not_found?
  @raw.key?("error") || @raw.empty?
end

#phoneObject



45
46
47
# File 'lib/edgar/entity_data.rb', line 45

def phone
  @raw["phone"]
end

#recent_filingsObject



91
92
93
# File 'lib/edgar/entity_data.rb', line 91

def recent_filings
  @raw.dig("filings", "recent") || {}
end

#sicObject



25
26
27
# File 'lib/edgar/entity_data.rb', line 25

def sic
  @raw["sic"]
end

#sic_descriptionObject



29
30
31
# File 'lib/edgar/entity_data.rb', line 29

def sic_description
  @raw["sicDescription"]
end

#state_of_incorporationObject



61
62
63
# File 'lib/edgar/entity_data.rb', line 61

def state_of_incorporation
  @raw["stateOfIncorporation"]
end

#tickersObject



17
18
19
# File 'lib/edgar/entity_data.rb', line 17

def tickers
  @raw["tickers"] || []
end

#to_hObject



107
108
109
# File 'lib/edgar/entity_data.rb', line 107

def to_h
  @raw
end

#websiteObject



49
50
51
# File 'lib/edgar/entity_data.rb', line 49

def website
  @raw["website"]
end