rspotify 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/rspotify.rb +0 -1
- data/lib/rspotify/base.rb +12 -7
- data/lib/rspotify/playlist.rb +1 -1
- data/lib/rspotify/user.rb +1 -1
- data/lib/rspotify/version.rb +1 -1
- data/spec/lib/rspotify/playlist_spec.rb +1 -1
- data/spec/lib/rspotify/track_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4976cbb938eca04f4a36e3084052c4ed1fb0d119
|
4
|
+
data.tar.gz: 0f6d2a0a7a6a5a73eda3d8e5a26ca4e6070c0de1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa34c1e3e875b2bf8d34a65d0f524473a5d28aaf7b997da6f30b2c7d0de4024bf965523cf23f9ff1368138042eaee4702fcc561012746b8f155687533f9ac3f4
|
7
|
+
data.tar.gz: 7d3a74a7c1308fcabb2297f6968f9e6bebb87c88d4175305b971682f4116f8db37de6ad900676be3e61f79ad7db4ac4c665ab9a52cd156a7aab5842d67864283
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ artists = RSpotify::Artist.search('Arctic Monkeys')
|
|
28
28
|
arctic_monkeys = artists.first
|
29
29
|
arctic_monkeys.popularity #=> 74
|
30
30
|
arctic_monkeys.genres #=> ["Alternative Pop/Rock", "Indie", ...]
|
31
|
-
arctic_monkeys.top_tracks
|
31
|
+
arctic_monkeys.top_tracks(:US) #=> (Track array)
|
32
32
|
|
33
33
|
albums = arctic_monkeys.albums
|
34
34
|
albums.first.name #=> "AM"
|
@@ -51,7 +51,7 @@ albums = RSpotify::Album.search('The Wall')
|
|
51
51
|
tracks = RSpotify::Track.search('Thriller')
|
52
52
|
```
|
53
53
|
|
54
|
-
|
54
|
+
Find by id:
|
55
55
|
|
56
56
|
```ruby
|
57
57
|
arctic_monkeys = RSpotify::Artist.find('7Ln80lUS6He07XvHI8qqHH')
|
@@ -81,7 +81,7 @@ Then just copy and paste them like so:
|
|
81
81
|
```ruby
|
82
82
|
RSpotify.authenticate("<your_client_id>", "<your_client_secret>")
|
83
83
|
|
84
|
-
# Now you can access any public playlist and much more
|
84
|
+
# Now you can access any public playlist and much more
|
85
85
|
|
86
86
|
playlist = RSpotify::Playlist.find('wizzler', '00wHcTN0zQiun4xri9pmvX')
|
87
87
|
playlist.name #=> "Movie Soundtrack Masterpieces"
|
data/lib/rspotify.rb
CHANGED
data/lib/rspotify/base.rb
CHANGED
@@ -58,10 +58,10 @@ module RSpotify
|
|
58
58
|
|
59
59
|
# Returns array of RSpotify objects matching the query, ordered by popularity
|
60
60
|
#
|
61
|
-
# @param query
|
62
|
-
# @param type
|
63
|
-
# @param limit
|
64
|
-
# @param offset [Integer]
|
61
|
+
# @param query [String] The search query's keywords.
|
62
|
+
# @param type [String] Valid types are: album, artist and track
|
63
|
+
# @param limit [Integer] Maximum number of objects to return. Minimum: 1. Maximum: 50.
|
64
|
+
# @param offset [Integer] The index of the first object to return. Use with limit to get the next set of objects.
|
65
65
|
# @return [Array<Album>, Array<Artist>, Array<Track>]
|
66
66
|
#
|
67
67
|
# @example
|
@@ -73,6 +73,11 @@ module RSpotify
|
|
73
73
|
# albums = RSpotify::Base.search('AM', 'album', 10)
|
74
74
|
# albums.size #=> 10
|
75
75
|
def self.search(query, type, limit = 20, offset = 0)
|
76
|
+
if limit < 1 || limit > 50
|
77
|
+
warn "Limit must be between 1 and 50"
|
78
|
+
return false
|
79
|
+
end
|
80
|
+
|
76
81
|
pluralized_type = "#{type}s"
|
77
82
|
type_class = RSpotify.const_get(type.capitalize)
|
78
83
|
|
@@ -123,13 +128,13 @@ module RSpotify
|
|
123
128
|
# track.instance_variable_get("@popularity") #=> 62
|
124
129
|
def method_missing(method_name, *args)
|
125
130
|
attr = "@#{method_name}"
|
126
|
-
super unless instance_variable_defined? attr
|
131
|
+
super unless instance_variable_defined? attr
|
127
132
|
|
128
|
-
attr_value = instance_variable_get attr
|
133
|
+
attr_value = instance_variable_get attr
|
129
134
|
return attr_value unless attr_value.nil?
|
130
135
|
|
131
136
|
complete!
|
132
|
-
instance_variable_get attr
|
137
|
+
instance_variable_get attr
|
133
138
|
end
|
134
139
|
|
135
140
|
# Overrides Object#respond_to? to also consider methods dynamically generated by {#method_missing}
|
data/lib/rspotify/playlist.rb
CHANGED
data/lib/rspotify/user.rb
CHANGED
data/lib/rspotify/version.rb
CHANGED
@@ -16,7 +16,7 @@ describe RSpotify::Playlist do
|
|
16
16
|
expect(@playlist.collaborative) .to eq false
|
17
17
|
expect(@playlist.external_urls['spotify']) .to eq 'http://open.spotify.com/user/wizzler/playlist/00wHcTN0zQiun4xri9pmvX'
|
18
18
|
expect(@playlist.description) .to match /Iconic soundtracks featured in some of the greatest movies/
|
19
|
-
expect(@playlist.followers['total']) .to
|
19
|
+
expect(@playlist.followers['total']) .to be > 0
|
20
20
|
expect(@playlist.href) .to eq 'https://api.spotify.com/v1/users/wizzler/playlists/00wHcTN0zQiun4xri9pmvX'
|
21
21
|
expect(@playlist.id) .to eq '00wHcTN0zQiun4xri9pmvX'
|
22
22
|
expect(@playlist.images.first['url']) .to match %r{https://dv72vokf4bztv\.cloudfront}
|
@@ -10,7 +10,7 @@ describe RSpotify::Track do
|
|
10
10
|
it 'should find track with correct attributes' do
|
11
11
|
expect(@track.available_markets) .to include *%w(AD AT BE BG CA EE ES FR GR MC TW US)
|
12
12
|
expect(@track.disc_number) .to eq 1
|
13
|
-
expect(@track.duration_ms) .to eq
|
13
|
+
expect(@track.duration_ms) .to eq 272_394
|
14
14
|
expect(@track.explicit) .to eq false
|
15
15
|
expect(@track.external_ids['isrc']) .to eq 'GBCEL1300362'
|
16
16
|
expect(@track.external_urls['spotify']) .to eq 'https://open.spotify.com/track/3jfr0TF6DQcOLat8gGn7E2'
|
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: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Sad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest_client
|