rspotify 1.26.0 → 1.27.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bc5d8b598c4b640f11fbb275717b5c9935416df
4
- data.tar.gz: dbf190b220aaa14fe3a1d2b145f966da8f517b29
3
+ metadata.gz: a9ea5b18ac0e9a38c03d231de16d8f0386178b09
4
+ data.tar.gz: 7599ceb37479b2a7fce0892090c0d27b1c03e0b3
5
5
  SHA512:
6
- metadata.gz: cc831e87cd9e4510ed841aa51ae79c29a4188dde8ff339572d31fc2ec934dc53ae60e0af0282ca10a02c48b9c44bb7770cbcd412b946b21493579d04d4eb5bf4
7
- data.tar.gz: 2c3775293b7ccac518b71f3bb894957db0039e862bc938c96b6613b6ede5b9e7f7435346ebbd16d5979490528b8e2ed2a38036342bce8abb3f6f581a25fb95ff
6
+ metadata.gz: c19a812dbdf2ffeca4a223d494082d8886c5b17839497d1e23d48851998d38efd4e7dc79479a69a2603a1728a99fb73fb53afc2a35d3588aad74013e1ceadfd9
7
+ data.tar.gz: 9b5e8a23eb7eb33d0812628a91edcc86b759351ec63d11f2e98ff866eb1ca211f48c82325be8e00e68edb3c9b717f1fad3454e7e1c339769b4f3c299fecde40f
@@ -7,6 +7,7 @@ module RSpotify
7
7
  autoload :AudioFeatures, 'rspotify/audio_features'
8
8
  autoload :Base, 'rspotify/base'
9
9
  autoload :Category, 'rspotify/category'
10
+ autoload :Device, 'rspotify/device'
10
11
  autoload :TrackLink, 'rspotify/track_link'
11
12
  autoload :Playlist, 'rspotify/playlist'
12
13
  autoload :Recommendations, 'rspotify/recommendations'
@@ -0,0 +1,19 @@
1
+ module RSpotify
2
+
3
+ # @attr [String] id The device ID. This may be null
4
+ # @attr [Boolean] is_active If this device is the currently active device
5
+ # @attr [Boolean] is_restricted Whether controlling this device is restricted. At present if this is "true" then no Web API commands will be accepted by this device.
6
+ # @attr [String] name The name of the device
7
+ # @attr [String] type Device type, such as "Computer", "Smartphone" or "Speaker".
8
+ # @attr [String] volume_percent The current volume in percent. This may be null
9
+ class Device < Base
10
+ def initialize(options = {})
11
+ @id = options['id']
12
+ @is_active = options['is_active']
13
+ @is_restricted = options['is_restricted']
14
+ @name = options['name']
15
+ @type = options['type']
16
+ @volume_percent = options['volume_percent']
17
+ end
18
+ end
19
+ end
@@ -505,5 +505,20 @@ module RSpotify
505
505
  User.oauth_delete(@id, url)
506
506
  unfollowed
507
507
  end
508
+
509
+ # Returns the user's available devices
510
+ #
511
+ # @return [Array<Device>]
512
+ #
513
+ # @example
514
+ # devices = user.devices
515
+ # devices.first.id #=> "5fbb3ba6aa454b5534c4ba43a8c7e8e45a63ad0e"
516
+ def devices
517
+ url = "me/player/devices"
518
+ response = RSpotify.resolve_auth_request(@id, url)
519
+
520
+ return response if RSpotify.raw_response
521
+ response['devices'].map { |i| Device.new i }
522
+ end
508
523
  end
509
524
  end
@@ -1,3 +1,3 @@
1
1
  module RSpotify
2
- VERSION = '1.26.0'
2
+ VERSION = '1.27.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.26.0
4
+ version: 1.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Sad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-28 00:00:00.000000000 Z
11
+ date: 2018-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -144,6 +144,7 @@ files:
144
144
  - lib/rspotify/base.rb
145
145
  - lib/rspotify/category.rb
146
146
  - lib/rspotify/connection.rb
147
+ - lib/rspotify/device.rb
147
148
  - lib/rspotify/oauth.rb
148
149
  - lib/rspotify/playlist.rb
149
150
  - lib/rspotify/recommendation_seed.rb