dirble 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dirble/simple_api_model.rb +2 -2
- data/lib/dirble/song.rb +1 -1
- data/lib/dirble/version.rb +1 -1
- data/spec/song_spec.rb +26 -0
- data/spec/station_spec.rb +3 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f528437e6e50e4483a18c4829eb0a4f61147e2e
|
4
|
+
data.tar.gz: e55713c61dd178e57f9db63ea57b1884b6d07e98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3d3a35cb2565c8250ab0614d64b9a605698649bdc3ceaf3fc7fb944d447258057d162c723b39f783187e95b4cf7906187f76e63c9e07f4a18ec51e8ad6232c7
|
7
|
+
data.tar.gz: 3217402795cdaa211706313e807f06ce81523d2eb4e2562fa3bce7f6daf4bea606cbf698e02e54e67d2db61925bb05b3825823bd5c27ade8c5ee54c51f70fd1e
|
@@ -7,8 +7,8 @@ module Dirble
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def build_from_api_response(target_class, response)
|
10
|
-
parsed_collection(response).
|
11
|
-
|
10
|
+
parsed_collection(response).map do |object_params|
|
11
|
+
target_class.new(object_params.with_indifferent_access)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
data/lib/dirble/song.rb
CHANGED
data/lib/dirble/version.rb
CHANGED
data/spec/song_spec.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Dirble::Song do
|
4
|
+
let!(:station) { Dirble::Station.find(100) }
|
5
|
+
let!(:song) { station.song_history.first }
|
6
|
+
|
7
|
+
it 'has name' do
|
8
|
+
expect(song.name).to eq('Blackfoot')
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'has title' do
|
12
|
+
expect(song.title).to eq('Run and Hide')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'has spotify url' do
|
16
|
+
expect(song.spotify_url).to eq('spotify:track:3JLeD2XmrU6jowD14OTw85')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'has raw info' do
|
20
|
+
expect(song.raw).to_not be_empty
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'has played on information, when' do
|
24
|
+
expect(song.played_on).to be_instance_of(Time)
|
25
|
+
end
|
26
|
+
end
|
data/spec/station_spec.rb
CHANGED
@@ -23,8 +23,10 @@ describe Dirble::Station do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'station with details' do
|
26
|
-
|
26
|
+
let!(:station) { Dirble::Station.find(100) }
|
27
27
|
|
28
|
+
it 'gets individual station with detailed info' do
|
29
|
+
expect([station.bitrate, station.website, station.id]).to eq(['128', 'http://radio252.fm', '11717'])
|
28
30
|
end
|
29
31
|
|
30
32
|
it 'owns song history' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dirble
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Przemek Mroczek
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- spec/connection_spec.rb
|
225
225
|
- spec/dirble_spec.rb
|
226
226
|
- spec/primary_category_spec.rb
|
227
|
+
- spec/song_spec.rb
|
227
228
|
- spec/spec_helper.rb
|
228
229
|
- spec/station_spec.rb
|
229
230
|
- spec/support/fake_dirble_api.rb
|
@@ -266,6 +267,7 @@ test_files:
|
|
266
267
|
- spec/connection_spec.rb
|
267
268
|
- spec/dirble_spec.rb
|
268
269
|
- spec/primary_category_spec.rb
|
270
|
+
- spec/song_spec.rb
|
269
271
|
- spec/spec_helper.rb
|
270
272
|
- spec/station_spec.rb
|
271
273
|
- spec/support/fake_dirble_api.rb
|