class DartApi::ReportParser
Attributes
auth[R]
code[R]
dcmt_no[R]
reports[R]
rpt_no[R]
Public Class Methods
new(auth)
click to toggle source
# File lib/dart_api/report_parser.rb, line 8 def initialize(auth) @auth = auth end
Public Instance Methods
parse(code)
click to toggle source
# File lib/dart_api/report_parser.rb, line 12 def parse(code) url = "http://dart.fss.or.kr/api/search.json?auth=#{auth}&fin_rpt=Y&crp_cd=#{code}&start_dt=20100101&bsn_tp=A001&page_set=100" @code = code @reports = JSON.parse(open(url).read)["list"].map do |r| Report.new(r) end end
report(year)
click to toggle source
# File lib/dart_api/report_parser.rb, line 20 def report(year) reports.find do |report| report.year.eql? year end end