class UnderFire::AlbumTOCSearch

Builds XML for Gracenote's ALBUM_TOC query

@see 'developer.gracenote.com/sites/default/files/web/html/index.html#Music%20Web%20API/ALBUM_TOC.html#_Toc344907258'

@example

search = UnderFire::AlbumTOCSearch.new(:toc => '182 10762 22515 32372 43735 53335 63867 78305 89792 98702 110612 122590 132127 141685')
search.query #=> XML query string for ALBUM_TOC query.

Attributes

query[R]

@return [String] XML string for ALBUM_TOC query.

toc[R]

@return [String] CD Table of contents.

Public Class Methods

new(args) click to toggle source

:toc is required (:mode is optional).

@param [Hash] args arguments to create an ALBUM_TOC query. @option [String] :toc CD table of contents (space-separated list of track start frames) @option [String] :mode Either 'SINGLE_BEST' or 'SINGLE_BEST_COVER'

Calls superclass method
# File lib/under_fire/album_toc_search.rb, line 24
def initialize(args)
  super args[:mode]
  @toc = args[:toc]
  @query = build_query
end

Public Instance Methods

build_query() click to toggle source

Builds TOC-specific part of ALBUM_TOC query and adds it to the base query common to all query types. Called by constructor.

@return [String] XML string for ALBUM_TOC query.

# File lib/under_fire/album_toc_search.rb, line 34
def build_query
  build_base_query do |builder|
    builder.QUERY(CMD: "ALBUM_TOC"){
      builder.MODE mode
      builder.TOC {
        builder.OFFSETS toc.to_s
      }
    }
  end
end