Module: Syobocal::DB::ChGroupLookup
- Defined in:
- lib/syobocal/db.rb
Defined Under Namespace
Classes: Mapper
Class Method Summary collapse
Class Method Details
.get(params = {}) ⇒ Object
191 192 193 |
# File 'lib/syobocal/db.rb', line 191 def get(params = {}) parse(open(url(params))) end |
.parse(xml) ⇒ Object
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/syobocal/db.rb', line 199 def parse(xml) xml = REXML::Document.new(xml) result = LookupResult.new result.code = xml.elements['ChGroupLookupResponse/Result/Code'].text.to_i result. = xml.elements['ChGroupLookupResponse/Result/Message'].text xml.elements.each('ChGroupLookupResponse/ChGroupItems/ChGroupItem'){|item| mapper = Mapper.new result << mapper.map(item) } result end |
.url(params) ⇒ Object
195 196 197 |
# File 'lib/syobocal/db.rb', line 195 def url(params) 'http://cal.syoboi.jp/db.php?Command=ChGroupLookup' + Syobocal::Util.format_params_amp(params) end |