rspotify 1.16.1 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rspotify/album.rb +6 -2
- data/lib/rspotify/version.rb +1 -1
- data/spec/lib/rspotify/album_spec.rb +11 -10
- 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: ec64ebb3e63e640a69c4fc621b98927e493340b2
|
4
|
+
data.tar.gz: 1f2586292e73e9af6d7ff149a7a872e28e9d6f65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e5845de63d4bf7153726d24eda36de52306a798d6f439970434bc0850befbfeea4af4f149c7c87cf2e2aa2b3192530f916231f84760bdef6e1deb4e70438630
|
7
|
+
data.tar.gz: aca1f97b5fb3d2bd385eb96cd11b18c1093965af878ee1aaf3951040075a72c5c90848ffc58157bbfed40f586b6a4dd5bfcf313fefba2074b6e89ba4edf6dd74
|
data/lib/rspotify/album.rb
CHANGED
@@ -11,6 +11,7 @@ module RSpotify
|
|
11
11
|
# @attr [Integer] popularity The popularity of the album. The value will be between 0 and 100, with 100 being the most popular
|
12
12
|
# @attr [String] release_date The date the album was first released, for example "1981-12-15". Depending on the precision, it might be shown as "1981" or "1981-12"
|
13
13
|
# @attr [String] release_date_precision The precision with which release_date value is known: "year", "month", or "day"
|
14
|
+
# @attr [Integer] total_tracks The total number of tracks in the album
|
14
15
|
class Album < Base
|
15
16
|
|
16
17
|
# Returns Album object(s) with id(s) provided
|
@@ -84,8 +85,11 @@ module RSpotify
|
|
84
85
|
options['artists'].map { |a| Artist.new a }
|
85
86
|
end
|
86
87
|
|
87
|
-
@tracks_cache = if options['tracks'] && options['tracks']['items']
|
88
|
-
|
88
|
+
@tracks_cache, @total_tracks = if options['tracks'] && options['tracks']['items']
|
89
|
+
[
|
90
|
+
options['tracks']['items'].map { |i| Track.new i },
|
91
|
+
options['tracks']['total']
|
92
|
+
]
|
89
93
|
end
|
90
94
|
|
91
95
|
super(options)
|
data/lib/rspotify/version.rb
CHANGED
@@ -15,7 +15,7 @@ describe RSpotify::Album do
|
|
15
15
|
expect(@album.copyrights) .to include ({'text' => '2013 Domino Recording Co Ltd', 'type' => 'C'})
|
16
16
|
expect(@album.external_ids['upc']) .to eq '887828031795'
|
17
17
|
expect(@album.external_urls['spotify']) .to eq 'https://open.spotify.com/album/5bU1XKYxHhEwukllT20xtk'
|
18
|
-
expect(@album.genres) .to be_an Array
|
18
|
+
expect(@album.genres) .to be_an Array
|
19
19
|
expect(@album.href) .to eq 'https://api.spotify.com/v1/albums/5bU1XKYxHhEwukllT20xtk'
|
20
20
|
expect(@album.id) .to eq '5bU1XKYxHhEwukllT20xtk'
|
21
21
|
expect(@album.images) .to include ({'height' => 640, 'width' => 640, 'url' => 'https://i.scdn.co/image/4d9ec146e3a257b10634d9a413ef6cc3de325008'})
|
@@ -25,6 +25,7 @@ describe RSpotify::Album do
|
|
25
25
|
expect(@album.release_date_precision) .to eq 'day'
|
26
26
|
expect(@album.type) .to eq 'album'
|
27
27
|
expect(@album.uri) .to eq 'spotify:album:5bU1XKYxHhEwukllT20xtk'
|
28
|
+
expect(@album.total_tracks) .to eq 12
|
28
29
|
end
|
29
30
|
|
30
31
|
it 'should find album with correct artists' do
|
@@ -47,7 +48,7 @@ describe RSpotify::Album do
|
|
47
48
|
describe 'Album::find receiving array of ids' do
|
48
49
|
it 'should find the right albums' do
|
49
50
|
ids = ['2agWNCZl5Ts9W05mij8EPh']
|
50
|
-
albums = VCR.use_cassette('album:find:2agWNCZl5Ts9W05mij8EPh') do
|
51
|
+
albums = VCR.use_cassette('album:find:2agWNCZl5Ts9W05mij8EPh') do
|
51
52
|
RSpotify::Album.find(ids)
|
52
53
|
end
|
53
54
|
expect(albums) .to be_an Array
|
@@ -55,7 +56,7 @@ describe RSpotify::Album do
|
|
55
56
|
expect(albums.first.name) .to eq 'The Next Day Extra'
|
56
57
|
|
57
58
|
ids << '3JquYMWj5wrzuZCNAvOYN9'
|
58
|
-
albums = VCR.use_cassette('album:find:3JquYMWj5wrzuZCNAvOYN9') do
|
59
|
+
albums = VCR.use_cassette('album:find:3JquYMWj5wrzuZCNAvOYN9') do
|
59
60
|
RSpotify::Album.find(ids)
|
60
61
|
end
|
61
62
|
expect(albums) .to be_an Array
|
@@ -77,7 +78,7 @@ describe RSpotify::Album do
|
|
77
78
|
end
|
78
79
|
|
79
80
|
it 'should find the appropriate new releases' do
|
80
|
-
albums = VCR.use_cassette('album:new_releases') do
|
81
|
+
albums = VCR.use_cassette('album:new_releases') do
|
81
82
|
RSpotify::Album.new_releases
|
82
83
|
end
|
83
84
|
expect(albums.size) .to eq 20
|
@@ -85,13 +86,13 @@ describe RSpotify::Album do
|
|
85
86
|
end
|
86
87
|
|
87
88
|
it 'should accept additional options' do
|
88
|
-
albums = VCR.use_cassette('album:new_releases:limit:10:offset:10') do
|
89
|
+
albums = VCR.use_cassette('album:new_releases:limit:10:offset:10') do
|
89
90
|
RSpotify::Album.new_releases(limit: 10, offset: 10)
|
90
91
|
end
|
91
92
|
expect(albums.size) .to eq 10
|
92
93
|
expect(albums.map(&:name)) .to include('Recess', 'Atlas', 'Magic')
|
93
94
|
|
94
|
-
albums = VCR.use_cassette('album:new_releases:country:ES') do
|
95
|
+
albums = VCR.use_cassette('album:new_releases:country:ES') do
|
95
96
|
RSpotify::Album.new_releases(country: 'ES')
|
96
97
|
end
|
97
98
|
expect(albums.size) .to eq 20
|
@@ -101,7 +102,7 @@ describe RSpotify::Album do
|
|
101
102
|
|
102
103
|
describe 'Album::search' do
|
103
104
|
it 'should search for the right albums' do
|
104
|
-
albums = VCR.use_cassette('album:search:AM') do
|
105
|
+
albums = VCR.use_cassette('album:search:AM') do
|
105
106
|
RSpotify::Album.search('AM')
|
106
107
|
end
|
107
108
|
expect(albums) .to be_an Array
|
@@ -112,19 +113,19 @@ describe RSpotify::Album do
|
|
112
113
|
end
|
113
114
|
|
114
115
|
it 'should accept additional options' do
|
115
|
-
albums = VCR.use_cassette('album:search:AM:limit:10') do
|
116
|
+
albums = VCR.use_cassette('album:search:AM:limit:10') do
|
116
117
|
RSpotify::Album.search('AM', limit: 10)
|
117
118
|
end
|
118
119
|
expect(albums.size) .to eq 10
|
119
120
|
expect(albums.map(&:name)) .to include('AM', 'Am I Wrong')
|
120
121
|
|
121
|
-
albums = VCR.use_cassette('album:search:AM:offset:10') do
|
122
|
+
albums = VCR.use_cassette('album:search:AM:offset:10') do
|
122
123
|
RSpotify::Album.search('AM', offset: 10)
|
123
124
|
end
|
124
125
|
expect(albums.size) .to eq 20
|
125
126
|
expect(albums.map(&:name)) .to include('Melody AM', 'I Am')
|
126
127
|
|
127
|
-
albums = VCR.use_cassette('album:search:AM:offset:10:limit:10') do
|
128
|
+
albums = VCR.use_cassette('album:search:AM:offset:10:limit:10') do
|
128
129
|
RSpotify::Album.search('AM', limit: 10, offset: 10)
|
129
130
|
end
|
130
131
|
expect(albums.size) .to eq 10
|
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: 1.
|
4
|
+
version: 1.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Sad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|