Class: SecEdgar::Entity

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

Constant Summary collapse

COLUMNS =
[
  :cik,
  :name,
  :mailing_address,
  :business_address,
  :assigned_sic,
  :assigned_sic_desc,
  :assigned_sic_href,
  :assitant_director,
  :cik_href,
  :formerly_names,
  :state_location,
  :state_location_href,
  :state_of_incorporation
]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entity) ⇒ Entity

Returns a new instance of Entity.



22
23
24
25
26
# File 'lib/sec_edgar/entity.rb', line 22

def initialize(entity)
  COLUMNS.each do |column|
    instance_variable_set("@#{ column }", entity[column.to_s])
  end
end

Class Method Details

.query(url) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/sec_edgar/entity.rb', line 36

def self.query(url)
  RestClient.get(url) do |response, request, result, &block|
    case response.code
    when 200
      return response
    else
      response.return!(request, result, &block)
    end
  end
end

Instance Method Details

#filingsObject



28
29
30
# File 'lib/sec_edgar/entity.rb', line 28

def filings
  SecEdgar::Filing.find(@cik)
end

#transactionsObject



32
33
34
# File 'lib/sec_edgar/entity.rb', line 32

def transactions
  SecEdgar::Transaction.find(@cik)
end