Class: Pandoru::Models::StationSeeds

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

Overview

The seed sets for a station, grouped by kind.

Instance Attribute Summary collapse

Attributes inherited from Base

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

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

Constructor Details

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

Instance Attribute Details

#artistsObject

Returns the value of attribute artists.



39
40
41
# File 'lib/pandoru/models/station.rb', line 39

def artists
  @artists
end

#genresObject

Returns the value of attribute genres.



39
40
41
# File 'lib/pandoru/models/station.rb', line 39

def genres
  @genres
end

#songsObject

Returns the value of attribute songs.



39
40
41
# File 'lib/pandoru/models/station.rb', line 39

def songs
  @songs
end

Class Method Details

.from_json(api_client, data) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/pandoru/models/station.rb', line 41

def self.from_json(api_client, data)
  return nil unless data
  instance = new(data, api_client)
  instance.genres  = StationSeed.from_json_list(api_client, data['genres'])
  instance.songs   = StationSeed.from_json_list(api_client, data['songs'])
  instance.artists = StationSeed.from_json_list(api_client, data['artists'])
  instance
end

Instance Method Details

#allObject

All seeds flattened into one array.



51
52
53
# File 'lib/pandoru/models/station.rb', line 51

def all
  Array(genres) + Array(artists) + Array(songs)
end