Class: Homophone::Musician

Inherits:
Object
  • Object
show all
Defined in:
lib/homophone/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service, blob) ⇒ Musician

Returns a new instance of Musician.



65
66
67
68
69
70
# File 'lib/homophone/service.rb', line 65

def initialize(service, blob)
  @service = service
  @spotify_id = blob['id']
  @name = blob['name']
  @genres = blob['genres']
end

Instance Attribute Details

#genresObject (readonly)

Returns the value of attribute genres.



63
64
65
# File 'lib/homophone/service.rb', line 63

def genres
  @genres
end

#nameObject (readonly)

Returns the value of attribute name.



63
64
65
# File 'lib/homophone/service.rb', line 63

def name
  @name
end

#spotify_idObject (readonly)

Returns the value of attribute spotify_id.



63
64
65
# File 'lib/homophone/service.rb', line 63

def spotify_id
  @spotify_id
end

Instance Method Details



72
73
74
75
# File 'lib/homophone/service.rb', line 72

def related_artists
  data = @service.get("/artists/#{spotify_id}/related-artists")['artists']
  data.map { |e| Musician.new(@service, e) }
end