Class: SpotifyWebApi::ExplicitContentSettingsObject

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

Overview

ExplicitContentSettingsObject Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(filter_enabled = SKIP, filter_locked = SKIP) ⇒ ExplicitContentSettingsObject

Returns a new instance of ExplicitContentSettingsObject.



42
43
44
45
# File 'lib/spotify_web_api/models/explicit_content_settings_object.rb', line 42

def initialize(filter_enabled = SKIP, filter_locked = SKIP)
  @filter_enabled = filter_enabled unless filter_enabled == SKIP
  @filter_locked = filter_locked unless filter_locked == SKIP
end

Instance Attribute Details

#filter_enabledTrueClass | FalseClass

When ‘true`, indicates that explicit content should not be played.

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/spotify_web_api/models/explicit_content_settings_object.rb', line 14

def filter_enabled
  @filter_enabled
end

#filter_lockedTrueClass | FalseClass

When ‘true`, indicates that the explicit content setting is locked and can’t be changed by the user.

Returns:

  • (TrueClass | FalseClass)


19
20
21
# File 'lib/spotify_web_api/models/explicit_content_settings_object.rb', line 19

def filter_locked
  @filter_locked
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
57
58
59
# File 'lib/spotify_web_api/models/explicit_content_settings_object.rb', line 48

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  filter_enabled =
    hash.key?('filter_enabled') ? hash['filter_enabled'] : SKIP
  filter_locked = hash.key?('filter_locked') ? hash['filter_locked'] : SKIP

  # Create object from extracted values.
  ExplicitContentSettingsObject.new(filter_enabled,
                                    filter_locked)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/spotify_web_api/models/explicit_content_settings_object.rb', line 22

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

.nullablesObject

An array for nullable fields



38
39
40
# File 'lib/spotify_web_api/models/explicit_content_settings_object.rb', line 38

def self.nullables
  []
end

.optionalsObject

An array for optional fields



30
31
32
33
34
35
# File 'lib/spotify_web_api/models/explicit_content_settings_object.rb', line 30

def self.optionals
  %w[
    filter_enabled
    filter_locked
  ]
end