Class: Spotify::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/spotifysearch/search.rb

Overview

Create a Song object

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(search_data) ⇒ Search

Returns a new instance of Search.



9
10
11
12
13
14
# File 'lib/spotifysearch/search.rb', line 9

def initialize(search_data)
  @songs = {}
  search_data.each do |key, value|
    @songs[key] = Spotify::Song.new(data: value)
  end
end

Instance Attribute Details

#songsObject

Returns the value of attribute songs.



7
8
9
# File 'lib/spotifysearch/search.rb', line 7

def songs
  @songs
end

Class Method Details

.find(input) ⇒ Object



16
17
18
19
# File 'lib/spotifysearch/search.rb', line 16

def self.find(input)
  search_data = Spotify::SpAPI.search_feed(input)
  new(search_data).songs
end