Class: SpotifyWebApi::FollowersObject
- Defined in:
- lib/spotify_web_api/models/followers_object.rb
Overview
FollowersObject Model.
Instance Attribute Summary collapse
-
#href ⇒ String
This will always be set to null, as the Web API does not support it at the moment.
-
#total ⇒ Integer
The total number of followers.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(href = SKIP, total = SKIP) ⇒ FollowersObject
constructor
A new instance of FollowersObject.
Methods inherited from BaseModel
Constructor Details
#initialize(href = SKIP, total = SKIP) ⇒ FollowersObject
Returns a new instance of FollowersObject.
44 45 46 47 |
# File 'lib/spotify_web_api/models/followers_object.rb', line 44 def initialize(href = SKIP, total = SKIP) @href = href unless href == SKIP @total = total unless total == SKIP end |
Instance Attribute Details
#href ⇒ String
This will always be set to null, as the Web API does not support it at the moment.
15 16 17 |
# File 'lib/spotify_web_api/models/followers_object.rb', line 15 def href @href end |
#total ⇒ Integer
The total number of followers.
19 20 21 |
# File 'lib/spotify_web_api/models/followers_object.rb', line 19 def total @total end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/spotify_web_api/models/followers_object.rb', line 50 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. href = hash.key?('href') ? hash['href'] : SKIP total = hash.key?('total') ? hash['total'] : SKIP # Create object from extracted values. FollowersObject.new(href, total) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 |
# File 'lib/spotify_web_api/models/followers_object.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['href'] = 'href' @_hash['total'] = 'total' @_hash end |
.nullables ⇒ Object
An array for nullable fields
38 39 40 41 42 |
# File 'lib/spotify_web_api/models/followers_object.rb', line 38 def self.nullables %w[ href ] end |
.optionals ⇒ Object
An array for optional fields
30 31 32 33 34 35 |
# File 'lib/spotify_web_api/models/followers_object.rb', line 30 def self.optionals %w[ href total ] end |