Module: Edgar

Defined in:
lib/edgar.rb,
lib/edgar/config.rb,
lib/edgar/entity.rb,
lib/edgar/filing.rb,
lib/edgar/company.rb,
lib/edgar/filings.rb,
lib/edgar/version.rb,
lib/edgar/xbrl/xbrl.rb,
lib/edgar/attachment.rb,
lib/edgar/financials.rb,
lib/edgar/attachments.rb,
lib/edgar/entity_data.rb,
lib/edgar/http_client.rb,
lib/edgar/data_objects.rb,
lib/edgar/entity_facts.rb,
lib/edgar/filing_facts.rb,
lib/edgar/filing_index.rb,
lib/edgar/filing_header.rb,
lib/edgar/ttm_calculator.rb,
lib/edgar/filing_homepage.rb,
lib/edgar/filing_sections.rb

Overview

Main entry point for the Edgar library providing SEC EDGAR filing access.

Defined Under Namespace

Modules: Config, DataObjects, XBRL Classes: Address, Attachment, Attachments, Company, Entity, EntityData, EntityFacts, Filing, FilingFacts, FilingHeader, FilingHomepage, FilingIndex, FilingSections, Filings, Financials, HTTPClient, TTMCalculator

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.http_clientObject



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

def http_client
  @http_client ||= HTTPClient.new
end

Class Method Details

.company(identifier) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/edgar.rb', line 30

def company(identifier)
  if identifier.is_a?(Integer) || identifier.to_s.match?(/^\d+$/)
    Company.new(cik: identifier.to_i)
  else
    Company.new(ticker: identifier.to_s)
  end
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Edgar)

    the object that the method was called on



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

def configure
  yield(self)
end

.current_filingsObject



47
48
49
50
# File 'lib/edgar.rb', line 47

def current_filings
  today = Date.today
  Filings.from_quarter(today.year, ((today.month - 1) / 3) + 1)
end

.find(identifier) ⇒ Object



60
61
62
63
64
65
66
67
68
69
# File 'lib/edgar.rb', line 60

def find(identifier)
  return nil unless identifier

  str = identifier.to_s.strip
  return Company.new(cik: str.to_i) if str.match?(/^\d{10}$/)
  return Company.new(cik: str.to_i) if str.match?(/^\d+$/) && str.length >= 6
  return Company.new(ticker: str) if str.match?(/^[A-Za-z]{1,5}$/)

  Company.search(str, limit: 1).first
end

.find_company(name, limit: 10) ⇒ Object



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

def find_company(name, limit: 10)
  Company.search(name, limit: limit)
end

.get_entity(cik) ⇒ Object



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

def get_entity(cik)
  Entity.new(cik: cik)
end

.get_filings(year, quarter) ⇒ Object



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

def get_filings(year, quarter)
  Filings.from_quarter(year, quarter)
end

.identity=(email) ⇒ Object



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

def identity=(email)
  ENV["EDGAR_IDENTITY"] = email
  @http_client = nil
end

.obj(filing) ⇒ Object



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

def obj(filing)
  DataObjects.for(filing)
end

.reset!Object



75
76
77
# File 'lib/edgar.rb', line 75

def reset!
  @http_client = nil
end

.versionObject



79
80
81
# File 'lib/edgar.rb', line 79

def version
  VERSION
end