Class: SpotifyWebApi::ResumePointObject

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

Overview

ResumePointObject Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(fully_played = SKIP, resume_position_ms = SKIP) ⇒ ResumePointObject

Returns a new instance of ResumePointObject.



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

def initialize(fully_played = SKIP, resume_position_ms = SKIP)
  @fully_played = fully_played unless fully_played == SKIP
  @resume_position_ms = resume_position_ms unless resume_position_ms == SKIP
end

Instance Attribute Details

#fully_playedTrueClass | FalseClass

Whether or not the episode has been fully played by the user.

Returns:

  • (TrueClass | FalseClass)


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

def fully_played
  @fully_played
end

#resume_position_msInteger

The user’s most recent position in the episode in milliseconds.

Returns:

  • (Integer)


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

def resume_position_ms
  @resume_position_ms
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

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

  # Create object from extracted values.
  ResumePointObject.new(fully_played,
                        resume_position_ms)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



37
38
39
# File 'lib/spotify_web_api/models/resume_point_object.rb', line 37

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    fully_played
    resume_position_ms
  ]
end