spotify-ruby 0.1.0 → 0.1.1
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 +4 -4
- data/.gitignore +2 -0
- data/COVERAGE.md +142 -0
- data/README.md +60 -5
- data/lib/spotify.rb +7 -0
- data/lib/spotify/auth.rb +10 -18
- data/lib/spotify/sdk.rb +109 -0
- data/lib/spotify/sdk/base.rb +58 -0
- data/lib/spotify/sdk/connect.rb +26 -0
- data/lib/spotify/sdk/connect/device.rb +55 -0
- data/lib/spotify/sdk/initialization.rb +76 -0
- data/lib/spotify/sdk/initialization/base.rb +74 -0
- data/lib/spotify/sdk/initialization/oauth_access_token.rb +34 -0
- data/lib/spotify/sdk/initialization/plain_string.rb +26 -0
- data/lib/spotify/sdk/initialization/query_hash.rb +45 -0
- data/lib/spotify/sdk/initialization/query_string.rb +51 -0
- data/lib/spotify/sdk/initialization/url_string.rb +49 -0
- data/lib/spotify/sdk/model.rb +53 -0
- data/lib/spotify/version.rb +1 -1
- data/spotify-ruby.gemspec +5 -3
- metadata +45 -55
- data/SPEC.md +0 -18
- data/html/README_md.html +0 -189
- data/html/Spotify.html +0 -115
- data/html/Spotify/Auth.html +0 -281
- data/html/Spotify/Errors.html +0 -103
- data/html/Spotify/Errors/AuthClientCredentialsError.html +0 -106
- data/html/created.rid +0 -5
- data/html/css/fonts.css +0 -167
- data/html/css/rdoc.css +0 -590
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +0 -189
- data/html/js/darkfish.js +0 -161
- data/html/js/jquery.js +0 -4
- data/html/js/navigation.js +0 -142
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +0 -109
- data/html/js/search_index.js +0 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +0 -229
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +0 -83
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spotify
|
4
|
+
class SDK
|
5
|
+
class Initialization
|
6
|
+
class URLString < Base
|
7
|
+
def query_fragment_string
|
8
|
+
@query_fragment_string ||= begin
|
9
|
+
@uri = begin
|
10
|
+
URI.parse(subject)
|
11
|
+
rescue URI::InvalidURIError
|
12
|
+
URI.parse("")
|
13
|
+
end
|
14
|
+
[@uri.query, @uri.fragment].compact.join("&")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def should_perform?
|
19
|
+
subject.is_a?(String) && query_fragment_string.present?
|
20
|
+
end
|
21
|
+
|
22
|
+
def perform
|
23
|
+
QueryString.new(query_fragment_string).perform
|
24
|
+
end
|
25
|
+
|
26
|
+
# TODO: Delete this when tests are written.
|
27
|
+
# rubocop:disable Metrics/LineLength
|
28
|
+
# def sample_inputs
|
29
|
+
# [
|
30
|
+
# "http://dev.localhost.com:443/?token=#{SAMPLE_TOKEN}",
|
31
|
+
# "http://dev.localhost.com:443/?token=#{SAMPLE_TOKEN}&expires_in=1234567890",
|
32
|
+
# "http://dev.localhost.com:443/?token=#{SAMPLE_TOKEN}&expires_in=1234567890&refresh_token=#{SAMPLE_TOKEN}",
|
33
|
+
# "http://dev.localhost.com:443/#token=#{SAMPLE_TOKEN}",
|
34
|
+
# "http://dev.localhost.com:443/#token=#{SAMPLE_TOKEN}&expires_in=1234567890",
|
35
|
+
# "http://dev.localhost.com:443/#token=#{SAMPLE_TOKEN}&expires_in=1234567890&refresh_token=#{SAMPLE_TOKEN}",
|
36
|
+
# "http://dev.localhost.com:443/?access_token=#{SAMPLE_TOKEN}",
|
37
|
+
# "http://dev.localhost.com:443/?access_token=#{SAMPLE_TOKEN}&expires_in=1234567890",
|
38
|
+
# "http://dev.localhost.com:443/?access_token=#{SAMPLE_TOKEN}&expires_in=1234567890&refresh_token=#{SAMPLE_TOKEN}",
|
39
|
+
# "http://dev.localhost.com:443/#access_token=#{SAMPLE_TOKEN}",
|
40
|
+
# "http://dev.localhost.com:443/#access_token=#{SAMPLE_TOKEN}&expires_in=1234567890",
|
41
|
+
# "http://dev.localhost.com:443/#access_token=#{SAMPLE_TOKEN}&expires_in=1234567890&refresh_token=#{SAMPLE_TOKEN}",
|
42
|
+
# "http://dev.localhost.com:443/?access_token=#{SAMPLE_TOKEN}&expires_in=1234567890#refresh_token=#{SAMPLE_TOKEN}"
|
43
|
+
# ]
|
44
|
+
# end
|
45
|
+
# rubocop:enable Metrics/LineLength
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spotify
|
4
|
+
class SDK
|
5
|
+
##
|
6
|
+
# For each SDK response object (i.e. Device), we have a Model class. We're using OpenStruct.
|
7
|
+
#
|
8
|
+
class Model < OpenStruct
|
9
|
+
##
|
10
|
+
# Initialize a new Model instance.
|
11
|
+
#
|
12
|
+
# @param [Hash] hash The response payload.
|
13
|
+
# @param [Spotify::SDK] parent The SDK object for context.
|
14
|
+
#
|
15
|
+
def initialize(payload, parent)
|
16
|
+
@payload = payload
|
17
|
+
validate_payload
|
18
|
+
|
19
|
+
@parent = parent
|
20
|
+
validate_parent
|
21
|
+
|
22
|
+
super(payload)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# A reference to Spotify::SDK::Connect, so we can also do stuff.
|
27
|
+
#
|
28
|
+
attr_reader :parent
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def validate_payload
|
33
|
+
raise Spotify::Errors::ModelPayloadExpectedToBeHashError.new unless @payload.instance_of? Hash
|
34
|
+
end
|
35
|
+
|
36
|
+
def validate_parent
|
37
|
+
raise Spotify::Errors::ModelParentInvalidSDKBaseObjectError.new unless @parent.is_a? Spotify::SDK::Base
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class Errors
|
43
|
+
##
|
44
|
+
# A Error class for when the payload is not a Hash instance.
|
45
|
+
#
|
46
|
+
class ModelPayloadExpectedToBeHashError < StandardError; end
|
47
|
+
|
48
|
+
##
|
49
|
+
# A Error class for when the parent is not a Spotify::SDK::Base instance.
|
50
|
+
#
|
51
|
+
class ModelParentInvalidSDKBaseObjectError < StandardError; end
|
52
|
+
end
|
53
|
+
end
|
data/lib/spotify/version.rb
CHANGED
data/spotify-ruby.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = "spotify-ruby"
|
9
9
|
spec.version = Spotify::VERSION
|
10
10
|
spec.authors = ["Bilawal Hameed"]
|
11
|
-
spec.email = ["
|
11
|
+
spec.email = ["bil@spotify.com"]
|
12
12
|
|
13
|
-
spec.summary = "A modern Ruby
|
13
|
+
spec.summary = "A modern, opinionated and unofficial Ruby SDK for the Spotify API."
|
14
14
|
spec.description = [
|
15
15
|
"Build integrations with the different Spotify APIs",
|
16
16
|
"inside of your application.",
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.license = "MIT"
|
21
21
|
|
22
22
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
|
-
f.match(%r{^(test|spec|features)/})
|
23
|
+
f.match(%r{^(test|spec|features|coverage|html|examples)/})
|
24
24
|
end
|
25
25
|
|
26
26
|
spec.bindir = "exe"
|
@@ -33,6 +33,8 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency "rdoc", "~> 5.1"
|
34
34
|
spec.add_development_dependency "rspec", "~> 3.7"
|
35
35
|
spec.add_development_dependency "rubocop", "~> 0.51.0"
|
36
|
+
spec.add_development_dependency "webmock", "~> 3.1"
|
37
|
+
spec.add_runtime_dependency "activesupport", "~> 5.0"
|
36
38
|
spec.add_runtime_dependency "httparty", "~> 0.15.6"
|
37
39
|
spec.add_runtime_dependency "oauth2", "~> 1.4"
|
38
40
|
end
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bilawal Hameed
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,6 +100,34 @@ dependencies:
|
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 0.51.0
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: webmock
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '3.1'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '3.1'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: activesupport
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '5.0'
|
124
|
+
type: :runtime
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '5.0'
|
103
131
|
- !ruby/object:Gem::Dependency
|
104
132
|
name: httparty
|
105
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,7 +159,7 @@ dependencies:
|
|
131
159
|
description: Build integrations with the different Spotify APIs inside of your application.
|
132
160
|
For more information, visit https://developer.spotify.com
|
133
161
|
email:
|
134
|
-
-
|
162
|
+
- bil@spotify.com
|
135
163
|
executables: []
|
136
164
|
extensions: []
|
137
165
|
extra_rdoc_files: []
|
@@ -143,66 +171,28 @@ files:
|
|
143
171
|
- ".rvm-version"
|
144
172
|
- ".travis.yml"
|
145
173
|
- CODE_OF_CONDUCT.md
|
174
|
+
- COVERAGE.md
|
146
175
|
- Gemfile
|
147
176
|
- LICENSE
|
148
177
|
- README.md
|
149
178
|
- Rakefile
|
150
|
-
- SPEC.md
|
151
179
|
- bin/console
|
152
180
|
- bin/setup
|
153
|
-
- html/README_md.html
|
154
|
-
- html/Spotify.html
|
155
|
-
- html/Spotify/Auth.html
|
156
|
-
- html/Spotify/Errors.html
|
157
|
-
- html/Spotify/Errors/AuthClientCredentialsError.html
|
158
|
-
- html/created.rid
|
159
|
-
- html/css/fonts.css
|
160
|
-
- html/css/rdoc.css
|
161
|
-
- html/fonts/Lato-Light.ttf
|
162
|
-
- html/fonts/Lato-LightItalic.ttf
|
163
|
-
- html/fonts/Lato-Regular.ttf
|
164
|
-
- html/fonts/Lato-RegularItalic.ttf
|
165
|
-
- html/fonts/SourceCodePro-Bold.ttf
|
166
|
-
- html/fonts/SourceCodePro-Regular.ttf
|
167
|
-
- html/images/add.png
|
168
|
-
- html/images/arrow_up.png
|
169
|
-
- html/images/brick.png
|
170
|
-
- html/images/brick_link.png
|
171
|
-
- html/images/bug.png
|
172
|
-
- html/images/bullet_black.png
|
173
|
-
- html/images/bullet_toggle_minus.png
|
174
|
-
- html/images/bullet_toggle_plus.png
|
175
|
-
- html/images/date.png
|
176
|
-
- html/images/delete.png
|
177
|
-
- html/images/find.png
|
178
|
-
- html/images/loadingAnimation.gif
|
179
|
-
- html/images/macFFBgHack.png
|
180
|
-
- html/images/package.png
|
181
|
-
- html/images/page_green.png
|
182
|
-
- html/images/page_white_text.png
|
183
|
-
- html/images/page_white_width.png
|
184
|
-
- html/images/plugin.png
|
185
|
-
- html/images/ruby.png
|
186
|
-
- html/images/tag_blue.png
|
187
|
-
- html/images/tag_green.png
|
188
|
-
- html/images/transparent.png
|
189
|
-
- html/images/wrench.png
|
190
|
-
- html/images/wrench_orange.png
|
191
|
-
- html/images/zoom.png
|
192
|
-
- html/index.html
|
193
|
-
- html/js/darkfish.js
|
194
|
-
- html/js/jquery.js
|
195
|
-
- html/js/navigation.js
|
196
|
-
- html/js/navigation.js.gz
|
197
|
-
- html/js/search.js
|
198
|
-
- html/js/search_index.js
|
199
|
-
- html/js/search_index.js.gz
|
200
|
-
- html/js/searcher.js
|
201
|
-
- html/js/searcher.js.gz
|
202
|
-
- html/table_of_contents.html
|
203
181
|
- lib/spotify.rb
|
204
182
|
- lib/spotify/auth.rb
|
183
|
+
- lib/spotify/sdk.rb
|
205
184
|
- lib/spotify/sdk/.keep
|
185
|
+
- lib/spotify/sdk/base.rb
|
186
|
+
- lib/spotify/sdk/connect.rb
|
187
|
+
- lib/spotify/sdk/connect/device.rb
|
188
|
+
- lib/spotify/sdk/initialization.rb
|
189
|
+
- lib/spotify/sdk/initialization/base.rb
|
190
|
+
- lib/spotify/sdk/initialization/oauth_access_token.rb
|
191
|
+
- lib/spotify/sdk/initialization/plain_string.rb
|
192
|
+
- lib/spotify/sdk/initialization/query_hash.rb
|
193
|
+
- lib/spotify/sdk/initialization/query_string.rb
|
194
|
+
- lib/spotify/sdk/initialization/url_string.rb
|
195
|
+
- lib/spotify/sdk/model.rb
|
206
196
|
- lib/spotify/version.rb
|
207
197
|
- spotify-ruby.gemspec
|
208
198
|
homepage: https://github.com/bih/spotify-ruby
|
@@ -228,5 +218,5 @@ rubyforge_project:
|
|
228
218
|
rubygems_version: 2.6.8
|
229
219
|
signing_key:
|
230
220
|
specification_version: 4
|
231
|
-
summary: A modern Ruby
|
221
|
+
summary: A modern, opinionated and unofficial Ruby SDK for the Spotify API.
|
232
222
|
test_files: []
|
data/SPEC.md
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Core files: # This is all the core files.
|
2
|
-
- /lib/spotify/version.rb
|
3
|
-
- /spec/spotify_spec.rb
|
4
|
-
|
5
|
-
Authorization: # For integrating OAuth.
|
6
|
-
- /lib/spotify/auth/*.rb
|
7
|
-
- /spec/lib/spotify/auth/*_spec.rb
|
8
|
-
|
9
|
-
Code sample:
|
10
|
-
```
|
11
|
-
require "spotify"
|
12
|
-
|
13
|
-
auth = Spotify::Auth.new({
|
14
|
-
client_id: "client id",
|
15
|
-
client_secret: "client_secret",
|
16
|
-
redirect_uri: ""
|
17
|
-
})
|
18
|
-
```
|
data/html/README_md.html
DELETED
@@ -1,189 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>README - RDoc Documentation</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "./";
|
11
|
-
var index_rel_prefix = "./";
|
12
|
-
</script>
|
13
|
-
|
14
|
-
<script src="./js/jquery.js"></script>
|
15
|
-
<script src="./js/darkfish.js"></script>
|
16
|
-
|
17
|
-
<link href="./css/fonts.css" rel="stylesheet">
|
18
|
-
<link href="./css/rdoc.css" rel="stylesheet">
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<body id="top" role="document" class="file">
|
23
|
-
<nav role="navigation">
|
24
|
-
<div id="project-navigation">
|
25
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
26
|
-
<h2>
|
27
|
-
<a href="./index.html" rel="home">Home</a>
|
28
|
-
</h2>
|
29
|
-
|
30
|
-
<div id="table-of-contents-navigation">
|
31
|
-
<a href="./table_of_contents.html#pages">Pages</a>
|
32
|
-
<a href="./table_of_contents.html#classes">Classes</a>
|
33
|
-
<a href="./table_of_contents.html#methods">Methods</a>
|
34
|
-
</div>
|
35
|
-
</div>
|
36
|
-
|
37
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
38
|
-
<form action="#" method="get" accept-charset="utf-8">
|
39
|
-
<div id="search-field-wrapper">
|
40
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
41
|
-
aria-autocomplete="list" aria-controls="search-results"
|
42
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
43
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<ul id="search-results" aria-label="Search Results"
|
47
|
-
aria-busy="false" aria-expanded="false"
|
48
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
49
|
-
</form>
|
50
|
-
</div>
|
51
|
-
|
52
|
-
</div>
|
53
|
-
|
54
|
-
|
55
|
-
<div class="nav-section">
|
56
|
-
<h3>Table of Contents</h3>
|
57
|
-
|
58
|
-
<ul class="link-list" role="directory">
|
59
|
-
<li><a href="#label-bih-2Fspotify-ruby">bih/spotify-ruby</a>
|
60
|
-
<li><a href="#label-Installation">Installation</a>
|
61
|
-
<li><a href="#label-Setup">Setup</a>
|
62
|
-
<li><a href="#label-Authentication">Authentication</a>
|
63
|
-
<li><a href="#label-Usage">Usage</a>
|
64
|
-
<li><a href="#label-Development">Development</a>
|
65
|
-
<li><a href="#label-Contributing">Contributing</a>
|
66
|
-
<li><a href="#label-License">License</a>
|
67
|
-
<li><a href="#label-Code+of+Conduct">Code of Conduct</a>
|
68
|
-
</ul>
|
69
|
-
</div>
|
70
|
-
|
71
|
-
|
72
|
-
<div id="project-metadata">
|
73
|
-
<div id="fileindex-section" class="nav-section">
|
74
|
-
<h3>Pages</h3>
|
75
|
-
|
76
|
-
<ul class="link-list">
|
77
|
-
|
78
|
-
<li><a href="./README_md.html">README</a>
|
79
|
-
|
80
|
-
</ul>
|
81
|
-
</div>
|
82
|
-
|
83
|
-
</div>
|
84
|
-
</nav>
|
85
|
-
|
86
|
-
<main role="main" aria-label="Page README.md">
|
87
|
-
|
88
|
-
<h1 id="label-bih-2Fspotify-ruby">bih/spotify-ruby<span><a href="#label-bih-2Fspotify-ruby">¶</a> <a href="#top">↑</a></span></h1>
|
89
|
-
|
90
|
-
<p>A modern, opinionated and <em>unofficial</em> Ruby SDK for the <a
|
91
|
-
href="https://developer.spotify.com/documentation/web-api/reference/">Spotify
|
92
|
-
Web API</a> to help developers all over the world build amazing music
|
93
|
-
things with <a href="Spotify.html">Spotify</a>.</p>
|
94
|
-
|
95
|
-
<p>This is a work in progress. <strong>Currently in pre-alpha.</strong></p>
|
96
|
-
|
97
|
-
<p><a href="https://travis-ci.org/bih/spotify-ruby"><img
|
98
|
-
src="https://travis-ci.org/bih/spotify-ruby.svg?branch=master"></a></p>
|
99
|
-
|
100
|
-
<h2 id="label-Installation">Installation<span><a href="#label-Installation">¶</a> <a href="#top">↑</a></span></h2>
|
101
|
-
|
102
|
-
<p>Add this line to your application's Gemfile:</p>
|
103
|
-
|
104
|
-
<pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-string">'spotify-ruby'</span>
|
105
|
-
</pre>
|
106
|
-
|
107
|
-
<p>And then execute:</p>
|
108
|
-
|
109
|
-
<pre>$ bundle</pre>
|
110
|
-
|
111
|
-
<p>Or install it yourself as:</p>
|
112
|
-
|
113
|
-
<pre>$ gem install spotify-ruby</pre>
|
114
|
-
|
115
|
-
<h2 id="label-Setup">Setup<span><a href="#label-Setup">¶</a> <a href="#top">↑</a></span></h2>
|
116
|
-
|
117
|
-
<p>You'll need to create a <code>Spotify::Auth</code> instance with your
|
118
|
-
credentials.</p>
|
119
|
-
|
120
|
-
<pre class="ruby"><span class="ruby-ivar">@auth</span> = <span class="ruby-constant">Spotify</span><span class="ruby-operator">::</span><span class="ruby-constant">Auth</span>.<span class="ruby-identifier">new</span>({
|
121
|
-
<span class="ruby-identifier">client_id</span><span class="ruby-operator">:</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">"SPOTIFY_CLIENT_ID"</span>],
|
122
|
-
<span class="ruby-identifier">client_secret</span><span class="ruby-operator">:</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">"SPOTIFY_CLIENT_SECRET"</span>],
|
123
|
-
<span class="ruby-identifier">redirect_uri</span><span class="ruby-operator">:</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">"SPOTIFY_REDIRECT_URI"</span>]
|
124
|
-
})
|
125
|
-
</pre>
|
126
|
-
|
127
|
-
<h2 id="label-Authentication">Authentication<span><a href="#label-Authentication">¶</a> <a href="#top">↑</a></span></h2>
|
128
|
-
|
129
|
-
<p>With our <code>@auth</code> instance, we can initiate an authentication URL
|
130
|
-
for <code>https://accounts.spotify.com</code>. By default, this will have
|
131
|
-
all the values needed to get a user setup.</p>
|
132
|
-
|
133
|
-
<pre class="ruby"><span class="ruby-ivar">@auth</span>.<span class="ruby-identifier">authorize_url</span> <span class="ruby-comment"># => https://accounts.spotify.com/oauth/authorize?client_id=...&redirect_uri=...</span>
|
134
|
-
</pre>
|
135
|
-
|
136
|
-
<h2 id="label-Usage">Usage<span><a href="#label-Usage">¶</a> <a href="#top">↑</a></span></h2>
|
137
|
-
|
138
|
-
<pre class="ruby"><span class="ruby-identifier">spotify</span> = <span class="ruby-constant">Spotify</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span>.<span class="ruby-identifier">new</span>
|
139
|
-
<span class="ruby-identifier">spotify</span>.<span class="ruby-identifier">access_token</span> = <span class="ruby-string">"[access token]"</span>
|
140
|
-
|
141
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">spotify</span>.<span class="ruby-identifier">connect</span>.<span class="ruby-identifier">devices</span>
|
142
|
-
</pre>
|
143
|
-
|
144
|
-
<p>TODO: Write usage instructions here</p>
|
145
|
-
|
146
|
-
<h2 id="label-Development">Development<span><a href="#label-Development">¶</a> <a href="#top">↑</a></span></h2>
|
147
|
-
|
148
|
-
<p>After checking out the repo, run <code>bin/setup</code> to install
|
149
|
-
dependencies. Then, run <code>rake spec</code> to run the tests. You can
|
150
|
-
also run <code>bin/console</code> for an interactive prompt that will allow
|
151
|
-
you to experiment.</p>
|
152
|
-
|
153
|
-
<p>To install this gem onto your local machine, run <code>bundle exec rake
|
154
|
-
install</code>. To release a new version, update the version number in
|
155
|
-
<code>version.rb</code>, and then run <code>bundle exec rake
|
156
|
-
release</code>, which will create a git tag for the version, push git
|
157
|
-
commits and tags, and push the <code>.gem</code> file to <a
|
158
|
-
href="https://rubygems.org">rubygems.org</a>.</p>
|
159
|
-
|
160
|
-
<h2 id="label-Contributing">Contributing<span><a href="#label-Contributing">¶</a> <a href="#top">↑</a></span></h2>
|
161
|
-
|
162
|
-
<p>Bug reports and pull requests are welcome on GitHub at <a
|
163
|
-
href="https://github.com/bih/spotify-ruby">github.com/bih/spotify-ruby</a>.
|
164
|
-
This project is intended to be a safe, welcoming space for collaboration,
|
165
|
-
and contributors are expected to adhere to the <a
|
166
|
-
href="http://contributor-covenant.org">Contributor Covenant</a> code of
|
167
|
-
conduct.</p>
|
168
|
-
|
169
|
-
<h2 id="label-License">License<span><a href="#label-License">¶</a> <a href="#top">↑</a></span></h2>
|
170
|
-
|
171
|
-
<p>The gem is available as open source under the terms of the <a
|
172
|
-
href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
|
173
|
-
|
174
|
-
<h2 id="label-Code+of+Conduct">Code of Conduct<span><a href="#label-Code+of+Conduct">¶</a> <a href="#top">↑</a></span></h2>
|
175
|
-
|
176
|
-
<p>Everyone interacting in the <code>spotify-ruby</code> project’s codebases,
|
177
|
-
issue trackers, chat rooms and mailing lists is expected to follow the <a
|
178
|
-
href="https://github.com/bih/spotify-ruby/blob/master/CODE_OF_CONDUCT.md">code
|
179
|
-
of conduct</a>.</p>
|
180
|
-
</main>
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
<footer id="validator-badges" role="contentinfo">
|
185
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
186
|
-
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
187
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
188
|
-
</footer>
|
189
|
-
|