Method: RSpotify::Player#initialize

Defined in:
lib/rspotify/player.rb

#initialize(user, options = {}) ⇒ Player

Returns a new instance of Player.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rspotify/player.rb', line 4

def initialize(user, options = {})
  @user = user

  @repeat_state           = options['repeat_state']
  @shuffle_state          = options['shuffle_state']
  @progress               = options['progress_ms']
  @is_playing             = options['is_playing']
  @currently_playing_type = options['currently_playing_type']
  @context_type           = options.dig('context', 'type')
  @context_uri            = options.dig('context', 'uri')

  @track = if options['track']
    Track.new options['track']
  end

  @device = if options['device']
    Device.new options['device']
  end
end