Sha256: 0f4946428fc44d789aca4a7223b231dc47e86793fb5204a5ba40e0d1abf8855b

Contents?: true

Size: 403 Bytes

Versions: 10

Compression:

Stored size: 403 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'])
    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

10 entries across 10 versions & 1 rubygems

Version Path
lastfm-1.13.0 lib/lastfm/response.rb
lastfm-1.12.0 lib/lastfm/response.rb
lastfm-1.11.0 lib/lastfm/response.rb
lastfm-1.10.0 lib/lastfm/response.rb
lastfm-1.9.0 lib/lastfm/response.rb
lastfm-1.8.0 lib/lastfm/response.rb
lastfm-1.7.0 lib/lastfm/response.rb
lastfm-1.6.1 lib/lastfm/response.rb
lastfm-1.6.0 lib/lastfm/response.rb
lastfm-1.5.1 lib/lastfm/response.rb