Class: DartApi::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/dart_api/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Report

Returns a new instance of Report.



10
11
12
13
14
# File 'lib/dart_api/report.rb', line 10

def initialize(options)
  @company_name, @company_code, @report_number = options.values_at("crp_nm", "crp_cd", "rcp_no")
  @year = options["rcp_dt"][0..3].to_i - 1
  # url
end

Instance Attribute Details

#company_codeObject (readonly)

Returns the value of attribute company_code.



8
9
10
# File 'lib/dart_api/report.rb', line 8

def company_code
  @company_code
end

#company_nameObject (readonly)

Returns the value of attribute company_name.



8
9
10
# File 'lib/dart_api/report.rb', line 8

def company_name
  @company_name
end

#contentObject (readonly)

Returns the value of attribute content.



8
9
10
# File 'lib/dart_api/report.rb', line 8

def content
  @content
end

#reader_urlObject (readonly)

Returns the value of attribute reader_url.



8
9
10
# File 'lib/dart_api/report.rb', line 8

def reader_url
  @reader_url
end

#report_numberObject (readonly)

Returns the value of attribute report_number.



8
9
10
# File 'lib/dart_api/report.rb', line 8

def report_number
  @report_number
end

#urlObject (readonly)

Returns the value of attribute url.



8
9
10
# File 'lib/dart_api/report.rb', line 8

def url
  @url
end

#yearObject (readonly)

Returns the value of attribute year.



8
9
10
# File 'lib/dart_api/report.rb', line 8

def year
  @year
end

Instance Method Details

#dcm_noObject



16
17
18
19
# File 'lib/dart_api/report.rb', line 16

def dcm_no
  generate unless @dcm_no
  @dcm_no
end

#ele_idObject



21
22
23
24
# File 'lib/dart_api/report.rb', line 21

def ele_id
  generate unless @ele_id
  @ele_id
end

#read(type) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/dart_api/report.rb', line 40

def read(type)
  result = Hash.new
  content.search("table").each do |table|
    read_table table
  end
  result
end