Class: SpotifyWebApi::DisallowsObject

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

Overview

DisallowsObject Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(interrupting_playback = SKIP, pausing = SKIP, resuming = SKIP, seeking = SKIP, skipping_next = SKIP, skipping_prev = SKIP, toggling_repeat_context = SKIP, toggling_shuffle = SKIP, toggling_repeat_track = SKIP, transferring_playback = SKIP) ⇒ DisallowsObject

Returns a new instance of DisallowsObject.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/spotify_web_api/models/disallows_object.rb', line 89

def initialize(interrupting_playback = SKIP, pausing = SKIP,
               resuming = SKIP, seeking = SKIP, skipping_next = SKIP,
               skipping_prev = SKIP, toggling_repeat_context = SKIP,
               toggling_shuffle = SKIP, toggling_repeat_track = SKIP,
               transferring_playback = SKIP)
  @interrupting_playback = interrupting_playback unless interrupting_playback == SKIP
  @pausing = pausing unless pausing == SKIP
  @resuming = resuming unless resuming == SKIP
  @seeking = seeking unless seeking == SKIP
  @skipping_next = skipping_next unless skipping_next == SKIP
  @skipping_prev = skipping_prev unless skipping_prev == SKIP
  @toggling_repeat_context = toggling_repeat_context unless toggling_repeat_context == SKIP
  @toggling_shuffle = toggling_shuffle unless toggling_shuffle == SKIP
  @toggling_repeat_track = toggling_repeat_track unless toggling_repeat_track == SKIP
  @transferring_playback = transferring_playback unless transferring_playback == SKIP
end

Instance Attribute Details

#interrupting_playbackTrueClass | FalseClass

Interrupting playback. Optional field.

Returns:

  • (TrueClass | FalseClass)


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

def interrupting_playback
  @interrupting_playback
end

#pausingTrueClass | FalseClass

Pausing. Optional field.

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/spotify_web_api/models/disallows_object.rb', line 18

def pausing
  @pausing
end

#resumingTrueClass | FalseClass

Resuming. Optional field.

Returns:

  • (TrueClass | FalseClass)


22
23
24
# File 'lib/spotify_web_api/models/disallows_object.rb', line 22

def resuming
  @resuming
end

#seekingTrueClass | FalseClass

Seeking playback location. Optional field.

Returns:

  • (TrueClass | FalseClass)


26
27
28
# File 'lib/spotify_web_api/models/disallows_object.rb', line 26

def seeking
  @seeking
end

#skipping_nextTrueClass | FalseClass

Skipping to the next context. Optional field.

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/spotify_web_api/models/disallows_object.rb', line 30

def skipping_next
  @skipping_next
end

#skipping_prevTrueClass | FalseClass

Skipping to the previous context. Optional field.

Returns:

  • (TrueClass | FalseClass)


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

def skipping_prev
  @skipping_prev
end

#toggling_repeat_contextTrueClass | FalseClass

Toggling repeat context flag. Optional field.

Returns:

  • (TrueClass | FalseClass)


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

def toggling_repeat_context
  @toggling_repeat_context
end

#toggling_repeat_trackTrueClass | FalseClass

Toggling repeat track flag. Optional field.

Returns:

  • (TrueClass | FalseClass)


46
47
48
# File 'lib/spotify_web_api/models/disallows_object.rb', line 46

def toggling_repeat_track
  @toggling_repeat_track
end

#toggling_shuffleTrueClass | FalseClass

Toggling shuffle flag. Optional field.

Returns:

  • (TrueClass | FalseClass)


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

def toggling_shuffle
  @toggling_shuffle
end

#transferring_playbackTrueClass | FalseClass

Transfering playback between devices. Optional field.

Returns:

  • (TrueClass | FalseClass)


50
51
52
# File 'lib/spotify_web_api/models/disallows_object.rb', line 50

def transferring_playback
  @transferring_playback
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/spotify_web_api/models/disallows_object.rb', line 107

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  interrupting_playback =
    hash.key?('interrupting_playback') ? hash['interrupting_playback'] : SKIP
  pausing = hash.key?('pausing') ? hash['pausing'] : SKIP
  resuming = hash.key?('resuming') ? hash['resuming'] : SKIP
  seeking = hash.key?('seeking') ? hash['seeking'] : SKIP
  skipping_next = hash.key?('skipping_next') ? hash['skipping_next'] : SKIP
  skipping_prev = hash.key?('skipping_prev') ? hash['skipping_prev'] : SKIP
  toggling_repeat_context =
    hash.key?('toggling_repeat_context') ? hash['toggling_repeat_context'] : SKIP
  toggling_shuffle =
    hash.key?('toggling_shuffle') ? hash['toggling_shuffle'] : SKIP
  toggling_repeat_track =
    hash.key?('toggling_repeat_track') ? hash['toggling_repeat_track'] : SKIP
  transferring_playback =
    hash.key?('transferring_playback') ? hash['transferring_playback'] : SKIP

  # Create object from extracted values.
  DisallowsObject.new(interrupting_playback,
                      pausing,
                      resuming,
                      seeking,
                      skipping_next,
                      skipping_prev,
                      toggling_repeat_context,
                      toggling_shuffle,
                      toggling_repeat_track,
                      transferring_playback)
end

.namesObject

A mapping from model property names to API property names.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/spotify_web_api/models/disallows_object.rb', line 53

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['interrupting_playback'] = 'interrupting_playback'
  @_hash['pausing'] = 'pausing'
  @_hash['resuming'] = 'resuming'
  @_hash['seeking'] = 'seeking'
  @_hash['skipping_next'] = 'skipping_next'
  @_hash['skipping_prev'] = 'skipping_prev'
  @_hash['toggling_repeat_context'] = 'toggling_repeat_context'
  @_hash['toggling_shuffle'] = 'toggling_shuffle'
  @_hash['toggling_repeat_track'] = 'toggling_repeat_track'
  @_hash['transferring_playback'] = 'transferring_playback'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
# File 'lib/spotify_web_api/models/disallows_object.rb', line 85

def self.nullables
  []
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/spotify_web_api/models/disallows_object.rb', line 69

def self.optionals
  %w[
    interrupting_playback
    pausing
    resuming
    seeking
    skipping_next
    skipping_prev
    toggling_repeat_context
    toggling_shuffle
    toggling_repeat_track
    transferring_playback
  ]
end