Sha256: ffe3089c17033906ece6a3916c43cfe0583bc09b8232874d38ddfa52b9697900
Contents?: true
Size: 593 Bytes
Versions: 18
Compression:
Stored size: 593 Bytes
Contents
require 'rubygems' require 'xmlsimple' class Lastfm class Response attr_reader :xml def initialize(body) @xml = XmlSimple.xml_in(body, 'ForceArray' => ['image', 'tag', 'user', 'event', 'correction']) rescue REXML::ParseException @xml = XmlSimple.xml_in(body.encode(Encoding.find("ISO-8859-1"), :undef => :replace), 'ForceArray' => ['image', 'tag', 'user', 'event', 'correction']) end def success? @xml['status'] == 'ok' end def message @xml['error']['content'] end def error @xml['error']['code'].to_i end end end
Version data entries
18 entries across 18 versions & 1 rubygems