Class: SpotifyWebApi::AlbumRestrictionObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::AlbumRestrictionObject
- Defined in:
- lib/spotify_web_api/models/album_restriction_object.rb
Overview
AlbumRestrictionObject Model.
Instance Attribute Summary collapse
-
#reason ⇒ ReasonEnum
The reason for the restriction.
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(reason = SKIP) ⇒ AlbumRestrictionObject
constructor
A new instance of AlbumRestrictionObject.
Methods inherited from BaseModel
Constructor Details
#initialize(reason = SKIP) ⇒ AlbumRestrictionObject
Returns a new instance of AlbumRestrictionObject.
38 39 40 |
# File 'lib/spotify_web_api/models/album_restriction_object.rb', line 38 def initialize(reason = SKIP) @reason = reason unless reason == SKIP end |
Instance Attribute Details
#reason ⇒ ReasonEnum
The reason for the restriction. Albums may be restricted if the content is not available in a given market, to the user’s subscription type, or when the user’s account is set to not play explicit content. Additional reasons may be added in the future.
17 18 19 |
# File 'lib/spotify_web_api/models/album_restriction_object.rb', line 17 def reason @reason end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
43 44 45 46 47 48 49 50 51 |
# File 'lib/spotify_web_api/models/album_restriction_object.rb', line 43 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reason = hash.key?('reason') ? hash['reason'] : SKIP # Create object from extracted values. AlbumRestrictionObject.new(reason) end |
.names ⇒ Object
A mapping from model property names to API property names.
20 21 22 23 24 |
# File 'lib/spotify_web_api/models/album_restriction_object.rb', line 20 def self.names @_hash = {} if @_hash.nil? @_hash['reason'] = 'reason' @_hash end |
.nullables ⇒ Object
An array for nullable fields
34 35 36 |
# File 'lib/spotify_web_api/models/album_restriction_object.rb', line 34 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
27 28 29 30 31 |
# File 'lib/spotify_web_api/models/album_restriction_object.rb', line 27 def self.optionals %w[ reason ] end |