Class: SpotifyWebApi::TrackRestrictionObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::TrackRestrictionObject
- Defined in:
- lib/spotify_web_api/models/track_restriction_object.rb
Overview
TrackRestrictionObject Model.
Instance Attribute Summary collapse
-
#reason ⇒ String
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) ⇒ TrackRestrictionObject
constructor
A new instance of TrackRestrictionObject.
Methods inherited from BaseModel
Constructor Details
#initialize(reason = SKIP) ⇒ TrackRestrictionObject
Returns a new instance of TrackRestrictionObject.
43 44 45 |
# File 'lib/spotify_web_api/models/track_restriction_object.rb', line 43 def initialize(reason = SKIP) @reason = reason unless reason == SKIP end |
Instance Attribute Details
#reason ⇒ String
The reason for the restriction. Supported values:
-
‘market` - The content item is not available in the given market.
-
‘product` - The content item is not available for the user’s
subscription type.
-
‘explicit` - The content item is explicit and the user’s account is set
to not play explicit content. Additional reasons may be added in the future. Note: If you use this field, make sure that your application safely handles unknown values.
22 23 24 |
# File 'lib/spotify_web_api/models/track_restriction_object.rb', line 22 def reason @reason end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
48 49 50 51 52 53 54 55 56 |
# File 'lib/spotify_web_api/models/track_restriction_object.rb', line 48 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. TrackRestrictionObject.new(reason) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 |
# File 'lib/spotify_web_api/models/track_restriction_object.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['reason'] = 'reason' @_hash end |
.nullables ⇒ Object
An array for nullable fields
39 40 41 |
# File 'lib/spotify_web_api/models/track_restriction_object.rb', line 39 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
32 33 34 35 36 |
# File 'lib/spotify_web_api/models/track_restriction_object.rb', line 32 def self.optionals %w[ reason ] end |