rspotify 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e109369a08f44ff26605781f94c334eabf9adebb
4
- data.tar.gz: 052a974c33f640fd724830308517f55a87496f8b
3
+ metadata.gz: 8bc7c509b39843b4eadaaf91148cfe735a850908
4
+ data.tar.gz: e2757b03a0eb8dcd677e10f5317a558485701a1a
5
5
  SHA512:
6
- metadata.gz: 38acfebceb65b64f604ec374f25798d7c8a825e3ca8b4e04b76c0f51a3c8d60e1ba44d6263cad3422dacbd8b9b58b7fdf28a2d6ee58eae224fb5d4e07d254d22
7
- data.tar.gz: dcb54349b342b67acd931ca7ac57e7ef9d02b30d958f56b898db88388aa9407729b1cbead35307142a996346e61ae8f5a05e912f8629947c0cc71293ef3c213c
6
+ metadata.gz: 30531c4d431ae5774e792c31b1684b500acc43438e605ccdcd22aeb8a5d6d4e332a9c9fbdd8cca9ef0bbe7e366c7e7f3e78db1619724fa3b7ed228dea0cfbd2d
7
+ data.tar.gz: 6f4a5d9428e7161e3102f44e4ec993e165f2aa44cd494f3e539a0ad48736becd302c8196b5d92887b4328fd87efac14b9514a763b8e370cbf13cfcf563243e28
@@ -70,6 +70,26 @@ module RSpotify
70
70
  User.oauth_put(@user.id, url, params.to_json)
71
71
  end
72
72
 
73
+ # Toggle the current user's player repeat status.
74
+ # If `device_id` is not passed, the currently active spotify app will be triggered.
75
+ # If `state` is not passed, the currently active context will be set to repeat.
76
+ #
77
+ # @see https://developer.spotify.com/documentation/web-api/reference/player/set-repeat-mode-on-users-playback/
78
+ #
79
+ # @param [String] device_id the ID of the device to set the repeat state on.
80
+ # @param [String] state the repeat state. Defaults to the current play context.
81
+ #
82
+ # @example
83
+ # player = user.player
84
+ # player.repeat(state: 'track')
85
+ def repeat(device_id: nil, state: "context")
86
+ url = "me/player/repeat"
87
+ url += "?state=#{state}"
88
+ url += "&device_id=#{device_id}" if device_id
89
+
90
+ User.oauth_put(@user.id, url, {})
91
+ end
92
+
73
93
  # Pause the user's currently active player
74
94
  #
75
95
  # @example
@@ -80,6 +100,26 @@ module RSpotify
80
100
  User.oauth_put(@user.id, url, {})
81
101
  end
82
102
 
103
+ # Toggle the current user's shuffle status.
104
+ # If `device_id` is not passed, the currently active spotify app will be triggered.
105
+ # If `state` is not passed, shuffle mode will be turned on.
106
+ #
107
+ # @see https://developer.spotify.com/documentation/web-api/reference/player/toggle-shuffle-for-users-playback/
108
+ #
109
+ # @param [String] device_id the ID of the device to set the shuffle state on.
110
+ # @param [String] state the shuffle state. Defaults to turning the shuffle behavior on.
111
+ #
112
+ # @example
113
+ # player = user.player
114
+ # player.shuffle(state: false)
115
+ def shuffle(device_id: nil, state: true)
116
+ url = "me/player/shuffle"
117
+ url += "?state=#{state}"
118
+ url += "&device_id=#{device_id}" if device_id
119
+
120
+ User.oauth_put(@user.id, url, {})
121
+ end
122
+
83
123
  # Skip User’s Playback To Next Track
84
124
  #
85
125
  # @example
@@ -1,3 +1,3 @@
1
1
  module RSpotify
2
- VERSION = '2.5.0'
2
+ VERSION = '2.6.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: 2.5.0
4
+ version: 2.6.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: 2019-02-28 00:00:00.000000000 Z
11
+ date: 2019-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2