Class: RSpotify::Device

Inherits:
Base
  • Object
show all
Defined in:
lib/rspotify/device.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#external_urls, #href, #uri

Instance Method Summary collapse

Methods inherited from Base

#complete!, #embed, find, #method_missing, #respond_to?, search

Constructor Details

#initialize(options = {}) ⇒ Device

Returns a new instance of Device.



10
11
12
13
14
15
16
17
# File 'lib/rspotify/device.rb', line 10

def initialize(options = {})
  @id             = options['id']
  @is_active      = options['is_active']
  @is_restricted  = options['is_restricted']
  @name           = options['name']
  @type           = options['type']
  @volume_percent = options['volume_percent']
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RSpotify::Base

Instance Attribute Details

#idString

The device ID. This may be null

Returns:

  • (String)

    the current value of id



9
10
11
# File 'lib/rspotify/device.rb', line 9

def id
  @id
end

#is_activeBoolean

If this device is the currently active device

Returns:

  • (Boolean)

    the current value of is_active



9
10
11
# File 'lib/rspotify/device.rb', line 9

def is_active
  @is_active
end

#is_restrictedBoolean

Whether controlling this device is restricted. At present if this is “true” then no Web API commands will be accepted by this device.

Returns:

  • (Boolean)

    the current value of is_restricted



9
10
11
# File 'lib/rspotify/device.rb', line 9

def is_restricted
  @is_restricted
end

#nameString

The name of the device

Returns:

  • (String)

    the current value of name



9
10
11
# File 'lib/rspotify/device.rb', line 9

def name
  @name
end

#typeString

Device type, such as “Computer”, “Smartphone” or “Speaker”.

Returns:

  • (String)

    the current value of type



9
10
11
# File 'lib/rspotify/device.rb', line 9

def type
  @type
end

#volume_percentString

The current volume in percent. This may be null

Returns:

  • (String)

    the current value of volume_percent



9
10
11
# File 'lib/rspotify/device.rb', line 9

def volume_percent
  @volume_percent
end