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.



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

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



60
61
62
# File 'lib/homophone/service.rb', line 60

def name
  @name
end

#spotify_idObject (readonly)

Returns the value of attribute spotify_id.



60
61
62
# File 'lib/homophone/service.rb', line 60

def spotify_id
  @spotify_id
end

Instance Method Details



68
69
70
71
# File 'lib/homophone/service.rb', line 68

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