spotify-ruby 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CONTRIBUTING.md +3 -0
- data/.github/ISSUE_TEMPLATE.md +27 -0
- data/.rubocop.yml +1 -1
- data/lib/spotify/sdk/connect/device.rb +38 -10
- data/lib/spotify/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75f97a2dfbc52f0a0aced0874048df14cf32f1d2
|
4
|
+
data.tar.gz: 2071351feb0057354dd40bbc2a44d9d4c5054cff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b73965a3d6c73490ceaf513921596f7c8cac65b5a849bfc6d4345841331ac493fdc0b2fff9a7f11023a8eba3e472040271b6c8832bfd6e1b6f9848b1b51f0e36
|
7
|
+
data.tar.gz: b9646f1e3222f601010059a1330c7d31b18c9baac520460d1696d3ea5ea1f33d7cabe633223b609a47a2195c9211df3b2e96d9eae8cc067dd1af09b3718dfc0c
|
@@ -0,0 +1,27 @@
|
|
1
|
+
*Before you log an issue, please, make sure
|
2
|
+
that the problem you're reporting
|
3
|
+
hasn't been reported (and potentially fixed) already.*
|
4
|
+
|
5
|
+
*Please provide an unambiguous title for the issue.
|
6
|
+
Be clear and precise in your description of the problem.
|
7
|
+
Use the template below when reporting bugs*
|
8
|
+
|
9
|
+
*Before filing the ticket you should replace all text above the horizontal
|
10
|
+
rule with your own words.*
|
11
|
+
|
12
|
+
--------
|
13
|
+
|
14
|
+
## Expected behavior
|
15
|
+
|
16
|
+
Describe here how you expected spotify-ruby to behave in this particular situation.
|
17
|
+
|
18
|
+
## Actual behavior
|
19
|
+
|
20
|
+
Describe here what actually happened.
|
21
|
+
|
22
|
+
## Steps to reproduce the problem
|
23
|
+
|
24
|
+
This is extremely important! Providing us with a reliable way to reproduce
|
25
|
+
a problem will expedite its solution.
|
26
|
+
|
27
|
+
## Spotify-ruby version
|
data/.rubocop.yml
CHANGED
@@ -14,7 +14,7 @@ Metrics/LineLength:
|
|
14
14
|
# Too short methods lead to extraction of single-use methods, which can make
|
15
15
|
# the code easier to read (by naming things), but can also clutter the class
|
16
16
|
Metrics/MethodLength:
|
17
|
-
Max:
|
17
|
+
Max: 25
|
18
18
|
|
19
19
|
# The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
|
20
20
|
Metrics/ClassLength:
|
@@ -76,37 +76,65 @@ module Spotify
|
|
76
76
|
#
|
77
77
|
# # Play from a playlist, album from a specific index in that list.
|
78
78
|
# # For example, play the 9th item on X playlist.
|
79
|
-
# device.play!(
|
79
|
+
# device.play!(
|
80
|
+
# index: 5,
|
81
|
+
# context: "spotify:album:5ht7ItJgpBH7W6vJ5BqpPr",
|
82
|
+
# position_ms: 0
|
83
|
+
# )
|
80
84
|
#
|
81
85
|
# # Play any Spotify URI. Albums, artists, tracks, playlists, and more.
|
82
|
-
# device.play!(
|
86
|
+
# device.play!(
|
87
|
+
# uri: "spotify:track:5MqkZd7a7u7N7hKMqquL2U",
|
88
|
+
# position_ms: 0
|
89
|
+
# )
|
83
90
|
#
|
84
91
|
# # Similar to just uri, but you can define the context.
|
85
92
|
# # Useful for playing a track that is part of a playlist, and you want the next
|
86
93
|
# # songs to play from that particular context.
|
87
|
-
# device.play!(
|
94
|
+
# device.play!(
|
95
|
+
# uri: "spotify:track:5MqkZd7a7u7N7hKMqquL2U",
|
96
|
+
# context: "spotify:album:5ht7ItJgpBH7W6vJ5BqpPr",
|
97
|
+
# position_ms: 0
|
98
|
+
# )
|
99
|
+
#
|
100
|
+
# # Play a track, and immediately seek to 60 seconds.
|
101
|
+
# device.play!(
|
102
|
+
# index: 5,
|
103
|
+
# context: "spotify:album:5ht7ItJgpBH7W6vJ5BqpPr",
|
104
|
+
# position_ms: 60 * 1000
|
105
|
+
# )
|
88
106
|
#
|
89
107
|
# @see https://developer.spotify.com/console/put-play/
|
90
108
|
#
|
91
109
|
# @param [Hash] config The play config you'd like to set. See code examples.
|
92
110
|
# @return [Spotify::SDK::Connect::Device] self Return itself, so chained methods can be supported.
|
93
111
|
#
|
112
|
+
# rubocop:disable AbcSize
|
94
113
|
def play!(config)
|
95
114
|
payload = case config.keys
|
96
|
-
when %i[index context]
|
97
|
-
{context_uri: config[:context],
|
98
|
-
|
99
|
-
|
100
|
-
when %i[uri
|
101
|
-
{
|
115
|
+
when %i[index context position_ms]
|
116
|
+
{context_uri: config[:context],
|
117
|
+
offset: {position: config[:index]},
|
118
|
+
position_ms: config[:position_ms]}
|
119
|
+
when %i[uri position_ms]
|
120
|
+
{uris: [config[:uri]],
|
121
|
+
position_ms: config[:position_ms]}
|
122
|
+
when %i[uri context position_ms]
|
123
|
+
{context_uri: config[:context],
|
124
|
+
offset: {uri: config[:uri]},
|
125
|
+
position_ms: config[:position_ms]}
|
102
126
|
else
|
103
|
-
raise
|
127
|
+
raise <<-ERROR.strip_heredoc.strip
|
128
|
+
Unrecognized play instructions.
|
129
|
+
See https://www.rubydoc.info/github/bih/spotify-ruby/Spotify/SDK/Connect/Device#play!-instance_method for details.
|
130
|
+
ERROR
|
104
131
|
end
|
105
132
|
|
106
133
|
parent.send_http_request(:put, "/v1/me/player/play?device_id=%s" % id, http_options: {expect_nil: true},
|
107
134
|
body: payload.to_json)
|
108
135
|
self
|
109
136
|
end
|
137
|
+
# rubocop:enable AbcSize
|
110
138
|
|
111
139
|
##
|
112
140
|
# Resume the currently playing track on device.
|
data/lib/spotify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spotify-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bilawal Hameed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -226,6 +226,8 @@ executables: []
|
|
226
226
|
extensions: []
|
227
227
|
extra_rdoc_files: []
|
228
228
|
files:
|
229
|
+
- ".github/CONTRIBUTING.md"
|
230
|
+
- ".github/ISSUE_TEMPLATE.md"
|
229
231
|
- ".gitignore"
|
230
232
|
- ".rspec"
|
231
233
|
- ".rubocop.yml"
|
@@ -282,4 +284,3 @@ signing_key:
|
|
282
284
|
specification_version: 4
|
283
285
|
summary: The developer-friendly, opinionated Ruby SDK for Spotify.
|
284
286
|
test_files: []
|
285
|
-
has_rdoc:
|