Class: Sec::Firms::FirmEntryParser

Inherits:
XMLParser
  • Object
show all
Defined in:
lib/sec/firms/firm_entry_parser.rb

Instance Attribute Summary collapse

Attributes inherited from XMLParser

#doc

Instance Method Summary collapse

Constructor Details

#initialize(xml_str, updated_at) ⇒ FirmEntryParser

Returns a new instance of FirmEntryParser.



6
7
8
9
# File 'lib/sec/firms/firm_entry_parser.rb', line 6

def initialize(xml_str, updated_at)
  super(xml_str) if xml_str
  @updated_at = updated_at
end

Instance Attribute Details

#updated_atObject (readonly)

Returns the value of attribute updated_at.



4
5
6
# File 'lib/sec/firms/firm_entry_parser.rb', line 4

def updated_at
  @updated_at
end

Instance Method Details

#to_hashObject



11
12
13
14
15
16
17
18
# File 'lib/sec/firms/firm_entry_parser.rb', line 11

def to_hash
  data = Hash.from_xml(doc.to_s)['edgarSubmission']['formData'] rescue nil

  return {} unless data
  data = Helpers::transform_hash(data) do |hash, key, value|
    hash[key] = default_values(value)
  end
end