Class: Pandoru::Models::StationSeed

Inherits:
Base
  • Object
show all
Defined in:
lib/pandoru/models/station.rb

Overview

A single station seed — an artist, song, or genre the station was built from. Returned under the “music” key of a getStation response when includeExtendedAttributes is set.

Instance Attribute Summary

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

date_field, field, fields, from_json, from_json_list, #initialize, #inspect, #populate_from_json, #to_h

Constructor Details

This class inherits a constructor from Pandoru::Models::Base

Instance Method Details

#artist?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/pandoru/models/station.rb', line 22

def artist?
  song_name.nil? && !artist_name.nil?
end

#genre?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/pandoru/models/station.rb', line 26

def genre?
  !genre_name.nil?
end

#labelObject

Human-readable label, handy for clustering/debugging.



31
32
33
34
# File 'lib/pandoru/models/station.rb', line 31

def label
  return genre_name if genre?
  [artist_name, song_name].compact.join(' - ')
end

#song?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/pandoru/models/station.rb', line 18

def song?
  !song_name.nil?
end