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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82ef9a0c07145dbd999b978246356b8f1a78f7c9
4
- data.tar.gz: e8f1bd32e24512eb536ad4c84ea471a199db4e12
3
+ metadata.gz: 2f528437e6e50e4483a18c4829eb0a4f61147e2e
4
+ data.tar.gz: e55713c61dd178e57f9db63ea57b1884b6d07e98
5
5
  SHA512:
6
- metadata.gz: c85dc75870a0af17d63cbf686575fccfa356c520053e604f8a80efafbbece5c4b4183e22a40d6937b36bec0f2a92f5a762713e35ce08005eb9378375bb06a8a4
7
- data.tar.gz: 09b713c00e04417542efc12a4afa07428cdb7732f61fb02a36636e72b9da1aaa4eef19f3138b5f519004bd4896013bef3ce698fad1f9c2a42ae57e8470587a76
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).each_with_object([]) do |object_params, collection|
11
- collection << target_class.new(object_params.with_indifferent_access)
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
 
@@ -3,7 +3,7 @@ module Dirble
3
3
  attr_accessor :id, :image_url, :name, :title, :spotify_url, :played_on, :raw
4
4
 
5
5
  def info
6
- Hash(raw.fetch('info'))
6
+ raw.fetch('info') || {}
7
7
  end
8
8
 
9
9
  def fetch_id
@@ -1,3 +1,3 @@
1
1
  module Dirble
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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
@@ -23,8 +23,10 @@ describe Dirble::Station do
23
23
  end
24
24
 
25
25
  context 'station with details' do
26
- it 'gets individual station' do
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.2
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