spotify-ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +146 -0
  5. data/.ruby-version +1 -0
  6. data/.rvm-version +1 -0
  7. data/.travis.yml +7 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +6 -0
  10. data/LICENSE +21 -0
  11. data/README.md +72 -0
  12. data/Rakefile +30 -0
  13. data/SPEC.md +18 -0
  14. data/bin/console +15 -0
  15. data/bin/setup +8 -0
  16. data/html/README_md.html +189 -0
  17. data/html/Spotify.html +115 -0
  18. data/html/Spotify/Auth.html +281 -0
  19. data/html/Spotify/Errors.html +103 -0
  20. data/html/Spotify/Errors/AuthClientCredentialsError.html +106 -0
  21. data/html/created.rid +5 -0
  22. data/html/css/fonts.css +167 -0
  23. data/html/css/rdoc.css +590 -0
  24. data/html/fonts/Lato-Light.ttf +0 -0
  25. data/html/fonts/Lato-LightItalic.ttf +0 -0
  26. data/html/fonts/Lato-Regular.ttf +0 -0
  27. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  28. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  29. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  30. data/html/images/add.png +0 -0
  31. data/html/images/arrow_up.png +0 -0
  32. data/html/images/brick.png +0 -0
  33. data/html/images/brick_link.png +0 -0
  34. data/html/images/bug.png +0 -0
  35. data/html/images/bullet_black.png +0 -0
  36. data/html/images/bullet_toggle_minus.png +0 -0
  37. data/html/images/bullet_toggle_plus.png +0 -0
  38. data/html/images/date.png +0 -0
  39. data/html/images/delete.png +0 -0
  40. data/html/images/find.png +0 -0
  41. data/html/images/loadingAnimation.gif +0 -0
  42. data/html/images/macFFBgHack.png +0 -0
  43. data/html/images/package.png +0 -0
  44. data/html/images/page_green.png +0 -0
  45. data/html/images/page_white_text.png +0 -0
  46. data/html/images/page_white_width.png +0 -0
  47. data/html/images/plugin.png +0 -0
  48. data/html/images/ruby.png +0 -0
  49. data/html/images/tag_blue.png +0 -0
  50. data/html/images/tag_green.png +0 -0
  51. data/html/images/transparent.png +0 -0
  52. data/html/images/wrench.png +0 -0
  53. data/html/images/wrench_orange.png +0 -0
  54. data/html/images/zoom.png +0 -0
  55. data/html/index.html +189 -0
  56. data/html/js/darkfish.js +161 -0
  57. data/html/js/jquery.js +4 -0
  58. data/html/js/navigation.js +142 -0
  59. data/html/js/navigation.js.gz +0 -0
  60. data/html/js/search.js +109 -0
  61. data/html/js/search_index.js +1 -0
  62. data/html/js/search_index.js.gz +0 -0
  63. data/html/js/searcher.js +229 -0
  64. data/html/js/searcher.js.gz +0 -0
  65. data/html/table_of_contents.html +83 -0
  66. data/lib/spotify.rb +10 -0
  67. data/lib/spotify/auth.rb +119 -0
  68. data/lib/spotify/sdk/.keep +0 -0
  69. data/lib/spotify/version.rb +13 -0
  70. data/spotify-ruby.gemspec +38 -0
  71. metadata +232 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: edad90fdfafd7b93553043d283cf717520517d94
