Class: UnderFire::AlbumTOCSearch

Inherits:
BaseQuery show all
Defined in:
lib/under_fire/album_toc_search.rb

Overview

Builds XML for Gracenote’s ALBUM_TOC query

Examples:

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.

See Also:

Instance Attribute Summary collapse

Attributes inherited from BaseQuery

#config, #mode

Instance Method Summary collapse

Methods inherited from BaseQuery

#build_base_query

Constructor Details

#initialize(args) ⇒ AlbumTOCSearch

:toc is required (:mode is optional).

Parameters:

  • args (Hash)

    arguments to create an ALBUM_TOC query.

  • [String] (Hash)

    a customizable set of options



24
25
26
27
28
# File 'lib/under_fire/album_toc_search.rb', line 24

def initialize(args)
  super args[:mode]
  @toc = args[:toc]
  @query = build_query
end

Instance Attribute Details

#queryString (readonly)

Returns XML string for ALBUM_TOC query.

Returns:

  • (String)

    XML string for ALBUM_TOC query.



17
18
19
# File 'lib/under_fire/album_toc_search.rb', line 17

def query
  @query
end

#tocString (readonly)

Returns CD Table of contents.

Returns:

  • (String)

    CD Table of contents.



14
15
16
# File 'lib/under_fire/album_toc_search.rb', line 14

def toc
  @toc
end

Instance Method Details

#build_queryString

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

Returns:

  • (String)

    XML string for ALBUM_TOC query.



34
35
36
37
38
39
40
41
42
43
# 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