Class: SpotifyWebApi::AlbumRestrictionObject

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/spotify_web_api/models/album_restriction_object.rb

Overview

AlbumRestrictionObject Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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

#reasonReasonEnum

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.

Returns:



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

.namesObject

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

.nullablesObject

An array for nullable fields



34
35
36
# File 'lib/spotify_web_api/models/album_restriction_object.rb', line 34

def self.nullables
  []
end

.optionalsObject

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