Class: UnderFire::AlbumFetch
- Defined in:
- lib/under_fire/album_fetch.rb
Overview
Builds XML for Gracenote’s ALBUM_FETCH query.
Instance Attribute Summary collapse
-
#gn_id ⇒ String
Gracenote ID for album.
-
#parameters ⇒ Hash
readonly
Search parameters with :mode removed.
-
#query ⇒ String
readonly
XML string for query.
Attributes inherited from BaseQuery
Instance Method Summary collapse
-
#build_query ⇒ String
Builds ALBUM_FETCH-specific part of ALBUM_FETCH query and adds it to the base query common to all query types.
-
#initialize(args) ⇒ AlbumFetch
constructor
Requires album :gn_id or track :gn_id.
Methods inherited from BaseQuery
Constructor Details
#initialize(args) ⇒ AlbumFetch
Requires album :gn_id or track :gn_id
28 29 30 31 32 33 |
# File 'lib/under_fire/album_fetch.rb', line 28 def initialize(args) super args @parameters = args.reject {|k,v| k == :mode} parameters.each do |k,v| send("#{k}=", v) end @query = build_query end |
Instance Attribute Details
#gn_id ⇒ String
Returns Gracenote ID for album.
20 21 22 |
# File 'lib/under_fire/album_fetch.rb', line 20 def gn_id @gn_id end |
#parameters ⇒ Hash (readonly)
Returns Search parameters with :mode removed.
17 18 19 |
# File 'lib/under_fire/album_fetch.rb', line 17 def parameters @parameters end |
#query ⇒ String (readonly)
Returns XML string for query.
14 15 16 |
# File 'lib/under_fire/album_fetch.rb', line 14 def query @query end |
Instance Method Details
#build_query ⇒ String
Builds ALBUM_FETCH-specific part of ALBUM_FETCH query and adds it to the base query common to all query types. Called by constructor.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/under_fire/album_fetch.rb', line 39 def build_query build_base_query do |builder| builder.QUERY(cmd: "ALBUM_FETCH"){ builder.MODE "SINGLE_BEST_COVER" parameters.each do |k,v| builder.GN_ID gn_id end } end end |