Class: SimpleSpotify::Model::User

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/simplespotify/models/user.rb

Instance Method Summary collapse

Methods included from Resource

included

Instance Method Details

#follow(type, ids, client = nil) ⇒ Object


Follows




50
51
52
53
# File 'lib/simplespotify/models/user.rb', line 50

def follow type, ids, client=nil
  client ||= SimpleSpotify.default_client
  client.user_follow(type, ids)
end

#follow_playlist(owner, playlist = nil, client = nil) ⇒ Object



78
79
80
81
# File 'lib/simplespotify/models/user.rb', line 78

def follow_playlist owner, playlist=nil, client=nil, public: true
  client ||= SimpleSpotify.default_client
  client.playlist_follow(owner, playlist, public: public)
end

#following?(type, ids, client = nil) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
65
# File 'lib/simplespotify/models/user.rb', line 62

def following? type, ids, client=nil
  client ||= SimpleSpotify.default_client
  client.user_following(type, ids)
end

#nameObject



17
18
19
# File 'lib/simplespotify/models/user.rb', line 17

def name
  display_name
end

#playlists!(client = nil, fields: {}, market: nil, limit: 20, offset: 0) ⇒ Object


Playlists




72
73
74
75
# File 'lib/simplespotify/models/user.rb', line 72

def playlists! client=nil, fields: {}, market: nil, limit: 20, offset: 0
  client ||= SimpleSpotify.default_client
  client.playlists(self, fields: fields, market: market, limit: limit, offset: offset)
end

#premium?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/simplespotify/models/user.rb', line 21

def premium?
  @product == 'premium'
end

#remove_tracks(ids, client = nil) ⇒ Object



35
36
37
38
# File 'lib/simplespotify/models/user.rb', line 35

def remove_tracks ids, client=nil
  client ||= SimpleSpotify.default_client
  client.remove_tracks(ids)
end

#save_tracks(ids, client = nil) ⇒ Object


Saved tracks




29
30
31
32
# File 'lib/simplespotify/models/user.rb', line 29

def save_tracks ids, client=nil
  client ||= SimpleSpotify.default_client
  client.save_tracks(ids)
end

#saved_tracks_include?(ids, client = nil) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/simplespotify/models/user.rb', line 41

def saved_tracks_include? ids, client=nil
  client ||= SimpleSpotify.default_client
  client.saved_tracks_include?(ids)
end

#unfollow(type, ids, client = nil) ⇒ Object



56
57
58
59
# File 'lib/simplespotify/models/user.rb', line 56

def unfollow type, ids, client=nil
  client ||= SimpleSpotify.default_client
  client.user_unfollow(type, ids)
end