Class: Scrobbler::BaseXml

Inherits:
Base
  • Object
show all
Defined in:
lib/scrobbler/basexml.rb

Direct Known Subclasses

BaseXmlInfo, Session, Shout, Tag

Instance Method Summary (collapse)

Methods inherited from Base

add_cache, api_key=, #call, #call_pageable, fetch_http, get, load_from_cache, #populate_data, post_request, #request, request, sanitize, save_to_cache, secret=, validate_response_document

Constructor Details

- (BaseXml) initialize(data = {})

Load data out of a XML node

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
# File 'lib/scrobbler/basexml.rb', line 8

def initialize(data = {})
  raise ArgumentError unless data.kind_of?(Hash)
  super()
  unless data[:xml].nil?
    load_from_xml(data[:xml])
    data.delete(:xml)
  end
  populate_data(data)
end