Class: SpotifyWebApi::ChapterRestrictionObject

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

Overview

ChapterRestrictionObject 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) ⇒ ChapterRestrictionObject

Returns a new instance of ChapterRestrictionObject.



44
45
46
# File 'lib/spotify_web_api/models/chapter_restriction_object.rb', line 44

def initialize(reason = SKIP)
  @reason = reason unless reason == SKIP
end

Instance Attribute Details

#reasonString

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.

  • ‘payment_required` - Payment is required to play the content item.

Additional reasons may be added in the future. Note: If you use this field, make sure that your application safely handles unknown values.

Returns:

  • (String)


23
24
25
# File 'lib/spotify_web_api/models/chapter_restriction_object.rb', line 23

def reason
  @reason
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



49
50
51
52
53
54
55
56
57
# File 'lib/spotify_web_api/models/chapter_restriction_object.rb', line 49

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.
  ChapterRestrictionObject.new(reason)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
# File 'lib/spotify_web_api/models/chapter_restriction_object.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reason'] = 'reason'
  @_hash
end

.nullablesObject

An array for nullable fields



40
41
42
# File 'lib/spotify_web_api/models/chapter_restriction_object.rb', line 40

def self.nullables
  []
end

.optionalsObject

An array for optional fields



33
34
35
36
37
# File 'lib/spotify_web_api/models/chapter_restriction_object.rb', line 33

def self.optionals
  %w[
    reason
  ]
end