Class: Edgar::Entity

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

Overview

Base class wrapping SEC submissions API data for a CIK entity.

Direct Known Subclasses

Company

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cik:, name: nil) ⇒ Entity

Returns a new instance of Entity.



8
9
10
11
12
# File 'lib/edgar/entity.rb', line 8

def initialize(cik:, name: nil)
  @cik = cik.to_i
  @name = name
  @entity_data = nil
end

Instance Attribute Details

#cikObject (readonly)

Returns the value of attribute cik.



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

def cik
  @cik
end

Instance Method Details

#business_addressObject



42
43
44
# File 'lib/edgar/entity.rb', line 42

def business_address
  data.business_address
end

#company?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/edgar/entity.rb', line 26

def company?
  data.company?
end

#dataObject



18
19
20
# File 'lib/edgar/entity.rb', line 18

def data
  @data ||= EntityData.new(cik: @cik)
end

#display_nameObject



22
23
24
# File 'lib/edgar/entity.rb', line 22

def display_name
  data.name
end

#get_filings(form: nil, year: nil, quarter: nil, accession_number: nil, filing_date: nil, date: nil, amendments: nil, date_start: nil, date_end: nil) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/edgar/entity.rb', line 46

def get_filings(form: nil, year: nil, quarter: nil, accession_number: nil,
                filing_date: nil, date: nil,
                amendments: nil, date_start: nil, date_end: nil)
  filings = if year && quarter
              Filings.from_quarter(year, quarter)
            else
              build_filings_from_submissions
            end

  filings = filings.filter(
    form: form,
    filing_date: filing_date || date,
    cik: @cik,
    amendments: amendments,
    date_start: date_start,
    date_end: date_end
  )

  if accession_number
    filing = filings.find { |f| f.accession_number == accession_number }
    return filing ? Filings.new([filing]) : Filings.new([])
  end

  filings
end

#individual?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/edgar/entity.rb', line 30

def individual?
  data.individual?
end

#mailing_addressObject



38
39
40
# File 'lib/edgar/entity.rb', line 38

def mailing_address
  data.mailing_address
end

#nameObject



14
15
16
# File 'lib/edgar/entity.rb', line 14

def name
  @name || data.name
end

#not_found?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/edgar/entity.rb', line 34

def not_found?
  data.not_found?
end

#to_sObject



72
73
74
# File 'lib/edgar/entity.rb', line 72

def to_s
  "#<Entity #{@cik}>"
end