Class: SpotifyWebApi::SearchItems
- Defined in:
- lib/spotify_web_api/models/search_items.rb
Overview
SearchItems Model.
Instance Attribute Summary collapse
-
#albums ⇒ PagingSimplifiedAlbumObject
TODO: Write general description for this method.
-
#artists ⇒ PagingArtistObject
TODO: Write general description for this method.
-
#audiobooks ⇒ PagingSimplifiedAudiobookObject
TODO: Write general description for this method.
-
#episodes ⇒ PagingSimplifiedEpisodeObject
TODO: Write general description for this method.
-
#playlists ⇒ PagingPlaylistObject
TODO: Write general description for this method.
-
#shows ⇒ PagingSimplifiedShowObject
TODO: Write general description for this method.
-
#tracks ⇒ PagingTrackObject
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(tracks = SKIP, artists = SKIP, albums = SKIP, playlists = SKIP, shows = SKIP, episodes = SKIP, audiobooks = SKIP) ⇒ SearchItems
constructor
A new instance of SearchItems.
Methods inherited from BaseModel
Constructor Details
#initialize(tracks = SKIP, artists = SKIP, albums = SKIP, playlists = SKIP, shows = SKIP, episodes = SKIP, audiobooks = SKIP) ⇒ SearchItems
Returns a new instance of SearchItems.
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/spotify_web_api/models/search_items.rb', line 71 def initialize(tracks = SKIP, artists = SKIP, albums = SKIP, playlists = SKIP, shows = SKIP, episodes = SKIP, audiobooks = SKIP) @tracks = tracks unless tracks == SKIP @artists = artists unless artists == SKIP @albums = albums unless albums == SKIP @playlists = playlists unless playlists == SKIP @shows = shows unless shows == SKIP @episodes = episodes unless episodes == SKIP @audiobooks = audiobooks unless audiobooks == SKIP end |
Instance Attribute Details
#albums ⇒ PagingSimplifiedAlbumObject
TODO: Write general description for this method
22 23 24 |
# File 'lib/spotify_web_api/models/search_items.rb', line 22 def albums @albums end |
#artists ⇒ PagingArtistObject
TODO: Write general description for this method
18 19 20 |
# File 'lib/spotify_web_api/models/search_items.rb', line 18 def artists @artists end |
#audiobooks ⇒ PagingSimplifiedAudiobookObject
TODO: Write general description for this method
38 39 40 |
# File 'lib/spotify_web_api/models/search_items.rb', line 38 def audiobooks @audiobooks end |
#episodes ⇒ PagingSimplifiedEpisodeObject
TODO: Write general description for this method
34 35 36 |
# File 'lib/spotify_web_api/models/search_items.rb', line 34 def episodes @episodes end |
#playlists ⇒ PagingPlaylistObject
TODO: Write general description for this method
26 27 28 |
# File 'lib/spotify_web_api/models/search_items.rb', line 26 def playlists @playlists end |
#shows ⇒ PagingSimplifiedShowObject
TODO: Write general description for this method
30 31 32 |
# File 'lib/spotify_web_api/models/search_items.rb', line 30 def shows @shows end |
#tracks ⇒ PagingTrackObject
TODO: Write general description for this method
14 15 16 |
# File 'lib/spotify_web_api/models/search_items.rb', line 14 def tracks @tracks end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/spotify_web_api/models/search_items.rb', line 84 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. tracks = PagingTrackObject.from_hash(hash['tracks']) if hash['tracks'] artists = PagingArtistObject.from_hash(hash['artists']) if hash['artists'] albums = PagingSimplifiedAlbumObject.from_hash(hash['albums']) if hash['albums'] playlists = PagingPlaylistObject.from_hash(hash['playlists']) if hash['playlists'] shows = PagingSimplifiedShowObject.from_hash(hash['shows']) if hash['shows'] episodes = PagingSimplifiedEpisodeObject.from_hash(hash['episodes']) if hash['episodes'] audiobooks = PagingSimplifiedAudiobookObject.from_hash(hash['audiobooks']) if hash['audiobooks'] # Create object from extracted values. SearchItems.new(tracks, artists, albums, playlists, shows, episodes, audiobooks) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/spotify_web_api/models/search_items.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['tracks'] = 'tracks' @_hash['artists'] = 'artists' @_hash['albums'] = 'albums' @_hash['playlists'] = 'playlists' @_hash['shows'] = 'shows' @_hash['episodes'] = 'episodes' @_hash['audiobooks'] = 'audiobooks' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/spotify_web_api/models/search_items.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/spotify_web_api/models/search_items.rb', line 54 def self.optionals %w[ tracks artists albums playlists shows episodes audiobooks ] end |