4
+ data.tar.gz: 9188847f32388191255de3ed13f45a6ab272f771
5
+ SHA512:
6
+ metadata.gz: 70d0432c498285d1d06306ae2132d246729948f17595bc0d921af659476dbd8f5ad1641a258bc017ae46daeaedd2b927c98636f49b324ce61f11601023a2df4c
7
+ data.tar.gz: 2c2abd2f27cdec8924fc3f82ada20cf5ad28a1f87d9538625a2b62b0266855d86b3a5b6a24d350cf7bbf6c84041b7d72588463e718ad167dc09577f5c763ec6a
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.local/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
14
+ .coveralls.yml
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,146 @@
1
+ # Commonly used screens these days easily fit more than 80 characters.
2
+ Metrics/LineLength:
3
+ Max: 120
4
+ Exclude:
5
+ - 'spec/**/*.rb'
6
+
7
+ # Too short methods lead to extraction of single-use methods, which can make
8
+ # the code easier to read (by naming things), but can also clutter the class
9
+ Metrics/MethodLength:
10
+ Max: 20
11
+
12
+ # The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
13
+ Metrics/ClassLength:
14
+ Max: 1500
15
+ Exclude:
16
+ - 'spec/**/*.rb'
17
+
18
+ # The size of a block for a method.
19
+ Metrics/BlockLength:
20
+ CountComments: false
21
+ Max: 25
22
+ ExcludedMethods: []
23
+ Exclude:
24
+ - '*.gemspec'
25
+ - 'spec/**/*.rb'
26
+
27
+ # No space makes the method definition shorter and differentiates
28
+ # from a regular assignment.
29
+ Layout/SpaceAroundEqualsInParameterDefault:
30
+ EnforcedStyle: no_space
31
+
32
+ # Single quotes being faster is hardly measurable and only affects parse time.
33
+ # Enforcing double quotes reduces the times where you need to change them
34
+ # when introducing an interpolation. Use single quotes only if their semantics
35
+ # are needed.
36
+ Style/StringLiterals:
37
+ EnforcedStyle: double_quotes
38
+
39
+ # We do not need to support Ruby 1.9, so this is good to use.
40
+ Style/SymbolArray:
41
+ Enabled: true
42
+
43
+ # Most readable form.
44
+ Layout/AlignHash:
45
+ EnforcedHashRocketStyle: table
46
+ EnforcedColonStyle: table
47
+
48
+ # Mixing the styles looks just silly.
49
+ Style/HashSyntax:
50
+ EnforcedStyle: ruby19_no_mixed_keys
51
+
52
+ # has_key? and has_value? are far more readable than key? and value?
53
+ Style/PreferredHashMethods:
54
+ Enabled: false
55
+
56
+ # String#% is by far the least verbose and only object oriented variant.
57
+ Style/FormatString:
58
+ EnforcedStyle: percent
59
+
60
+ Style/CollectionMethods:
61
+ Enabled: true
62
+ PreferredMethods:
63
+ # inject seems more common in the community.
64
+ reduce: "inject"
65
+
66
+
67
+ # Either allow this style or don't. Marking it as safe with parenthesis
68
+ # is silly. Let's try to live without them for now.
69
+ Style/ParenthesesAroundCondition:
70
+ AllowSafeAssignment: false
71
+ Lint/AssignmentInCondition:
72
+ AllowSafeAssignment: false
73
+
74
+ # A specialized exception class will take one or more arguments and construct the message from it.
75
+ # So both variants make sense.
76
+ Style/RaiseArgs:
77
+ Enabled: false
78
+
79
+ # Indenting the chained dots beneath each other is not supported by this cop,
80
+ # see https://github.com/bbatsov/rubocop/issues/1633
81
+ Layout/MultilineOperationIndentation:
82
+ Enabled: false
83
+
84
+ # Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
85
+ # The argument that fail should be used to abort the program is wrong too,
86
+ # there's Kernel#abort for that.
87
+ Style/SignalException:
88
+ EnforcedStyle: only_raise
89
+
90
+ # Suppressing exceptions can be perfectly fine, and be it to avoid to
91
+ # explicitly type nil into the rescue since that's what you want to return,
92
+ # or suppressing LoadError for optional dependencies
93
+ Lint/HandleExceptions:
94
+ Enabled: false
95
+
96
+ Layout/SpaceInsideBlockBraces:
97
+ # The space here provides no real gain in readability while consuming
98
+ # horizontal space that could be used for a better parameter name.
99
+ # Also {| differentiates better from a hash than { | does.
100
+ SpaceBeforeBlockParameters: false
101
+
102
+ # No trailing space differentiates better from the block:
103
+ # foo} means hash, foo } means block.
104
+ Layout/SpaceInsideHashLiteralBraces:
105
+ EnforcedStyle: no_space
106
+
107
+ # { ... } for multi-line blocks is okay, follow Weirichs rule instead:
108
+ # https://web.archive.org/web/20140221124509/http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc
109
+ Style/BlockDelimiters:
110
+ Enabled: false
111
+
112
+ # do / end blocks should be used for side effects,
113
+ # methods that run a block for side effects and have
114
+ # a useful return value are rare, assign the return
115
+ # value to a local variable for those cases.
116
+ Style/MethodCalledOnDoEndBlock:
117
+ Enabled: true
118
+
119
+ # Enforcing the names of variables? To single letter ones? Just no.
120
+ Style/SingleLineBlockParams:
121
+ Enabled: false
122
+
123
+ # Shadowing outer local variables with block parameters is often useful
124
+ # to not reinvent a new name for the same thing, it highlights the relation
125
+ # between the outer variable and the parameter. The cases where it's actually
126
+ # confusing are rare, and usually bad for other reasons already, for example
127
+ # because the method is too long.
128
+ Lint/ShadowingOuterLocalVariable:
129
+ Enabled: false
130
+
131
+ # Check with yard instead.
132
+ Style/Documentation:
133
+ Enabled: false
134
+
135
+ # This is just silly. Calling the argument `other` in all cases makes no sense.
136
+ Naming/BinaryOperatorParameterName:
137
+ Enabled: false
138
+
139
+ # There are valid cases, for example debugging Cucumber steps,
140
+ # also they'll fail CI anyway
141
+ Lint/Debugger:
142
+ Enabled: false
143
+
144
+ # Style preference
145
+ Style/MethodDefParentheses:
146
+ Enabled: false
@@ -0,0 +1 @@
1
+ 2.4.0
@@ -0,0 +1 @@
1
+ 2.4.0
@@ -0,0 +1,7 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.15.1
6
+ script:
7
+ - rake ci
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at bil@spotify.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in spotify.gemspec
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Bilawal Hameed
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,72 @@
1
+ # bih/spotify-ruby
2
+
3
+ A modern, opinionated and *unofficial* Ruby SDK for the [Spotify Web API][spotify-web-api] to help developers all over the world build amazing music things with Spotify. [Check out the full docs here][rubyinfo-docs].
4
+
5
+ This is a work in progress. **Currently in pre-alpha.**
6
+
7
+ [![Build Status](https://travis-ci.org/bih/spotify-ruby.svg?branch=master)](https://travis-ci.org/bih/spotify-ruby)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'spotify-ruby'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install spotify-ruby
24
+
25
+ ## Setup
26
+
27
+ Configure with your client credentials and redirect URL. Get it [for free here][spotify-developer-dashboard].
28
+
29
+ ```ruby
30
+ require "spotify"
31
+
32
+ @auth = Spotify::Auth.new({
33
+ client_id: ENV["SPOTIFY_CLIENT_ID"],
34
+ client_secret: ENV["SPOTIFY_CLIENT_SECRET"],
35
+ redirect_uri: ENV["SPOTIFY_REDIRECT_URI"]
36
+ })
37
+ ```
38
+
39
+ ## Authentication
40
+
41
+ With our `@auth` instance, we can initiate an authentication URL for `https://accounts.spotify.com`. By default, this will have all the values needed to get a user setup.
42
+
43
+ ```ruby
44
+ @auth.authorize_url # => https://accounts.spotify.com/oauth/authorize?client_id=...&redirect_uri=...
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ TODO: Write more detailed usage instructions here
50
+
51
+ ## Development
52
+
53
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
54
+
55
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
56
+
57
+ ## Contributing
58
+
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bih/spotify-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
64
+
65
+ ## Code of Conduct
66
+
67
+ Everyone interacting in the `spotify-ruby` project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/bih/spotify-ruby/blob/master/CODE_OF_CONDUCT.md).
68
+
69
+ [spotify]: https://spotify.com
70
+ [spotify-web-api]: https://developer.spotify.com/documentation/web-api/reference/
71
+ [spotify-developer-dashboard]: https://developer.spotify.com/my-applications/
72
+ [rubyinfo-docs]: http://www.rubydoc.info/github/bih/spotify-ruby
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "rubocop/rake_task"
6
+ require "coveralls/rake/task"
7
+ require "rdoc/task"
8
+
9
+ # RSpec
10
+ # For testing the Spotify Ruby project.
11
+ RSpec::Core::RakeTask.new(:spec)
12
+
13
+ # Coveralls
14
+ # Making sure we have complete code coverage.
15
+ Coveralls::RakeTask.new
16
+ task test_with_coveralls: [:spec, :features, "coveralls:push"]
17
+
18
+ # Rubocop
19
+ # Making sure our code is linted.
20
+ RuboCop::RakeTask.new
21
+
22
+ # RDoc
23
+ # Making all of the code documentable.
24
+ RDoc::Task.new do |rdoc|
25
+ rdoc.main = "README.md"
26
+ rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
27
+ end
28
+
29
+ task default: :spec
30
+ task ci: [:spec, "coveralls:push", :rubocop]
data/SPEC.md ADDED
@@ -0,0 +1,18 @@
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
+ ```
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "spotify"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,189 @@
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">&para;</a> <a href="#top">&uarr;</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">&para;</a> <a href="#top">&uarr;</a></span></h2>
101
+
102
+ <p>Add this line to your application&#39;s Gemfile:</p>
103
+
104
+ <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-string">&#39;spotify-ruby&#39;</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">&para;</a> <a href="#top">&uarr;</a></span></h2>
116
+
117
+ <p>You&#39;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">&quot;SPOTIFY_CLIENT_ID&quot;</span>],
122
+ <span class="ruby-identifier">client_secret</span><span class="ruby-operator">:</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;SPOTIFY_CLIENT_SECRET&quot;</span>],
123
+ <span class="ruby-identifier">redirect_uri</span><span class="ruby-operator">:</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;SPOTIFY_REDIRECT_URI&quot;</span>]
124
+ })
125
+ </pre>
126
+
127
+ <h2 id="label-Authentication">Authentication<span><a href="#label-Authentication">&para;</a> <a href="#top">&uarr;</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"># =&gt; https://accounts.spotify.com/oauth/authorize?client_id=...&amp;redirect_uri=...</span>
134
+ </pre>
135
+
136
+ <h2 id="label-Usage">Usage<span><a href="#label-Usage">&para;</a> <a href="#top">&uarr;</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">&quot;[access token]&quot;</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">&para;</a> <a href="#top">&uarr;</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">&para;</a> <a href="#top">&uarr;</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">&para;</a> <a href="#top">&uarr;</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">&para;</a> <a href="#top">&uarr;</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
+