class Spotify::SDK::Me::Info

Public Instance Methods

birthdate() click to toggle source

Get the user's birthdate. Requires the `user-read-birthdate` scope, otherwise it will return nil.

@example

@sdk.me.info.birthdate # => Wed, 10 May 1985

@return [Date,NilClass] birthdate Return the user's birthdate, otherwise return nil.

Calls superclass method
# File lib/spotify/sdk/me/info.rb, line 40
def birthdate
  Date.parse(super) if super
end
display_name?() click to toggle source

Does the user have a valid display_name?

@example

@sdk.me.info.display_name? # => false

@return [TrueClass,FalseClass] has_display_name Return true if the user has a non-empty display name.

# File lib/spotify/sdk/me/info.rb, line 52
def display_name?
  !display_name.to_s.empty?
end
followers() click to toggle source

Return the followers on Spotify for this user.

@example

me = @sdk.me.info
me.followers # => 13913

@return [Integer] followers The number of users following this user.

Calls superclass method
# File lib/spotify/sdk/me/info.rb, line 80
def followers
  super[:total]
end
free?() click to toggle source

Is the user currently on Spotify Free?

@example

@sdk.me.info.free?

@return [TrueClass,FalseClass] is_free Return true if user is on Spotify Free.

# File lib/spotify/sdk/me/info.rb, line 15
def free?
  product == "free"
end
images() click to toggle source

Get the images for the user.

@example

@sdk.me.info.images[0].spotify_uri # => "spotify:image:..."
@sdk.me.info.images[0].spotify_url # => "https://profile-images.scdn.co/..."

@return [Array] images A list of all user photos wrapped in Spotify::SDK::Image

Calls superclass method
# File lib/spotify/sdk/me/info.rb, line 65
def images
  super.map do |image|
    Spotify::SDK::Image.new(image, parent)
  end
end
premium?() click to toggle source

Is the user currently on Spotify Premium?

@example

@sdk.me.info.premium?

@return [TrueClass,FalseClass] is_premium Return true if user is on Spotify Premium.

# File lib/spotify/sdk/me/info.rb, line 27
def premium?
  product == "premium"
end
spotify_uri() click to toggle source

Get the Spotify URI for this user. Alias to self.uri

@example

@sdk.me.info.spotify_uri # => "spotify:user:..."

@return [String] spotify_uri The direct URI to this Spotify resource.

# File lib/spotify/sdk/me/info.rb, line 93
alias_attribute :spotify_uri, :uri
spotify_url() click to toggle source

Get the Spotify HTTP URL for this user. Alias to self.external_urls

@example

@sdk.me.info.spotify_url # => "https://open.spotify.com/..."

@return [String] spotify_url The direct HTTP URL to this Spotify resource.

# File lib/spotify/sdk/me/info.rb, line 104
alias_attribute :spotify_url, "external_urls.spotify"