spotify-charts 0.0.1 → 0.0.2
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/CHANGELOG.md +18 -0
- data/LICENSE +1 -1
- data/README.md +24 -9
- data/lib/spotify/charts.rb +15 -7
- data/lib/spotify/charts/client.rb +1 -1
- data/lib/spotify/charts/track.rb +20 -3
- data/lib/spotify/charts/version.rb +1 -1
- data/spec/examples.txt +41 -0
- data/spec/lib/spotify/charts/client_spec.rb +15 -20
- data/spec/lib/spotify/charts/track_parser_spec.rb +67 -68
- data/spec/lib/spotify/charts/track_spec.rb +49 -49
- data/spec/lib/spotify/charts_spec.rb +176 -134
- data/spec/spec_helper.rb +90 -5
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8970a1d4ad3b28688d0815522c3f2c639fc1f74f
|
|
4
|
+
data.tar.gz: 4614e7fdd13a9279469fa26d99a359572198cbd8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb5f4f0c461948e75bd98d8b8e0218d8b5319e21588818f85b2de5f745593923de32ab21ac58ed89c9dd5b899129e1b398fac6527629c8ab26b17b50b644b6aa
|
|
7
|
+
data.tar.gz: 460058353f66e6d1fca5e82181f18f74178fee2f64fda50fc3700b8f63a3b9a7ceb4fd33d8a3eea51117d26a759a2d03f6150131c407f4e611231cf575a2a296
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# v0.0.2
|
|
2
|
+
* Updated README.
|
|
3
|
+
* Added CHANGELOG.
|
|
4
|
+
* Updated LICENSE years.
|
|
5
|
+
* Changed all hashes to Ruby 1.9 hash syntax.
|
|
6
|
+
* Upgraded Ruby version to 2.2.3.
|
|
7
|
+
* Updated all gems.
|
|
8
|
+
* Stated all dependencies in the code files.
|
|
9
|
+
* Fixed changed Spotify API. Thanks to `Scott Hiller`.
|
|
10
|
+
* Renamed `most_shared` to `most_viral` to stay in sync with Spotify API.
|
|
11
|
+
* Migrates to container based Travis CI infrastructure.
|
|
12
|
+
|
|
13
|
+
# v0.0.1
|
|
14
|
+
* support for `available_countries`, `available_dates(country)`, `most_streamed(country, date)`
|
|
15
|
+
and `most_shared(country, date)`
|
|
16
|
+
* added Travis CI, Gemnasium and CodeClimate integration
|
|
17
|
+
* tested with `rspec` and coverage measured with `simplecov`
|
|
18
|
+
* initial version
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
[](https://travis-ci.org/murphyslaw/spotify-charts)
|
|
7
7
|
|
|
8
8
|
A Ruby wrapper for the public [Spotify Charts API](http://charts.spotify.com/) to retrieve the
|
|
9
|
-
top 50
|
|
9
|
+
top 50 viral or streamed tracks on Spotify.
|
|
10
|
+
|
|
10
11
|
|
|
11
12
|
## Installation
|
|
12
13
|
|
|
@@ -22,6 +23,11 @@ Or install it yourself as:
|
|
|
22
23
|
|
|
23
24
|
$ gem install spotify-charts
|
|
24
25
|
|
|
26
|
+
And then require:
|
|
27
|
+
|
|
28
|
+
require 'spotify/charts'
|
|
29
|
+
|
|
30
|
+
|
|
25
31
|
## Usage
|
|
26
32
|
|
|
27
33
|
Retrieve **Available Countries**
|
|
@@ -30,27 +36,35 @@ Retrieve **Available Countries**
|
|
|
30
36
|
Spotify::Charts.available_countries
|
|
31
37
|
```
|
|
32
38
|
|
|
33
|
-
Retrieve **Available
|
|
39
|
+
Retrieve **Available Time Window Types** for a given country. The country needs to be in the format returned
|
|
34
40
|
by `available_countries` method.
|
|
35
41
|
|
|
36
42
|
```
|
|
37
|
-
Spotify::Charts.
|
|
43
|
+
Spotify::Charts.available_time_window_types(country)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Retrieve **Available Dates** for a given country and time window type. The country and time window type need to be in the format returned
|
|
47
|
+
by `.available_countries` and `.available_time_window_types` methods.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
Spotify::Charts.available_dates(country, time_window_type)
|
|
38
51
|
```
|
|
39
52
|
|
|
40
|
-
Retrieve **Most
|
|
41
|
-
format returned by
|
|
53
|
+
Retrieve **Most Viral** tracks for a given country, time window type and date. The country, time window type and date need to be in the
|
|
54
|
+
format returned by `.available_countries`, `.available_time_window_types` and `.availabe_dates` methods.
|
|
42
55
|
|
|
43
56
|
```
|
|
44
|
-
Spotify::Charts.
|
|
57
|
+
Spotify::Charts.most_viral(country, time_window_type, date)
|
|
45
58
|
```
|
|
46
59
|
|
|
47
|
-
Retrieve **Most Streamed** tracks for a given country and date. The country and date need to be in
|
|
48
|
-
the format returned by
|
|
60
|
+
Retrieve **Most Streamed** tracks for a given country, time window type and date. The country, time window type and date need to be in
|
|
61
|
+
the format returned by `.available_countries`, `.available_time_window_types` and `.availabe_dates` methods.
|
|
49
62
|
|
|
50
63
|
```
|
|
51
|
-
Spotify::Charts.most_streamed(country, date)
|
|
64
|
+
Spotify::Charts.most_streamed(country, time_window_type date)
|
|
52
65
|
```
|
|
53
66
|
|
|
67
|
+
|
|
54
68
|
## Testing
|
|
55
69
|
|
|
56
70
|
The default `rake` task is configured to run all tests.
|
|
@@ -62,6 +76,7 @@ rake
|
|
|
62
76
|
`ZenTest` is used for continous testing. Run `autotest` to start.
|
|
63
77
|
`simplecov` is used for test coverage. Run `open coverage/index.html` to open the results.
|
|
64
78
|
|
|
79
|
+
|
|
65
80
|
## Contributing
|
|
66
81
|
|
|
67
82
|
1. Fork it (https://github.com/murphyslaw/spotify-charts/fork)
|
data/lib/spotify/charts.rb
CHANGED
|
@@ -6,20 +6,28 @@ require 'spotify/charts/track_parser'
|
|
|
6
6
|
module Spotify
|
|
7
7
|
module Charts
|
|
8
8
|
class << self
|
|
9
|
+
def available_metrics
|
|
10
|
+
client.request('/')
|
|
11
|
+
end
|
|
12
|
+
|
|
9
13
|
def available_countries
|
|
10
|
-
client.request('/
|
|
14
|
+
client.request('/most_viral/')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def available_time_window_types(country)
|
|
18
|
+
client.request("/most_viral/#{country}/")
|
|
11
19
|
end
|
|
12
20
|
|
|
13
|
-
def available_dates(country)
|
|
14
|
-
client.request("/
|
|
21
|
+
def available_dates(country, time_window_type)
|
|
22
|
+
client.request("/most_viral/#{country}/#{time_window_type}/")
|
|
15
23
|
end
|
|
16
24
|
|
|
17
|
-
def
|
|
18
|
-
extract_tracks("/
|
|
25
|
+
def most_viral(country, time_window_type, date)
|
|
26
|
+
extract_tracks("/most_viral/#{country}/#{time_window_type}/#{date}")
|
|
19
27
|
end
|
|
20
28
|
|
|
21
|
-
def most_streamed(country, date)
|
|
22
|
-
extract_tracks("/most_streamed/#{country}/#{date}")
|
|
29
|
+
def most_streamed(country, time_window_type, date)
|
|
30
|
+
extract_tracks("/most_streamed/#{country}/#{time_window_type}/#{date}")
|
|
23
31
|
end
|
|
24
32
|
|
|
25
33
|
private
|
data/lib/spotify/charts/track.rb
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
module Spotify
|
|
2
2
|
module Charts
|
|
3
3
|
class Track
|
|
4
|
-
attr_accessor :date
|
|
5
|
-
|
|
4
|
+
attr_accessor :date
|
|
5
|
+
attr_accessor :country
|
|
6
|
+
attr_accessor :track_url
|
|
7
|
+
attr_accessor :track_name
|
|
8
|
+
attr_accessor :artist_name
|
|
9
|
+
attr_accessor :artist_url
|
|
10
|
+
attr_accessor :album_name
|
|
11
|
+
attr_accessor :album_url
|
|
12
|
+
attr_accessor :artwork_url
|
|
13
|
+
attr_accessor :num_streams
|
|
6
14
|
|
|
7
15
|
def ==(other)
|
|
8
16
|
other.class == self.class && other.state == state
|
|
@@ -12,7 +20,16 @@ module Spotify
|
|
|
12
20
|
protected
|
|
13
21
|
|
|
14
22
|
def state
|
|
15
|
-
[
|
|
23
|
+
[
|
|
24
|
+
date,
|
|
25
|
+
country,
|
|
26
|
+
track_url,
|
|
27
|
+
track_name,
|
|
28
|
+
artist_name,
|
|
29
|
+
album_name,
|
|
30
|
+
artwork_url,
|
|
31
|
+
num_streams
|
|
32
|
+
]
|
|
16
33
|
end
|
|
17
34
|
end
|
|
18
35
|
end
|
data/spec/examples.txt
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
example_id | status | run_time |
|
|
2
|
+
------------------------------------------------------ | ------ | --------------- |
|
|
3
|
+
./spec/lib/spotify/charts/client_spec.rb[1:1:1] | passed | 0.0001 seconds |
|
|
4
|
+
./spec/lib/spotify/charts/client_spec.rb[1:2:1] | passed | 0.00054 seconds |
|
|
5
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:1] | passed | 0.00007 seconds |
|
|
6
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:1] | passed | 0.00022 seconds |
|
|
7
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:2] | passed | 0.00023 seconds |
|
|
8
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:3] | passed | 0.00023 seconds |
|
|
9
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:4] | passed | 0.00025 seconds |
|
|
10
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:5] | passed | 0.00023 seconds |
|
|
11
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:6] | passed | 0.00022 seconds |
|
|
12
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:7] | passed | 0.0002 seconds |
|
|
13
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:8] | passed | 0.00036 seconds |
|
|
14
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:9] | passed | 0.00024 seconds |
|
|
15
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:10] | passed | 0.00025 seconds |
|
|
16
|
+
./spec/lib/spotify/charts/track_parser_spec.rb[1:2:11] | passed | 0.00026 seconds |
|
|
17
|
+
./spec/lib/spotify/charts/track_spec.rb[1:1] | passed | 0.00022 seconds |
|
|
18
|
+
./spec/lib/spotify/charts/track_spec.rb[1:2] | passed | 0.00018 seconds |
|
|
19
|
+
./spec/lib/spotify/charts/track_spec.rb[1:3] | passed | 0.00018 seconds |
|
|
20
|
+
./spec/lib/spotify/charts/track_spec.rb[1:4] | passed | 0.00019 seconds |
|
|
21
|
+
./spec/lib/spotify/charts/track_spec.rb[1:5] | passed | 0.00019 seconds |
|
|
22
|
+
./spec/lib/spotify/charts/track_spec.rb[1:6] | passed | 0.00025 seconds |
|
|
23
|
+
./spec/lib/spotify/charts/track_spec.rb[1:7] | passed | 0.00023 seconds |
|
|
24
|
+
./spec/lib/spotify/charts/track_spec.rb[1:8] | passed | 0.00024 seconds |
|
|
25
|
+
./spec/lib/spotify/charts/track_spec.rb[1:9] | passed | 0.00024 seconds |
|
|
26
|
+
./spec/lib/spotify/charts/track_spec.rb[1:10] | passed | 0.00019 seconds |
|
|
27
|
+
./spec/lib/spotify/charts/track_spec.rb[1:11] | passed | 0.00019 seconds |
|
|
28
|
+
./spec/lib/spotify/charts_spec.rb[1:1:1] | passed | 0.00046 seconds |
|
|
29
|
+
./spec/lib/spotify/charts_spec.rb[1:1:2] | passed | 0.00037 seconds |
|
|
30
|
+
./spec/lib/spotify/charts_spec.rb[1:1:3] | passed | 0.00117 seconds |
|
|
31
|
+
./spec/lib/spotify/charts_spec.rb[1:2:1] | passed | 0.00042 seconds |
|
|
32
|
+
./spec/lib/spotify/charts_spec.rb[1:2:2] | passed | 0.00041 seconds |
|
|
33
|
+
./spec/lib/spotify/charts_spec.rb[1:2:3] | passed | 0.00035 seconds |
|
|
34
|
+
./spec/lib/spotify/charts_spec.rb[1:3:1] | passed | 0.00042 seconds |
|
|
35
|
+
./spec/lib/spotify/charts_spec.rb[1:3:2] | passed | 0.00039 seconds |
|
|
36
|
+
./spec/lib/spotify/charts_spec.rb[1:4:1] | passed | 0.0005 seconds |
|
|
37
|
+
./spec/lib/spotify/charts_spec.rb[1:4:2] | passed | 0.00038 seconds |
|
|
38
|
+
./spec/lib/spotify/charts_spec.rb[1:5:1] | passed | 0.00645 seconds |
|
|
39
|
+
./spec/lib/spotify/charts_spec.rb[1:5:2] | passed | 0.0013 seconds |
|
|
40
|
+
./spec/lib/spotify/charts_spec.rb[1:6:1] | passed | 0.00053 seconds |
|
|
41
|
+
./spec/lib/spotify/charts_spec.rb[1:6:2] | passed | 0.00064 seconds |
|
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
require 'uri'
|
|
2
2
|
require 'net/http'
|
|
3
|
+
require 'spotify/charts/client'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
it 'returns the Spotify Charts API base uri' do
|
|
11
|
-
expect(subject.class.base_uri).to eq('http://charts.spotify.com/api/charts')
|
|
12
|
-
end
|
|
13
|
-
end
|
|
5
|
+
RSpec.describe Spotify::Charts::Client do
|
|
6
|
+
describe '.base_uri' do
|
|
7
|
+
it 'returns the Spotify Charts API base uri' do
|
|
8
|
+
expect(subject.class.base_uri).to eq('http://charts.spotify.com/api/tracks')
|
|
9
|
+
end
|
|
10
|
+
end
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
describe '#request' do
|
|
13
|
+
let(:endpoint) { '/most_viral/global/latest' }
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
before do
|
|
16
|
+
uri = URI(subject.class.base_uri + endpoint)
|
|
17
|
+
allow(Net::HTTP).to receive(:get).with(uri).once { '{"example":"json"}' }
|
|
18
|
+
end
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
end
|
|
26
|
-
end
|
|
20
|
+
it 'parses JSON response' do
|
|
21
|
+
expect(subject.request(endpoint)).to eq({'example' => 'json'})
|
|
27
22
|
end
|
|
28
23
|
end
|
|
29
24
|
end
|
|
@@ -1,86 +1,85 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'date'
|
|
2
|
+
require 'uri'
|
|
3
|
+
require 'spotify/charts/track'
|
|
4
|
+
require 'spotify/charts/track_parser'
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
describe TrackParser do
|
|
6
|
-
subject { TrackParser.new('example') }
|
|
6
|
+
RSpec.describe Spotify::Charts::TrackParser do
|
|
7
|
+
subject { described_class.new('example') }
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
it 'stores the attributes' do
|
|
10
|
+
expect(subject.attributes).to eq('example')
|
|
11
|
+
end
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
describe '#track' do
|
|
14
|
+
subject { described_class.new(attributes).track }
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
let(:attributes) do
|
|
17
|
+
{
|
|
18
|
+
'date' => '2013-12-15',
|
|
19
|
+
'country' => 'global',
|
|
20
|
+
'track_url' => 'https://play.spotify.com/track/7DyuZtvlGT0z5Xz8peiLN7',
|
|
21
|
+
'track_name' => 'I See Fire',
|
|
22
|
+
'artist_name' => 'Howard Shore',
|
|
23
|
+
'artist_url' => 'https://play.spotify.com/artist/6eUKZXaKkcviH0Ku9w2n3V',
|
|
24
|
+
'album_name' => 'The Hobbit: The Desolation of Smaug (Original Motion Picture Soundtrack)',
|
|
25
|
+
'album_url' => 'https://play.spotify.com/album/5kqgALc3cz9P3VclmSmHfr',
|
|
26
|
+
'artwork_url' => 'http://o.scdn.co/300/be7d523ea35aeb10f561712420d3429f0ec68eec',
|
|
27
|
+
'num_streams' => 515608,
|
|
28
|
+
}
|
|
29
|
+
end
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
it 'creates a track from JSON data' do
|
|
32
|
+
expect(subject).to be_a(Spotify::Charts::Track)
|
|
33
|
+
end
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
it 'transforms the date' do
|
|
36
|
+
expect(subject.date).to be_a(Date)
|
|
37
|
+
expect(subject.date).to eq(Date.parse('2013-12-15'))
|
|
38
|
+
end
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
it 'transforms the country' do
|
|
41
|
+
expect(subject.country).to be_a(String)
|
|
42
|
+
expect(subject.country).to eq('global')
|
|
43
|
+
end
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
it 'transforms the track url' do
|
|
46
|
+
expect(subject.track_url).to be_a(URI)
|
|
47
|
+
expect(subject.track_url).to eq(URI('https://play.spotify.com/track/7DyuZtvlGT0z5Xz8peiLN7'))
|
|
48
|
+
end
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
it 'transforms the track name' do
|
|
51
|
+
expect(subject.track_name).to be_a(String)
|
|
52
|
+
expect(subject.track_name).to eq('I See Fire')
|
|
53
|
+
end
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
it 'transforms the artist name' do
|
|
56
|
+
expect(subject.artist_name).to be_a(String)
|
|
57
|
+
expect(subject.artist_name).to eq('Howard Shore')
|
|
58
|
+
end
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
it 'transforms the artist url' do
|
|
61
|
+
expect(subject.artist_url).to be_a(URI)
|
|
62
|
+
expect(subject.artist_url).to eq(URI('https://play.spotify.com/artist/6eUKZXaKkcviH0Ku9w2n3V'))
|
|
63
|
+
end
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
it 'transforms the album name' do
|
|
66
|
+
expect(subject.album_name).to be_a(String)
|
|
67
|
+
expect(subject.album_name).to eq('The Hobbit: The Desolation of Smaug (Original Motion Picture Soundtrack)')
|
|
68
|
+
end
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
it 'transforms the album url' do
|
|
71
|
+
expect(subject.album_url).to be_a(URI)
|
|
72
|
+
expect(subject.album_url).to eq(URI('https://play.spotify.com/album/5kqgALc3cz9P3VclmSmHfr'))
|
|
73
|
+
end
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
it 'transforms the artwork url' do
|
|
76
|
+
expect(subject.artwork_url).to be_a(URI)
|
|
77
|
+
expect(subject.artwork_url).to eq(URI('http://o.scdn.co/300/be7d523ea35aeb10f561712420d3429f0ec68eec'))
|
|
78
|
+
end
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
end
|
|
83
|
-
end
|
|
80
|
+
it 'transforms the num_streams' do
|
|
81
|
+
expect(subject.num_streams).to be_a(Integer)
|
|
82
|
+
expect(subject.num_streams).to eq(515608)
|
|
84
83
|
end
|
|
85
84
|
end
|
|
86
85
|
end
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
+
require 'date'
|
|
1
2
|
require 'uri'
|
|
3
|
+
require 'spotify/charts/track'
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
RSpec.describe Spotify::Charts::Track do
|
|
6
|
+
subject do
|
|
7
|
+
described_class.new.tap do |t|
|
|
8
|
+
t.date = Date.parse('2013-12-15')
|
|
9
|
+
t.country = 'global'
|
|
10
|
+
t.track_url = URI('https://play.spotify.com/track/7DyuZtvlGT0z5Xz8peiLN7')
|
|
11
|
+
t.track_name = 'I See Fire'
|
|
12
|
+
t.artist_name = 'Howard Shore'
|
|
13
|
+
t.artist_url = URI('https://play.spotify.com/artist/6eUKZXaKkcviH0Ku9w2n3V')
|
|
14
|
+
t.album_name = 'The Hobbit: The Desolation of Smaug (Original Motion Picture Soundtrack)'
|
|
15
|
+
t.album_url = URI('https://play.spotify.com/album/5kqgALc3cz9P3VclmSmHfr')
|
|
16
|
+
t.artwork_url = URI('http://o.scdn.co/300/be7d523ea35aeb10f561712420d3429f0ec68eec')
|
|
17
|
+
t.num_streams = 515608
|
|
18
|
+
end
|
|
19
|
+
end
|
|
4
20
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
subject {
|
|
9
|
-
Track.new.tap do |t|
|
|
10
|
-
t.date = Date.parse('2013-12-15')
|
|
11
|
-
t.country = 'global'
|
|
12
|
-
t.track_url = URI('https://play.spotify.com/track/7DyuZtvlGT0z5Xz8peiLN7')
|
|
13
|
-
t.track_name = 'I See Fire'
|
|
14
|
-
t.artist_name = 'Howard Shore'
|
|
15
|
-
t.artist_url = URI('https://play.spotify.com/artist/6eUKZXaKkcviH0Ku9w2n3V')
|
|
16
|
-
t.album_name = 'The Hobbit: The Desolation of Smaug (Original Motion Picture Soundtrack)'
|
|
17
|
-
t.album_url = URI('https://play.spotify.com/album/5kqgALc3cz9P3VclmSmHfr')
|
|
18
|
-
t.artwork_url = URI('http://o.scdn.co/300/be7d523ea35aeb10f561712420d3429f0ec68eec')
|
|
19
|
-
t.num_streams = 515608
|
|
20
|
-
end
|
|
21
|
-
}
|
|
21
|
+
it 'initializes the date' do
|
|
22
|
+
expect(subject.date).to eq(Date.parse('2013-12-15'))
|
|
23
|
+
end
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
it 'initializes the country' do
|
|
26
|
+
expect(subject.country).to eq('global')
|
|
27
|
+
end
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
it 'initializes the track url' do
|
|
30
|
+
expect(subject.track_url).to eq(URI('https://play.spotify.com/track/7DyuZtvlGT0z5Xz8peiLN7'))
|
|
31
|
+
end
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
it 'initializes the track name' do
|
|
34
|
+
expect(subject.track_name).to eq('I See Fire')
|
|
35
|
+
end
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
it 'initializes the artist name' do
|
|
38
|
+
expect(subject.artist_name).to eq('Howard Shore')
|
|
39
|
+
end
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
it 'initializes the artist url' do
|
|
42
|
+
expect(subject.artist_url).to eq(URI('https://play.spotify.com/artist/6eUKZXaKkcviH0Ku9w2n3V'))
|
|
43
|
+
end
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
it 'initializes the album name' do
|
|
46
|
+
expect(subject.album_name).to eq('The Hobbit: The Desolation of Smaug (Original Motion Picture Soundtrack)')
|
|
47
|
+
end
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
it 'initializes the album url' do
|
|
50
|
+
expect(subject.album_url).to eq(URI('https://play.spotify.com/album/5kqgALc3cz9P3VclmSmHfr'))
|
|
51
|
+
end
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
it 'initializes the artwork url' do
|
|
54
|
+
expect(subject.artwork_url).to eq(URI('http://o.scdn.co/300/be7d523ea35aeb10f561712420d3429f0ec68eec'))
|
|
55
|
+
end
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
it 'initializes the number of streams' do
|
|
58
|
+
expect(subject.num_streams).to eq(515608)
|
|
59
|
+
end
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
end
|
|
62
|
-
end
|
|
61
|
+
it 'equals the same object' do
|
|
62
|
+
expect(subject).to eq(subject)
|
|
63
63
|
end
|
|
64
64
|
end
|
|
@@ -1,167 +1,209 @@
|
|
|
1
1
|
require 'net/http'
|
|
2
|
+
require 'spotify/charts'
|
|
3
|
+
require 'spotify/charts/client'
|
|
4
|
+
require 'spotify/charts/track'
|
|
5
|
+
require 'spotify/charts/track_parser'
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
RSpec.describe Spotify::Charts do
|
|
8
|
+
subject { described_class }
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
subject { Charts }
|
|
10
|
+
describe '.available_metrics' do
|
|
11
|
+
let(:response) { %w(most_viral most_streamed) }
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
13
|
+
before do
|
|
14
|
+
allow_any_instance_of(Spotify::Charts::Client).to receive(:request)
|
|
15
|
+
.with('/') { response }
|
|
16
|
+
end
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
end
|
|
18
|
+
it 'lists available metrcis' do
|
|
19
|
+
expect(subject.available_metrics).to be_a(Enumerable)
|
|
20
|
+
end
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
it 'includes the "most_viral" metric' do
|
|
23
|
+
expect(subject.available_metrics).to include('most_viral')
|
|
24
|
+
end
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
end
|
|
26
|
+
it 'includes the "most_streamed" metric' do
|
|
27
|
+
expect(subject.available_metrics).to include('most_streamed')
|
|
27
28
|
end
|
|
29
|
+
end
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
%w(latest 2013-12-08 2013-12-01 2013-11-24 2013-11-17 2013-11-10 2013-11-03 2013-10-27
|
|
32
|
-
2013-10-20 2013-10-13 2013-10-06 2013-09-29 2013-09-22 2013-09-15 2013-09-08 2013-09-01
|
|
33
|
-
2013-08-25 2013-08-18 2013-08-11 2013-08-04 2013-07-28 2013-07-21 2013-07-14 2013-07-07
|
|
34
|
-
2013-06-30 2013-06-23 2013-06-16 2013-06-09 2013-06-02 2013-05-26 2013-05-19 2013-05-12
|
|
35
|
-
2013-05-05 2013-04-28)
|
|
36
|
-
}
|
|
31
|
+
describe '.available_time_window_types' do
|
|
32
|
+
let(:response) { %w(daily weekly) }
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
before do
|
|
35
|
+
allow_any_instance_of(Spotify::Charts::Client).to receive(:request)
|
|
36
|
+
.with('/most_viral/global/') { response }
|
|
37
|
+
end
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
it 'lists available time window types' do
|
|
40
|
+
expect(subject.available_time_window_types('global')).to be_a(Enumerable)
|
|
41
|
+
end
|
|
46
42
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
end
|
|
43
|
+
it 'includes the "daily" metric' do
|
|
44
|
+
expect(subject.available_time_window_types('global')).to include('daily')
|
|
50
45
|
end
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
subject
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
47
|
+
it 'includes the "weekly" metric' do
|
|
48
|
+
expect(subject.available_time_window_types('global')).to include('weekly')
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe '.available_countries' do
|
|
53
|
+
let(:response) do
|
|
54
|
+
%w(ar at au be bg ch cl co cr cz de dk ec ee es fi fr gb gr gt hk hu ie is it li lt lu lv mx
|
|
55
|
+
my nl no nz pe pl pt se sg sk sv tr tw us uy global)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
before do
|
|
59
|
+
allow_any_instance_of(Spotify::Charts::Client).to receive(:request)
|
|
60
|
+
.with('/most_viral/') { response }
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'lists available countries' do
|
|
64
|
+
expect(subject.available_countries).to be_a(Enumerable)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'includes the "global" country' do
|
|
68
|
+
expect(subject.available_countries).to include('global')
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
describe '.available_dates' do
|
|
73
|
+
let(:response) do
|
|
74
|
+
%w(latest 2013-12-08 2013-12-01 2013-11-24 2013-11-17 2013-11-10 2013-11-03 2013-10-27
|
|
75
|
+
2013-10-20 2013-10-13 2013-10-06 2013-09-29 2013-09-22 2013-09-15 2013-09-08 2013-09-01
|
|
76
|
+
2013-08-25 2013-08-18 2013-08-11 2013-08-04 2013-07-28 2013-07-21 2013-07-14 2013-07-07
|
|
77
|
+
2013-06-30 2013-06-23 2013-06-16 2013-06-09 2013-06-02 2013-05-26 2013-05-19 2013-05-12
|
|
78
|
+
2013-05-05 2013-04-28)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
before do
|
|
82
|
+
allow_any_instance_of(Spotify::Charts::Client).to receive(:request)
|
|
83
|
+
.with('/most_viral/global/weekly/') { response }
|
|
84
|
+
end
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
it 'lists available dates' do
|
|
87
|
+
expect(subject.available_dates('global', 'weekly')).to be_a(Enumerable)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'includes the "latest" date' do
|
|
91
|
+
expect(subject.available_dates('global', 'weekly')).to include('latest')
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
describe '.most_viral' do
|
|
96
|
+
subject { described_class.most_viral('global', 'weekly', 'latest') }
|
|
97
|
+
|
|
98
|
+
let(:response) do
|
|
99
|
+
{
|
|
100
|
+
'tracks' => [
|
|
101
|
+
{
|
|
102
|
+
'date' => '2013-12-15',
|
|
103
|
+
'country' => 'global',
|
|
104
|
+
'track_url' => 'https://play.spotify.com/track/7DyuZtvlGT0z5Xz8peiLN7',
|
|
105
|
+
'track_name' => 'I See Fire',
|
|
106
|
+
'artist_name' => 'Howard Shore',
|
|
107
|
+
'artist_url' => 'https://play.spotify.com/artist/6eUKZXaKkcviH0Ku9w2n3V',
|
|
108
|
+
'album_name' => 'The Hobbit: The Desolation of Smaug (Original Motion Picture Soundtrack)',
|
|
109
|
+
'album_url' => 'https://play.spotify.com/album/5kqgALc3cz9P3VclmSmHfr',
|
|
110
|
+
'artwork_url' => 'http://o.scdn.co/300/be7d523ea35aeb10f561712420d3429f0ec68eec',
|
|
111
|
+
'num_streams' => 515608
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
'date' => '2013-12-15',
|
|
115
|
+
'country' => 'global',
|
|
116
|
+
'track_url' => 'https://play.spotify.com/track/44GgIVlmRsD1qMWONOWOS3',
|
|
117
|
+
'track_name' => 'Waiting Game',
|
|
118
|
+
'artist_name' => 'BANKS',
|
|
119
|
+
'artist_url' => 'https://play.spotify.com/artist/2xe8IXgCTpwHE3eA9hTs4n',
|
|
120
|
+
'album_name' => 'LONDON',
|
|
121
|
+
'album_url' => 'https://play.spotify.com/album/4xG1FKMIQPGYRujVBtMAqm',
|
|
122
|
+
'artwork_url' => 'http://o.scdn.co/300/4027ebaa3c0ff4161020cb37a546f25929249166',
|
|
123
|
+
'num_streams' => 182325
|
|
124
|
+
}
|
|
125
|
+
]
|
|
90
126
|
}
|
|
127
|
+
end
|
|
91
128
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
129
|
+
let(:tracks) do
|
|
130
|
+
response['tracks'].inject([]) do |tracks, item|
|
|
131
|
+
tracks << Spotify::Charts::TrackParser.new(item).track
|
|
95
132
|
end
|
|
133
|
+
end
|
|
96
134
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
end
|
|
135
|
+
before do
|
|
136
|
+
allow_any_instance_of(Spotify::Charts::Client).to receive(:request)
|
|
137
|
+
.with('/most_viral/global/weekly/latest') { response }
|
|
138
|
+
end
|
|
102
139
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
end
|
|
140
|
+
it 'returns a list of tracks' do
|
|
141
|
+
subject.each do |track|
|
|
142
|
+
expect(track).to be_a(Spotify::Charts::Track)
|
|
107
143
|
end
|
|
108
144
|
end
|
|
109
145
|
|
|
110
|
-
|
|
111
|
-
subject
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{
|
|
117
|
-
'date' => '2013-12-15',
|
|
118
|
-
'country' => 'global',
|
|
119
|
-
'track_url' => 'https://play.spotify.com/track/7DyuZtvlGT0z5Xz8peiLN7',
|
|
120
|
-
'track_name' => 'I See Fire',
|
|
121
|
-
'artist_name' => 'Howard Shore',
|
|
122
|
-
'artist_url' => 'https://play.spotify.com/artist/6eUKZXaKkcviH0Ku9w2n3V',
|
|
123
|
-
'album_name' => 'The Hobbit: The Desolation of Smaug (Original Motion Picture Soundtrack)',
|
|
124
|
-
'album_url' => 'https://play.spotify.com/album/5kqgALc3cz9P3VclmSmHfr',
|
|
125
|
-
'artwork_url' => 'http://o.scdn.co/300/be7d523ea35aeb10f561712420d3429f0ec68eec',
|
|
126
|
-
'num_streams' => 515608
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
'date' => '2013-12-15',
|
|
130
|
-
'country' => 'global',
|
|
131
|
-
'track_url' => 'https://play.spotify.com/track/44GgIVlmRsD1qMWONOWOS3',
|
|
132
|
-
'track_name' => 'Waiting Game',
|
|
133
|
-
'artist_name' => 'BANKS',
|
|
134
|
-
'artist_url' => 'https://play.spotify.com/artist/2xe8IXgCTpwHE3eA9hTs4n',
|
|
135
|
-
'album_name' => 'LONDON',
|
|
136
|
-
'album_url' => 'https://play.spotify.com/album/4xG1FKMIQPGYRujVBtMAqm',
|
|
137
|
-
'artwork_url' => 'http://o.scdn.co/300/4027ebaa3c0ff4161020cb37a546f25929249166',
|
|
138
|
-
'num_streams' => 182325
|
|
139
|
-
}
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
}
|
|
146
|
+
it 'tracks correspond to webservice response' do
|
|
147
|
+
subject.each_with_index do |track, index|
|
|
148
|
+
expect(track).to eq(tracks[index])
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
143
152
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
153
|
+
describe '.most_streamed' do
|
|
154
|
+
subject { described_class.most_streamed('global', 'weekly', 'latest') }
|
|
155
|
+
|
|
156
|
+
let(:response) do
|
|
157
|
+
{
|
|
158
|
+
'tracks' => [
|
|
159
|
+
{
|
|
160
|
+
'date' => '2013-12-15',
|
|
161
|
+
'country' => 'global',
|
|
162
|
+
'track_url' => 'https://play.spotify.com/track/7DyuZtvlGT0z5Xz8peiLN7',
|
|
163
|
+
'track_name' => 'I See Fire',
|
|
164
|
+
'artist_name' => 'Howard Shore',
|
|
165
|
+
'artist_url' => 'https://play.spotify.com/artist/6eUKZXaKkcviH0Ku9w2n3V',
|
|
166
|
+
'album_name' => 'The Hobbit: The Desolation of Smaug (Original Motion Picture Soundtrack)',
|
|
167
|
+
'album_url' => 'https://play.spotify.com/album/5kqgALc3cz9P3VclmSmHfr',
|
|
168
|
+
'artwork_url' => 'http://o.scdn.co/300/be7d523ea35aeb10f561712420d3429f0ec68eec',
|
|
169
|
+
'num_streams' => 515608
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
'date' => '2013-12-15',
|
|
173
|
+
'country' => 'global',
|
|
174
|
+
'track_url' => 'https://play.spotify.com/track/44GgIVlmRsD1qMWONOWOS3',
|
|
175
|
+
'track_name' => 'Waiting Game',
|
|
176
|
+
'artist_name' => 'BANKS',
|
|
177
|
+
'artist_url' => 'https://play.spotify.com/artist/2xe8IXgCTpwHE3eA9hTs4n',
|
|
178
|
+
'album_name' => 'LONDON',
|
|
179
|
+
'album_url' => 'https://play.spotify.com/album/4xG1FKMIQPGYRujVBtMAqm',
|
|
180
|
+
'artwork_url' => 'http://o.scdn.co/300/4027ebaa3c0ff4161020cb37a546f25929249166',
|
|
181
|
+
'num_streams' => 182325
|
|
182
|
+
}
|
|
183
|
+
]
|
|
148
184
|
}
|
|
185
|
+
end
|
|
149
186
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
187
|
+
let(:tracks) do
|
|
188
|
+
response['tracks'].inject([]) do |tracks, item|
|
|
189
|
+
tracks << Spotify::Charts::TrackParser.new(item).track
|
|
153
190
|
end
|
|
191
|
+
end
|
|
154
192
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
193
|
+
before do
|
|
194
|
+
allow_any_instance_of(Spotify::Charts::Client).to receive(:request)
|
|
195
|
+
.with('/most_streamed/global/weekly/latest') { response }
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
it 'returns a list of tracks' do
|
|
199
|
+
subject.each do |track|
|
|
200
|
+
expect(track).to be_a(Spotify::Charts::Track)
|
|
159
201
|
end
|
|
202
|
+
end
|
|
160
203
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
end
|
|
204
|
+
it 'tracks correspond to webservice response' do
|
|
205
|
+
subject.each_with_index do |track, index|
|
|
206
|
+
expect(track).to eq(tracks[index])
|
|
165
207
|
end
|
|
166
208
|
end
|
|
167
209
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,11 +1,96 @@
|
|
|
1
1
|
require 'simplecov'
|
|
2
2
|
SimpleCov.start
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
5
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
6
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
7
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
|
8
|
+
# files.
|
|
9
|
+
#
|
|
10
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
|
11
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
12
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
13
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
|
14
|
+
# a separate helper file that requires the additional dependencies and performs
|
|
15
|
+
# the additional setup, and require it from the spec files that actually need
|
|
16
|
+
# it.
|
|
17
|
+
#
|
|
18
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
|
19
|
+
# users commonly want.
|
|
20
|
+
#
|
|
21
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
6
22
|
RSpec.configure do |config|
|
|
7
|
-
config.
|
|
8
|
-
|
|
23
|
+
# rspec-expectations config goes here. You can use an alternate
|
|
24
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
25
|
+
# assertions if you prefer.
|
|
26
|
+
config.expect_with :rspec do |expectations|
|
|
27
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
28
|
+
# and `failure_message` of custom matchers include text for helper methods
|
|
29
|
+
# defined using `chain`, e.g.:
|
|
30
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
|
31
|
+
# # => "be bigger than 2 and smaller than 4"
|
|
32
|
+
# ...rather than:
|
|
33
|
+
# # => "be bigger than 2"
|
|
34
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
|
38
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
39
|
+
config.mock_with :rspec do |mocks|
|
|
40
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
|
41
|
+
# a real object. This is generally recommended, and will default to
|
|
42
|
+
# `true` in RSpec 4.
|
|
43
|
+
mocks.verify_partial_doubles = true
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# These two settings work together to allow you to limit a spec run
|
|
47
|
+
# to individual examples or groups you care about by tagging them with
|
|
48
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
|
49
|
+
# get run.
|
|
9
50
|
config.filter_run :focus
|
|
10
|
-
config.
|
|
51
|
+
config.run_all_when_everything_filtered = true
|
|
52
|
+
|
|
53
|
+
# Allows RSpec to persist some state between runs in order to support
|
|
54
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
55
|
+
# you configure your source control system to ignore this file.
|
|
56
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
|
57
|
+
|
|
58
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
|
59
|
+
# recommended. For more details, see:
|
|
60
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
|
61
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
62
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
|
63
|
+
config.disable_monkey_patching!
|
|
64
|
+
|
|
65
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
|
66
|
+
# be too noisy due to issues in dependencies.
|
|
67
|
+
config.warnings = true
|
|
68
|
+
|
|
69
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
|
70
|
+
# file, and it's useful to allow more verbose output when running an
|
|
71
|
+
# individual spec file.
|
|
72
|
+
if config.files_to_run.one?
|
|
73
|
+
# Use the documentation formatter for detailed output,
|
|
74
|
+
# unless a formatter has already been configured
|
|
75
|
+
# (e.g. via a command-line flag).
|
|
76
|
+
config.default_formatter = 'doc'
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Print the 10 slowest examples and example groups at the
|
|
80
|
+
# end of the spec run, to help surface which specs are running
|
|
81
|
+
# particularly slow.
|
|
82
|
+
config.profile_examples = 10
|
|
83
|
+
|
|
84
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
85
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
86
|
+
# the seed, which is printed after each run.
|
|
87
|
+
# --seed 1234
|
|
88
|
+
config.order = :random
|
|
89
|
+
|
|
90
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
|
91
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
92
|
+
# test failures related to randomization by passing the same `--seed` value
|
|
93
|
+
# as the one that triggered the failure.
|
|
94
|
+
Kernel.srand config.seed
|
|
11
95
|
end
|
|
96
|
+
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spotify-charts
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Falk Koeppe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-10-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -101,6 +101,7 @@ executables: []
|
|
|
101
101
|
extensions: []
|
|
102
102
|
extra_rdoc_files: []
|
|
103
103
|
files:
|
|
104
|
+
- CHANGELOG.md
|
|
104
105
|
- LICENSE
|
|
105
106
|
- README.md
|
|
106
107
|
- lib/spotify/charts.rb
|
|
@@ -108,6 +109,7 @@ files:
|
|
|
108
109
|
- lib/spotify/charts/track.rb
|
|
109
110
|
- lib/spotify/charts/track_parser.rb
|
|
110
111
|
- lib/spotify/charts/version.rb
|
|
112
|
+
- spec/examples.txt
|
|
111
113
|
- spec/lib/spotify/charts/client_spec.rb
|
|
112
114
|
- spec/lib/spotify/charts/track_parser_spec.rb
|
|
113
115
|
- spec/lib/spotify/charts/track_spec.rb
|
|
@@ -133,11 +135,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
133
135
|
version: '0'
|
|
134
136
|
requirements: []
|
|
135
137
|
rubyforge_project:
|
|
136
|
-
rubygems_version: 2.
|
|
138
|
+
rubygems_version: 2.4.5.1
|
|
137
139
|
signing_key:
|
|
138
140
|
specification_version: 4
|
|
139
141
|
summary: Ruby wrapper for the Spotify Charts API
|
|
140
142
|
test_files:
|
|
143
|
+
- spec/examples.txt
|
|
141
144
|
- spec/lib/spotify/charts/client_spec.rb
|
|
142
145
|
- spec/lib/spotify/charts/track_parser_spec.rb
|
|
143
146
|
- spec/lib/spotify/charts/track_spec.rb
|