rspotify 1.11.0 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -11
- data/lib/rspotify.rb +1 -0
- data/lib/rspotify/base.rb +1 -1
- data/lib/rspotify/category.rb +98 -0
- data/lib/rspotify/playlist.rb +2 -2
- data/lib/rspotify/user.rb +3 -1
- data/lib/rspotify/version.rb +1 -1
- data/spec/lib/rspotify/category_spec.rb +111 -0
- data/spec/lib/rspotify/track_spec.rb +3 -3
- data/spec/vcr_cassettes/category_find_party.yml +64 -0
- data/spec/vcr_cassettes/category_find_party_country_BR.yml +64 -0
- data/spec/vcr_cassettes/category_find_party_locale_es_MX.yml +64 -0
- data/spec/vcr_cassettes/category_list.yml +86 -0
- data/spec/vcr_cassettes/category_list_country_BR.yml +86 -0
- data/spec/vcr_cassettes/category_list_locale_es_MX_limit_10.yml +76 -0
- data/spec/vcr_cassettes/category_party_playlists.yml +122 -0
- data/spec/vcr_cassettes/category_party_playlists_country_BR.yml +123 -0
- data/spec/vcr_cassettes/category_party_playlists_limit_10_offset_20.yml +100 -0
- data/spec/vcr_cassettes/track_search_Wanna_Know.yml +212 -1
- data/spec/vcr_cassettes/track_search_Wanna_Know_limit_10.yml +142 -1
- data/spec/vcr_cassettes/track_search_Wanna_Know_limit_10_offset_10.yml +140 -1
- data/spec/vcr_cassettes/track_search_Wanna_Know_market_ES.yml +200 -2
- data/spec/vcr_cassettes/track_search_Wanna_Know_offset_10.yml +209 -1
- metadata +23 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9d5c7e14d9ebae07999a11a0e293ce040355f0f
|
4
|
+
data.tar.gz: 089a62b73d44f770ea208cb6fede0d1eb1a37351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25c6e98fb25ee1efe383e2c7cb92d6cafabb75c31b94e4e89a8545129f3c0b9e77291b9b8f20661ae0cd852f80242c07872e65442a4316e49c0c0853f0fab2cf
|
7
|
+
data.tar.gz: 000dfeb95573bdb35cdcaa9cbe1fd687f1dd86715167c453993b5d50847e496ec1ab06e4bd37cdda7ffb5bc94970605b637528d9a6cc148d73ea526235850dbf
|
data/README.md
CHANGED
@@ -27,7 +27,11 @@ Or install it yourself as:
|
|
27
27
|
|
28
28
|
## Usage
|
29
29
|
|
30
|
-
|
30
|
+
RSpotify was designed with usability as its primary goal, so that you can forget the API and intuitively interact with your playlists, favorite artists, users and so on.
|
31
|
+
|
32
|
+
You can write things like `playlist.tracks.sort_by(&:popularity).last.album` without having to think which API calls must be done. RSpotify fills the gaps for you.
|
33
|
+
|
34
|
+
Below are some basic usage examples. Check the [documentation](http://rdoc.info/github/guilhermesad/rspotify/master/frames) for the complete reference.
|
31
35
|
|
32
36
|
```ruby
|
33
37
|
require 'rspotify'
|
@@ -93,29 +97,28 @@ Then just copy and paste them like so:
|
|
93
97
|
```ruby
|
94
98
|
RSpotify.authenticate("<your_client_id>", "<your_client_secret>")
|
95
99
|
|
96
|
-
# Now you can access
|
100
|
+
# Now you can access playlists in detail, browse featured content and more
|
101
|
+
|
102
|
+
wizzler = RSpotify::User.find('wizzler')
|
103
|
+
wizzler.playlists #=> (Playlist array)
|
97
104
|
|
105
|
+
# Find by id
|
98
106
|
playlist = RSpotify::Playlist.find('wizzler', '00wHcTN0zQiun4xri9pmvX')
|
99
107
|
playlist.name #=> "Movie Soundtrack Masterpieces"
|
100
108
|
playlist.description #=> "Iconic soundtracks featured..."
|
101
109
|
playlist.followers['total'] #=> 13
|
102
110
|
playlist.tracks #=> (Track array)
|
103
111
|
|
104
|
-
#
|
105
|
-
|
106
|
-
|
112
|
+
# Search by category
|
113
|
+
party = RSpotify::Category.find('party')
|
114
|
+
party.playlists #=> (Playlist array)
|
115
|
+
categories = RSpotify::Category.list # See all available categories
|
107
116
|
|
108
117
|
# Access featured content from Spotify's Browse tab
|
109
118
|
featured_playlists = RSpotify::Playlist.browse_featured(country: 'US')
|
110
119
|
new_releases = RSpotify::Album.new_releases(country: 'ES')
|
111
120
|
```
|
112
121
|
|
113
|
-
RSpotify focuses on objects behaviour so you can forget the API and worry about your tracks, artists and so on.
|
114
|
-
|
115
|
-
It is possible to write things like `playlist.tracks.sort_by(&:popularity).last.album` without having to think what API calls must be done. RSpotify fills the gaps for you.
|
116
|
-
|
117
|
-
Check the [documentation](http://rdoc.info/github/guilhermesad/rspotify/master/frames) for all attributes and methods of albums, artists, etc.
|
118
|
-
|
119
122
|
## Rails + OAuth
|
120
123
|
|
121
124
|
You'll may want your application to access an user's Spotify account.
|
data/lib/rspotify.rb
CHANGED
@@ -6,6 +6,7 @@ module RSpotify
|
|
6
6
|
autoload :Album, 'rspotify/album'
|
7
7
|
autoload :Artist, 'rspotify/artist'
|
8
8
|
autoload :Base, 'rspotify/base'
|
9
|
+
autoload :Category, 'rspotify/category'
|
9
10
|
autoload :Playlist, 'rspotify/playlist'
|
10
11
|
autoload :Track, 'rspotify/track'
|
11
12
|
autoload :User, 'rspotify/user'
|
data/lib/rspotify/base.rb
CHANGED
@@ -83,7 +83,7 @@ module RSpotify
|
|
83
83
|
#
|
84
84
|
# RSpotify::Base.search('Arctic', 'album,artist,playlist').total #=> 2142
|
85
85
|
def self.search(query, types, limit: 20, offset: 0, market: nil)
|
86
|
-
query =
|
86
|
+
query = CGI.escape query
|
87
87
|
types.gsub!(/\s+/, '')
|
88
88
|
|
89
89
|
url = "search?q=#{query}&type=#{types}"\
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module RSpotify
|
2
|
+
|
3
|
+
# @attr [NilClass] external_urls Inexistent for Category.
|
4
|
+
# @attr [String] href A link to the Spotify Web API endpoint returning full details of the category.
|
5
|
+
# @attr [Array] icons An array of image objects. The category icons, in various sizes.
|
6
|
+
# @attr [String] id The {https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids Spotify ID} of the category
|
7
|
+
# @attr [String] name The name of the category.
|
8
|
+
# @attr [NilClass] type Inexistent for Category.
|
9
|
+
# @attr [NilClass] uri Inexistent for Category.
|
10
|
+
class Category < Base
|
11
|
+
|
12
|
+
# Returns Category object with id provided
|
13
|
+
#
|
14
|
+
# @param id [String] The {https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids Spotify ID} of the category
|
15
|
+
# @param country [String] Optional. A country: an {http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country code}. Provide this parameter to ensure that the category exists for a particular country.
|
16
|
+
# @param locale [String] Optional. The desired language, consisting of a lowercase {http://en.wikipedia.org/wiki/ISO_639 ISO 639 language code} and an uppercase {http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country code}, joined by an underscore. For details access {https://developer.spotify.com/web-api/get-category/ here} and look for the locale parameter description.
|
17
|
+
# @return [Category]
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# category = RSpotify::Category.find('party')
|
21
|
+
# category = RSpotify::Category.find('party', country: 'US')
|
22
|
+
# category = RSpotify::Category.find('party', locale: 'es_MX')
|
23
|
+
def self.find(id, **options)
|
24
|
+
url = "browse/categories/#{id}"
|
25
|
+
url << '?' if options.any?
|
26
|
+
|
27
|
+
options.each_with_index do |option, index|
|
28
|
+
url << "#{option[0]}=#{option[1]}"
|
29
|
+
url << '&' unless index == options.size-1
|
30
|
+
end
|
31
|
+
|
32
|
+
json = RSpotify.auth_get(url)
|
33
|
+
Category.new json
|
34
|
+
end
|
35
|
+
|
36
|
+
# Get a list of categories used to tag items in Spotify
|
37
|
+
#
|
38
|
+
# @param limit [Integer] Optional. Maximum number of categories to return. Maximum: 50. Default: 20.
|
39
|
+
# @param offset [Integer] Optional. The index of the first category to return. Use with limit to get the next set of categories. Default: 0.
|
40
|
+
# @param country [String] Optional. A country: an {http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country code}. Provide this parameter if you want to narrow the list of returned categories to those relevant to a particular country. If omitted, the returned categories will be globally relevant.
|
41
|
+
# @param locale [String] Optional. The desired language, consisting of a lowercase {http://en.wikipedia.org/wiki/ISO_639 ISO 639 language code} and an uppercase {http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country code}, joined by an underscore. For details access {https://developer.spotify.com/web-api/get-category/ here} and look for the locale parameter description.
|
42
|
+
# @return [Array<Category>]
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
# categories = RSpotify::Category.list
|
46
|
+
# categories = RSpotify::Category.list(country: 'US')
|
47
|
+
# categories = RSpotify::Category.list(locale: 'es_MX', limit: 10)
|
48
|
+
def self.list(limit: 20, offset: 0, **options)
|
49
|
+
url = "browse/categories?limit=#{limit}&offset=#{offset}"
|
50
|
+
options.each do |option, value|
|
51
|
+
url << "&#{option}=#{value}"
|
52
|
+
end
|
53
|
+
json = RSpotify.auth_get(url)
|
54
|
+
json['categories']['items'].map { |i| Category.new i }
|
55
|
+
end
|
56
|
+
|
57
|
+
# Spotify does not support search for categories.
|
58
|
+
def self.search(*)
|
59
|
+
warn 'Spotify API does not support search for categories'
|
60
|
+
false
|
61
|
+
end
|
62
|
+
|
63
|
+
def initialize(options = {})
|
64
|
+
@icons = options['icons']
|
65
|
+
@name = options['name']
|
66
|
+
|
67
|
+
super(options)
|
68
|
+
end
|
69
|
+
|
70
|
+
# See {Base#complete!}
|
71
|
+
def complete!
|
72
|
+
initialize RSpotify.auth_get("browse/categories/#{@id}")
|
73
|
+
end
|
74
|
+
|
75
|
+
# Get a list of Spotify playlists tagged with a particular category.
|
76
|
+
#
|
77
|
+
# @param limit [Integer] Maximum number of playlists to return. Maximum: 50. Default: 20.
|
78
|
+
# @param offset [Integer] The index of the first playlist to return. Use with limit to get the next set of playlists. Default: 0.
|
79
|
+
# @param country [String] Optional. A country: an {http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country code}. Provide this parameter if you want to narrow the list of returned playlists to those relevant to a particular country. If omitted, the returned playlists will be globally relevant.
|
80
|
+
# @return [Array<Playlist>]
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# playlists = category.playlists
|
84
|
+
# playlists = category.playlists(country: 'BR')
|
85
|
+
# playlists = category.playlists(limit: 10, offset: 20)
|
86
|
+
def playlists(limit: 20, offset: 0, **options)
|
87
|
+
url = "browse/categories/#{@id}/playlists"\
|
88
|
+
"?limit=#{limit}&offset=#{offset}"
|
89
|
+
|
90
|
+
options.each do |option, value|
|
91
|
+
url << "&#{option}=#{value}"
|
92
|
+
end
|
93
|
+
|
94
|
+
json = RSpotify.auth_get(url)
|
95
|
+
json['playlists']['items'].map { |i| Playlist.new i }
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
data/lib/rspotify/playlist.rb
CHANGED
@@ -3,7 +3,7 @@ module RSpotify
|
|
3
3
|
# @attr [Boolean] collaborative true if the owner allows other users to modify the playlist
|
4
4
|
# @attr [String] description The playlist description
|
5
5
|
# @attr [Hash] followers Information about the followers of the playlist
|
6
|
-
# @attr [Array<Hash>] images
|
6
|
+
# @attr [Array<Hash>] images Images for the playlist. The array may be empty or contain up to three images. The images are returned by size in descending order. If returned, the source URL for the image is temporary and will expire in less than one day.
|
7
7
|
# @attr [String] name The name of the playlist
|
8
8
|
# @attr [User] owner The user who owns the playlist
|
9
9
|
# @attr [Boolean] public true if the playlist is not marked as secret
|
@@ -17,8 +17,8 @@ module RSpotify
|
|
17
17
|
#
|
18
18
|
# @param limit [Integer] Maximum number of playlists to return. Maximum: 50. Default: 20.
|
19
19
|
# @param offset [Integer] The index of the first playlist to return. Use with limit to get the next set of playlists. Default: 0.
|
20
|
-
# @param locale [String] Optional. The desired language, consisting of a lowercase {http://en.wikipedia.org/wiki/ISO_639 ISO 639 language code} and an uppercase {http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country code}, joined by an underscore. For details access {https://developer.spotify.com/web-api/get-list-featured-playlists/ here} and look for the locale parameter description.
|
21
20
|
# @param country [String] Optional. A country: an {http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country code}. Provide this parameter if you want the list of returned playlists to be relevant to a particular country. If omitted, the returned playlists will be relevant to all countries.
|
21
|
+
# @param locale [String] Optional. The desired language, consisting of a lowercase {http://en.wikipedia.org/wiki/ISO_639 ISO 639 language code} and an uppercase {http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country code}, joined by an underscore. For details access {https://developer.spotify.com/web-api/get-list-featured-playlists/ here} and look for the locale parameter description.
|
22
22
|
# @param timestamp [String] Optional. A timestamp in {http://en.wikipedia.org/wiki/ISO_8601 ISO 8601} format: yyyy-MM-ddTHH:mm:ss. Use this parameter to specify the user's local time to get results tailored for that specific date and time in the day. If not provided, the response defaults to the current UTC time. Example: "2014-10-23T09:00:00" for a user whose local time is 9AM.
|
23
23
|
# @return [Array<Playlist>]
|
24
24
|
#
|
data/lib/rspotify/user.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module RSpotify
|
2
2
|
|
3
|
+
# @attr [String] birthdate The user's date-of-birth. This field is only available when the current user has granted access to the *user-read-birthdate* scope.
|
3
4
|
# @attr [String] country The country of the user, as set in the user's account profile. An {http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country code}. This field is only available when the current user has granted access to the *user-read-private* scope.
|
4
5
|
# @attr [Hash] credentials The credentials generated for the user with OAuth. Includes access token, token type, token expiration time and refresh token. This field is only available when the current user has granted access to any scope.
|
5
6
|
# @attr [String] display_name The name displayed on the user's profile. This field is only available when the current user has granted access to the *user-read-private* scope.
|
@@ -23,7 +24,7 @@ module RSpotify
|
|
23
24
|
super(id, 'user')
|
24
25
|
end
|
25
26
|
|
26
|
-
# Spotify does not support search for users.
|
27
|
+
# Spotify does not support search for users.
|
27
28
|
def self.search(*)
|
28
29
|
warn 'Spotify API does not support search for users'
|
29
30
|
false
|
@@ -69,6 +70,7 @@ module RSpotify
|
|
69
70
|
credentials = options['credentials']
|
70
71
|
options = options['info'] if options['info']
|
71
72
|
|
73
|
+
@birthdate ||= options['birthdate']
|
72
74
|
@country ||= options['country']
|
73
75
|
@display_name ||= options['display_name']
|
74
76
|
@email ||= options['email']
|
data/lib/rspotify/version.rb
CHANGED
@@ -0,0 +1,111 @@
|
|
1
|
+
describe RSpotify::Category do
|
2
|
+
|
3
|
+
# Keys generated specifically for the tests. Should be removed in the future
|
4
|
+
let(:client_id) { '5ac1cda2ad354aeaa1ad2693d33bb98c' }
|
5
|
+
let(:client_secret) { '155fc038a85840679b55a1822ef36b9b' }
|
6
|
+
|
7
|
+
before do
|
8
|
+
VCR.use_cassette('authenticate:client') do
|
9
|
+
RSpotify.authenticate(client_id, client_secret)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'Category::find' do
|
14
|
+
it 'should find right category' do
|
15
|
+
category = VCR.use_cassette('category:find:party') do
|
16
|
+
RSpotify::Category.find('party')
|
17
|
+
end
|
18
|
+
|
19
|
+
expect(category.href) .to eq 'https://api.spotify.com/v1/browse/categories/party'
|
20
|
+
expect(category.icons.first['url']) .to eq 'https://datsnxq1rwndn.cloudfront.net/media/derived/party-274x274_73d1907a7371c3bb96a288390a96ee27_0_0_274_274.jpg'
|
21
|
+
expect(category.id) .to eq 'party'
|
22
|
+
expect(category.name) .to eq 'Party'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should find right category with additional attributes' do
|
26
|
+
category = VCR.use_cassette('category:find:party:country:BR') do
|
27
|
+
RSpotify::Category.find('party', country: 'BR')
|
28
|
+
end
|
29
|
+
expect(category.href) .to eq 'https://api.spotify.com/v1/browse/categories/party'
|
30
|
+
expect(category.name) .to eq 'Party'
|
31
|
+
|
32
|
+
category = VCR.use_cassette('category:find:party:locale:es_MX') do
|
33
|
+
RSpotify::Category.find('party', locale: 'es_MX')
|
34
|
+
end
|
35
|
+
expect(category.href) .to eq 'https://api.spotify.com/v1/browse/categories/party'
|
36
|
+
expect(category.name) .to eq 'Party'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'Category::list' do
|
41
|
+
it 'should get the right categories' do
|
42
|
+
categories = VCR.use_cassette('category:list') do
|
43
|
+
RSpotify::Category.list
|
44
|
+
end
|
45
|
+
|
46
|
+
expect(categories.size) .to eq 20
|
47
|
+
expect(categories.map(&:name)) .to include('Top Lists', 'Country', 'Decades')
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should get the right categories with additional attributes' do
|
51
|
+
categories = VCR.use_cassette('category:list:locale:es_MX:limit:10') do
|
52
|
+
RSpotify::Category.list(locale: 'es_MX', limit: 10)
|
53
|
+
end
|
54
|
+
expect(categories.size) .to eq 10
|
55
|
+
expect(categories.map(&:name)) .to include('Mood', 'Pop', 'Chill')
|
56
|
+
|
57
|
+
categories = VCR.use_cassette('category:list:country:BR') do
|
58
|
+
RSpotify::Category.list(country: 'BR')
|
59
|
+
end
|
60
|
+
expect(categories.map(&:name)) .to include('Mood', 'Pop', 'Chill')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe 'Category#complete!' do
|
65
|
+
let(:category) do
|
66
|
+
RSpotify::Category.new({'id' => 'party'})
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should fetch the complete information correctly' do
|
70
|
+
VCR.use_cassette('category:find:party') do
|
71
|
+
category.complete!
|
72
|
+
end
|
73
|
+
expect(category.href) .to eq 'https://api.spotify.com/v1/browse/categories/party'
|
74
|
+
expect(category.icons.first['url']) .to eq 'https://datsnxq1rwndn.cloudfront.net/media/derived/party-274x274_73d1907a7371c3bb96a288390a96ee27_0_0_274_274.jpg'
|
75
|
+
expect(category.name) .to eq 'Party'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe 'Category#playlists' do
|
80
|
+
let(:category) do
|
81
|
+
# Get party category as a testing sample
|
82
|
+
VCR.use_cassette('category:find:party') do
|
83
|
+
RSpotify::Category.find('party')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'should get correct playlists' do
|
88
|
+
playlists = VCR.use_cassette('category:party:playlists') do
|
89
|
+
category.playlists
|
90
|
+
end
|
91
|
+
|
92
|
+
expect(playlists) .to be_an Array
|
93
|
+
expect(playlists.size) .to eq 20
|
94
|
+
expect(playlists.first) .to be_an RSpotify::Playlist
|
95
|
+
expect(playlists.map(&:name)) .to include('Teen Party', 'Weekend Hangouts', 'Dance Party')
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'should get correct playlists with additional options' do
|
99
|
+
playlists = VCR.use_cassette('category:party:playlists:limit:10:offset:20') do
|
100
|
+
category.playlists(limit: 10, offset: 20)
|
101
|
+
end
|
102
|
+
expect(playlists.size) .to eq 10
|
103
|
+
expect(playlists.map(&:name)) .to include('Indie Brunch', 'Hipster Funk', 'Party Hits')
|
104
|
+
|
105
|
+
playlists = VCR.use_cassette('category:party:playlists:country:BR') do
|
106
|
+
category.playlists(country: 'BR')
|
107
|
+
end
|
108
|
+
expect(playlists.map(&:name)) .to include('Festa Indie', 'Esquenta Sertanejo', 'Cura Ressaca')
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -70,7 +70,7 @@ describe RSpotify::Track do
|
|
70
70
|
end
|
71
71
|
expect(tracks) .to be_an Array
|
72
72
|
expect(tracks.size) .to eq 20
|
73
|
-
expect(tracks.total) .to eq
|
73
|
+
expect(tracks.total) .to eq 3647
|
74
74
|
expect(tracks.first) .to be_an RSpotify::Track
|
75
75
|
expect(tracks.map(&:name)) .to include('Do I Wanna Know?', 'I Wanna Know', 'Never Wanna Know')
|
76
76
|
end
|
@@ -86,13 +86,13 @@ describe RSpotify::Track do
|
|
86
86
|
RSpotify::Track.search('Wanna Know', offset: 10)
|
87
87
|
end
|
88
88
|
expect(tracks.size) .to eq 20
|
89
|
-
expect(tracks.map(&:name)) .to include('They Wanna Know', '
|
89
|
+
expect(tracks.map(&:name)) .to include('They Wanna Know', 'You Wanna Know')
|
90
90
|
|
91
91
|
tracks = VCR.use_cassette('track:search:Wanna Know:limit:10:offset:10') do
|
92
92
|
RSpotify::Track.search('Wanna Know', limit: 10, offset: 10)
|
93
93
|
end
|
94
94
|
expect(tracks.size) .to eq 10
|
95
|
-
expect(tracks.map(&:name)) .to include('
|
95
|
+
expect(tracks.map(&:name)) .to include('You Wanna Know')
|
96
96
|
|
97
97
|
tracks = VCR.use_cassette('track:search:Wanna Know:market:ES') do
|
98
98
|
RSpotify::Track.search('Wanna Know', market: 'ES')
|
@@ -0,0 +1,64 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.spotify.com/v1/browse/categories/party
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
accept-encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
authorization:
|
15
|
+
- Bearer BQAZNHzH_x3pHOISyXRF0LUn9MpDRXoXhYwISe5wlkgnYLQTSCRUDL3rlbwnpFehqlRgZOFIkNil9D8bzYu8ZQ
|
16
|
+
user-agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
server:
|
24
|
+
- nginx
|
25
|
+
date:
|
26
|
+
- Fri, 13 Feb 2015 20:56:57 GMT
|
27
|
+
content-type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
transfer-encoding:
|
30
|
+
- chunked
|
31
|
+
connection:
|
32
|
+
- keep-alive
|
33
|
+
keep-alive:
|
34
|
+
- timeout=600
|
35
|
+
cache-control:
|
36
|
+
- private, max-age=0
|
37
|
+
access-control-allow-headers:
|
38
|
+
- Accept, Authorization, Origin, Content-Type
|
39
|
+
access-control-allow-origin:
|
40
|
+
- "*"
|
41
|
+
access-control-max-age:
|
42
|
+
- '604800'
|
43
|
+
access-control-allow-methods:
|
44
|
+
- GET, POST, OPTIONS, PUT, DELETE
|
45
|
+
access-control-allow-credentials:
|
46
|
+
- 'true'
|
47
|
+
content-encoding:
|
48
|
+
- gzip
|
49
|
+
x-content-type-options:
|
50
|
+
- nosniff
|
51
|
+
strict-transport-security:
|
52
|
+
- max-age=31536000;
|
53
|
+
body:
|
54
|
+
encoding: ASCII-8BIT
|
55
|
+
string: !binary |-
|
56
|
+
H4sIAAAAAAAAAFSP3W7CMAyF73mKqNeQ9GcilKfY/TShNHbbTDTJEkNBiHcn
|
57
|
+
abnYZFmyP1nnHD82jBVjwL5gxzQQ+XgUQnnDo3dk+jvXbhLXSnTBzRGFVoSD
|
58
|
+
Cwaj8CrQvdhmAaOdjVnhiz3SniXRDCNlVMuP7cou4fzPBRRFe/utwmzBcn12
|
59
|
+
F+iDs8QtkpgQjBKAwVwRVq9dkrqlPskGqraUSjay0k3XtXtVHw5NW6p2j1jL
|
60
|
+
U5kqH6bmP34o3gFmAzS+MyXyZN9relhi/fnHqgkX9rmwzfMFAAD//wMAvTrQ
|
61
|
+
3icBAAA=
|
62
|
+
http_version: '1.1'
|
63
|
+
recorded_at: Fri, 13 Feb 2015 20:56:57 GMT
|
64
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,64 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.spotify.com/v1/browse/categories/party?country=BR
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
accept-encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
authorization:
|
15
|
+
- Bearer BQAZNHzH_x3pHOISyXRF0LUn9MpDRXoXhYwISe5wlkgnYLQTSCRUDL3rlbwnpFehqlRgZOFIkNil9D8bzYu8ZQ
|
16
|
+
user-agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
server:
|
24
|
+
- nginx
|
25
|
+
date:
|
26
|
+
- Fri, 13 Feb 2015 20:56:58 GMT
|
27
|
+
content-type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
transfer-encoding:
|
30
|
+
- chunked
|
31
|
+
connection:
|
32
|
+
- keep-alive
|
33
|
+
keep-alive:
|
34
|
+
- timeout=600
|
35
|
+
cache-control:
|
36
|
+
- private, max-age=0
|
37
|
+
access-control-allow-headers:
|
38
|
+
- Accept, Authorization, Origin, Content-Type
|
39
|
+
access-control-allow-origin:
|
40
|
+
- "*"
|
41
|
+
access-control-max-age:
|
42
|
+
- '604800'
|
43
|
+
access-control-allow-methods:
|
44
|
+
- GET, POST, OPTIONS, PUT, DELETE
|
45
|
+
access-control-allow-credentials:
|
46
|
+
- 'true'
|
47
|
+
content-encoding:
|
48
|
+
- gzip
|
49
|
+
x-content-type-options:
|
50
|
+
- nosniff
|
51
|
+
strict-transport-security:
|
52
|
+
- max-age=31536000;
|
53
|
+
body:
|
54
|
+
encoding: ASCII-8BIT
|
55
|
+
string: !binary |-
|
56
|
+
H4sIAAAAAAAAAFSP3W7CMAyF73mKqNeQ9GcilKfY/TShNHbbTDTJEkNBiHcn
|
57
|
+
abnYZFmyP1nnHD82jBVjwL5gxzQQ+XgUQnnDo3dk+jvXbhLXSnTBzRGFVoSD
|
58
|
+
Cwaj8CrQvdhmAaOdjVnhiz3SniXRDCNlVMuP7cou4fzPBRRFe/utwmzBcn12
|
59
|
+
F+iDs8QtkpgQjBKAwVwRVq9dkrqlPskGqraUSjay0k3XtXtVHw5NW6p2j1jL
|
60
|
+
U5kqH6bmP34o3gFmAzS+MyXyZN9relhi/fnHqgkX9rmwzfMFAAD//wMAvTrQ
|
61
|
+
3icBAAA=
|
62
|
+
http_version: '1.1'
|
63
|
+
recorded_at: Fri, 13 Feb 2015 20:56:58 GMT
|
64
|
+
recorded_with: VCR 2.9.3
|