Class: SpotifAye::Artist

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/spotif-aye.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ Artist

Returns a new instance of Artist.



13
14
15
16
17
# File 'lib/spotif-aye.rb', line 13

def initialize(result)
	self.name = result['name']
	self.href = result['href']
	self.popularity = result['popularity'].to_f
end

Instance Attribute Details

#hrefObject

Returns the value of attribute href.



11
12
13
# File 'lib/spotif-aye.rb', line 11

def href
  @href
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/spotif-aye.rb', line 11

def name
  @name
end

#popularityObject

Returns the value of attribute popularity.



11
12
13
# File 'lib/spotif-aye.rb', line 11

def popularity
  @popularity
end

Class Method Details

.find(name) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/spotif-aye.rb', line 19

def self.find(name)
  response = get("/artist.json?q=#{name}")
  if response.success?
  	return ResultSet.new(response.parsed_response)
  else
    raise response.response
  end
end