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 +4 -4
- data/lib/rspotify.rb +1 -0
- data/lib/rspotify/device.rb +19 -0
- data/lib/rspotify/user.rb +15 -0
- data/lib/rspotify/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9ea5b18ac0e9a38c03d231de16d8f0386178b09
|
4
|
+
data.tar.gz: 7599ceb37479b2a7fce0892090c0d27b1c03e0b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c19a812dbdf2ffeca4a223d494082d8886c5b17839497d1e23d48851998d38efd4e7dc79479a69a2603a1728a99fb73fb53afc2a35d3588aad74013e1ceadfd9
|
7
|
+
data.tar.gz: 9b5e8a23eb7eb33d0812628a91edcc86b759351ec63d11f2e98ff866eb1ca211f48c82325be8e00e68edb3c9b717f1fad3454e7e1c339769b4f3c299fecde40f
|
data/lib/rspotify.rb
CHANGED
@@ -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
|
data/lib/rspotify/user.rb
CHANGED
@@ -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
|
data/lib/rspotify/version.rb
CHANGED
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.
|
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-
|
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
|