rspotify 2.11.1 → 2.12.0
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/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: 9ad5348b6d88e2e2f36d4f8a08a5979e84cf6b09c0674c65ce49095b7536284d
|
4
|
+
data.tar.gz: 2a369690af6ad4401c081ff980d156fd31eaa853ab5b36a7a0b4bede28ec53e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a9f861ce328736c47078c3f64b051621e3c442037c9636e24bf64dbde4c85a7efcc0fb3ec7c85db96fb297b41a7f0a37b20446e0ecfa0d1ab8f23d682c1a202
|
7
|
+
data.tar.gz: 84e5dcfecd734d927b63a79365b5a4dc0669dec8412028322d19944be7f4995d15a0adaaf4287066de66bf6452c29003fd6a2e6cfa29a1bc2d9a9b8da223b09e
|
@@ -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/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.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:
|
11
|
+
date: 2023-08-20 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
|