Sha256: f6fcab89c996627bbdd2b5a33a678b59a98d5e01b346613b7f47c9b2344c0109
Contents?: true
Size: 518 Bytes
Versions: 2
Compression:
Stored size: 518 Bytes
Contents
require 'rubygems' require 'json' class Lastfm class Response def initialize(body) # API returns XML response when no child node? if body == '<?xml version="1.0" encoding="utf-8"?> <lfm status="ok"> </lfm> ' @parsed_body = {} else @parsed_body = JSON.parse(body) end end def [](key) @parsed_body[key] end def success? !self['error'] end def message self['message'] end def error self['error'] end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
claudiob-lastfm-0.0.1 | lib/lastfm/response.rb |
lastfm-0.0.1 | lib/lastfm/response.rb |