rspotify 2.11.1 → 2.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +26 -0
- data/.gitignore +2 -0
- data/README.md +5 -3
- data/lib/rspotify/player.rb +16 -0
- data/lib/rspotify/playlist.rb +5 -2
- data/lib/rspotify/version.rb +1 -1
- data/rspotify.gemspec +1 -1
- metadata +5 -5
- data/.travis.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aa870c1626f1912080858169ae6dfaedcaa3d80b1a054b90d045a0674717cbe
|
4
|
+
data.tar.gz: 3f3b4138467008192be294bee7afdc0d1c0970bedf6410eb8262fb6567e6b34f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09746a6f4b21b8ff50877afaed94c34332e2cb6ac34df5c1a3b599d68cc92bbe8314f287432da0a018d38002d662c9704f784e0662dee7a531d02a54a76e6fc2'
|
7
|
+
data.tar.gz: 4574ab6c8f9a6ec06ab058cbdb611179275933fa2a57c755567df6c467a9fb7d017e33a68a1e4b3208c406741832d7009c9ad138b33817b5b115eeb54f961558
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby-version: ['head', '3.1', '3.0', '2.7', '2.6', '2.3']
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
|
16
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
20
|
+
bundler-cache: true
|
21
|
+
|
22
|
+
- name: Install dependencies
|
23
|
+
run: bundle install
|
24
|
+
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# RSpotify
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/rspotify.svg)](http://badge.fury.io/rb/rspotify)
|
4
|
-
[![Build Status](https://
|
4
|
+
[![Build Status](https://github.com/guilhermesad/rspotify/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/guilhermesad/rspotify/actions)
|
5
5
|
|
6
6
|
This is a ruby wrapper for the [Spotify Web API](https://developer.spotify.com/web-api).
|
7
7
|
|
@@ -31,7 +31,7 @@ RSpotify was designed with usability as its primary goal, so that you can forget
|
|
31
31
|
|
32
32
|
You can write things like `my_playlist.tracks.sort_by(&:popularity).last.album` without having to think which API calls must be done. RSpotify fills the gaps for you.
|
33
33
|
|
34
|
-
Below are some basic usage examples. Check the [documentation](http://
|
34
|
+
Below are some basic usage examples. Check the [documentation](http://rubydoc.info/github/guilhermesad/rspotify/master/frames) for the complete reference.
|
35
35
|
|
36
36
|
```ruby
|
37
37
|
require 'rspotify'
|
@@ -153,6 +153,8 @@ require 'rspotify/oauth'
|
|
153
153
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
154
154
|
provider :spotify, "<your_client_id>", "<your_client_secret>", scope: 'user-read-email playlist-modify-public user-library-read user-library-modify'
|
155
155
|
end
|
156
|
+
|
157
|
+
OmniAuth.config.allowed_request_methods = [:post, :get]
|
156
158
|
```
|
157
159
|
|
158
160
|
You should replace the scope values for the ones your own app will require from the user. You can see the list of available scopes in [here](https://developer.spotify.com/documentation/general/guides/authorization/scopes/).
|
@@ -160,7 +162,7 @@ You should replace the scope values for the ones your own app will require from
|
|
160
162
|
Next, make a link so the user can log in with his Spotify account:
|
161
163
|
|
162
164
|
```ruby
|
163
|
-
<%= link_to 'Sign in with Spotify', '/auth/spotify' %>
|
165
|
+
<%= link_to 'Sign in with Spotify', '/auth/spotify', method: :post %>
|
164
166
|
```
|
165
167
|
|
166
168
|
And create a route to receive the callback:
|
data/lib/rspotify/player.rb
CHANGED
@@ -73,6 +73,22 @@ module RSpotify
|
|
73
73
|
User.oauth_put(@user.id, url, params.to_json)
|
74
74
|
end
|
75
75
|
|
76
|
+
# Get the user’s current playback queue
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# player = user.player
|
80
|
+
# player.next_up
|
81
|
+
def next_up
|
82
|
+
url = "me/player/queue"
|
83
|
+
response = User.oauth_get(@user.id, url)
|
84
|
+
return response if RSpotify.raw_response
|
85
|
+
|
86
|
+
response["queue"].map do |item|
|
87
|
+
type_class = RSpotify.const_get(item["type"].capitalize)
|
88
|
+
type_class.new item
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
76
92
|
# Add an item to the end of the user’s current playback queue
|
77
93
|
# If `device_id` is not passed, the currently active spotify app will be triggered
|
78
94
|
#
|
data/lib/rspotify/playlist.rb
CHANGED
@@ -128,8 +128,11 @@ module RSpotify
|
|
128
128
|
|
129
129
|
super(options)
|
130
130
|
|
131
|
-
@path =
|
132
|
-
|
131
|
+
@path = if @href =~ /\/starred$/
|
132
|
+
"users/#{@owner.instance_variable_get('@id').gsub('?','')}/starred"
|
133
|
+
else
|
134
|
+
"playlists/#{@id}"
|
135
|
+
end
|
133
136
|
end
|
134
137
|
|
135
138
|
# Adds one or more tracks to a playlist in user's Spotify account. This method is only available when the
|
data/lib/rspotify/version.rb
CHANGED
data/rspotify.gemspec
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: 2.
|
4
|
+
version: 2.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Sad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -145,9 +145,9 @@ extra_rdoc_files: []
|
|
145
145
|
files:
|
146
146
|
- ".editorconfig"
|
147
147
|
- ".github/FUNDING.yml"
|
148
|
+
- ".github/workflows/main.yml"
|
148
149
|
- ".gitignore"
|
149
150
|
- ".rspec"
|
150
|
-
- ".travis.yml"
|
151
151
|
- Gemfile
|
152
152
|
- LICENSE.txt
|
153
153
|
- README.md
|
@@ -294,14 +294,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
294
294
|
requirements:
|
295
295
|
- - ">="
|
296
296
|
- !ruby/object:Gem::Version
|
297
|
-
version: 2.
|
297
|
+
version: 2.3.0
|
298
298
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
299
299
|
requirements:
|
300
300
|
- - ">="
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
version: '0'
|
303
303
|
requirements: []
|
304
|
-
rubygems_version: 3.
|
304
|
+
rubygems_version: 3.1.6
|
305
305
|
signing_key:
|
306
306
|
specification_version: 4
|
307
307
|
summary: A ruby wrapper for the Spotify Web API
|