Class: Spotify::SDK::Me::Info
- Inherits:
-
Spotify::SDK::Model
- Object
- OpenStruct
- Spotify::SDK::Model
- Spotify::SDK::Me::Info
- Defined in:
- lib/spotify/sdk/me/info.rb
Instance Attribute Summary
Attributes inherited from Spotify::SDK::Model
Instance Method Summary collapse
-
#birthdate ⇒ Date, NilClass
Get the user's birthdate.
-
#display_name? ⇒ TrueClass, FalseClass
Does the user have a valid display_name?.
-
#followers ⇒ Integer
Return the followers on Spotify for this user.
-
#free? ⇒ TrueClass, FalseClass
Is the user currently on Spotify Free?.
-
#images ⇒ Array
Get the images for the user.
-
#premium? ⇒ TrueClass, FalseClass
Is the user currently on Spotify Premium?.
-
#spotify_uri ⇒ String
Get the Spotify URI for this user.
-
#spotify_url ⇒ String
Get the Spotify HTTP URL for this user.
Methods inherited from Spotify::SDK::Model
alias_attribute, hash_selector, #initialize, #to_h, #to_json
Constructor Details
This class inherits a constructor from Spotify::SDK::Model
Instance Method Details
#birthdate ⇒ Date, NilClass
Get the user's birthdate. Requires the `user-read-birthdate` scope, otherwise it will return nil.
40 41 42 |
# File 'lib/spotify/sdk/me/info.rb', line 40 def birthdate Date.parse(super) if super end |
#display_name? ⇒ TrueClass, FalseClass
Does the user have a valid display_name?
52 53 54 |
# File 'lib/spotify/sdk/me/info.rb', line 52 def display_name? !display_name.to_s.empty? end |
#followers ⇒ Integer
Return the followers on Spotify for this user.
80 81 82 |
# File 'lib/spotify/sdk/me/info.rb', line 80 def followers super[:total] end |
#free? ⇒ TrueClass, FalseClass
Is the user currently on Spotify Free?
15 16 17 |
# File 'lib/spotify/sdk/me/info.rb', line 15 def free? product == "free" end |
#images ⇒ Array
Get the images for the user.
65 66 67 68 69 |
# File 'lib/spotify/sdk/me/info.rb', line 65 def images super.map do |image| Spotify::SDK::Image.new(image, parent) end end |
#premium? ⇒ TrueClass, FalseClass
Is the user currently on Spotify Premium?
27 28 29 |
# File 'lib/spotify/sdk/me/info.rb', line 27 def premium? product == "premium" end |
#spotify_uri ⇒ String
Get the Spotify URI for this user. Alias to self.uri
93 |
# File 'lib/spotify/sdk/me/info.rb', line 93 alias_attribute :spotify_uri, :uri |
#spotify_url ⇒ String
Get the Spotify HTTP URL for this user. Alias to self.external_urls
104 |
# File 'lib/spotify/sdk/me/info.rb', line 104 alias_attribute :spotify_url, "external_urls.spotify" |