decibel_wrapper 0.0.4 → 0.0.5
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 +8 -8
- data/lib/decibel_wrapper/version.rb +1 -1
- data/lib/wrapper/resources/album.rb +10 -1
- data/lib/wrapper/resources/participant.rb +15 -2
- data/lib/wrapper/resources/recording.rb +1 -1
- data/spec/spec_helper.rb +5 -1
- data/spec/wrapper/album_spec.rb +27 -22
- data/spec/wrapper/participant_spec.rb +9 -4
- data/spec/wrapper/recording_participation_spec.rb +1 -2
- data/spec/wrapper/recording_spec.rb +5 -1
- data/spec/wrapper/wrapper_spec.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWNkMDBlYWZmMzc3Y2U2OWZhZWM2Nzc2Yzc3MTczYjFhMzQ1YWIyYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmU4MGJlOWJlMzQ2YzkwMGQzNGUzYjJhZDNjNzc5ZWZhYmJmZTRlMQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjFiNWEyMmE4ZmRhMWQ0Y2IwYzYyOTI4MjQ2NjI5M2E0NWIxOWE1ZjNmMGQz
|
10
|
+
ODg3MjI2ZjQ0YjdkZTgzZWVmYzdhYjc2M2RjMmUzNTg4NWVkZTdhY2U1MWFm
|
11
|
+
NTIwYzZhNmY4NTg1ZmMxODIwMDM0ZTA1MTQ1NjViMTI3MzFkNDQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjdhNDc1MjAxMjBjYmQwOTg4YjMxODg4ZDI0ODUyMGYzMzIwZjVjNDcwM2Vm
|
14
|
+
NGJhMjBmNjBiYjE4NDEyNTg5MTljODk5M2I3ZDk3ZjhlYzE2OTUyNzhmMGZm
|
15
|
+
OWNjNWY0Njg1NjhlNDg3MWEyMjQ5M2JkMTg1NWE0MjYwNDQyMjc=
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Decibel::Album
|
2
2
|
|
3
|
-
attr_accessor :Title, :FeaturedArtistString, :IsUnofficial, :Identifiers, :Genres, :Tracks
|
3
|
+
attr_accessor :Id, :Title, :FeaturedArtistString, :FeaturedArtists, :IsUnofficial, :Identifiers, :Genres, :Tracks
|
4
4
|
|
5
5
|
def initialize args
|
6
6
|
args.each do |k, v|
|
@@ -11,6 +11,7 @@ class Decibel::Album
|
|
11
11
|
|
12
12
|
def child_initializers
|
13
13
|
self.identifiers_initialize if self.Identifiers
|
14
|
+
self.featured_artists_initialize if self.FeaturedArtists
|
14
15
|
self.genres_initialize if self.Genres
|
15
16
|
self.tracks_initialize if self.Tracks
|
16
17
|
end
|
@@ -23,6 +24,14 @@ class Decibel::Album
|
|
23
24
|
self.Identifiers = array
|
24
25
|
end
|
25
26
|
|
27
|
+
def featured_artists_initialize
|
28
|
+
array = []
|
29
|
+
self.FeaturedArtists.each do |a|
|
30
|
+
array << Decibel::FeaturedArtist.new(a)
|
31
|
+
end
|
32
|
+
self.FeaturedArtists = array
|
33
|
+
end
|
34
|
+
|
26
35
|
def genres_initialize
|
27
36
|
array = []
|
28
37
|
self.Genres.each do |i|
|
@@ -1,12 +1,17 @@
|
|
1
1
|
class Decibel::Participant
|
2
2
|
|
3
|
-
attr_accessor :Id, :Name, :StageName, :Identifiers, :
|
3
|
+
attr_accessor :Id, :Name, :StageName, :Identifiers, :Annotations, :Members
|
4
4
|
|
5
5
|
def initialize args
|
6
6
|
args.each do |k, v|
|
7
7
|
instance_variable_set("@#{k}", v) unless v.nil?
|
8
8
|
end
|
9
|
-
self.
|
9
|
+
self.child_initializers
|
10
|
+
end
|
11
|
+
|
12
|
+
def child_initializers
|
13
|
+
self.members_initialize if self.Members
|
14
|
+
self.annotations_initialize if self.Annotations
|
10
15
|
end
|
11
16
|
|
12
17
|
def members_initialize
|
@@ -17,4 +22,12 @@ class Decibel::Participant
|
|
17
22
|
self.Members = array
|
18
23
|
end
|
19
24
|
|
25
|
+
def annotations_initialize
|
26
|
+
array = []
|
27
|
+
self.Annotations.each do |m|
|
28
|
+
array << m[:Text]
|
29
|
+
end
|
30
|
+
self.Annotations = array
|
31
|
+
end
|
32
|
+
|
20
33
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Decibel::Recording
|
2
2
|
|
3
|
-
attr_accessor :Id, :Title, :FeaturedArtistString, :Duration, :FeaturedArtists, :Genres, :Participations, :Authors
|
3
|
+
attr_accessor :Id, :AlbumSequence, :Title, :FeaturedArtistString, :Duration, :FeaturedArtists, :Genres, :Participations, :Authors
|
4
4
|
|
5
5
|
def initialize args
|
6
6
|
args.each do |k, v|
|
data/spec/spec_helper.rb
CHANGED
@@ -16,4 +16,8 @@ RSpec.configure do |config|
|
|
16
16
|
config.order = 'random'
|
17
17
|
end
|
18
18
|
|
19
|
-
require 'decibel_wrapper'
|
19
|
+
require 'decibel_wrapper'
|
20
|
+
|
21
|
+
YOUR_DECIBEL_APP_ID = ""
|
22
|
+
YOUR_DECIBEL_APP_KEY = ""
|
23
|
+
$wrapper = Decibel::Wrapper.new(:decibel_app_id => YOUR_DECIBEL_APP_ID, :decibel_app_key => YOUR_DECIBEL_APP_KEY)
|
data/spec/wrapper/album_spec.rb
CHANGED
@@ -2,40 +2,45 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Decibel::Album do
|
4
4
|
|
5
|
-
let(:wrapper) {
|
5
|
+
let(:wrapper) { $wrapper }
|
6
6
|
let(:decibal_album) { wrapper.album(:id => 'cd94ce57-533a-e311-be6d-ac220b82800d') }
|
7
|
-
let(:album) { Decibel::Album.new(:Id => 'cd94ce57-533a-e311-be6d-ac220b82800d', :Identifiers => [{:IdentifierType => "A type", :Value => "1234"}], :Genres => [{:Name => "House"}, {:Name => "Electro"}]) }
|
7
|
+
let(:album) { Decibel::Album.new(:Id => 'cd94ce57-533a-e311-be6d-ac220b82800d', :Identifiers => [{:IdentifierType => "A type", :Value => "1234"}], :Genres => [{:Name => "House"}, {:Name => "Electro"}], :FeaturedArtists => [{:Id => "6e862d4e-8476-11e3-be7e-ac220b82800d", :LiteralName => "The Rolling Stones" }, {:Id => "6e862d4e-8476-11e3-be7e-ac220b82800d", :LiteralName => "The Rolling Stones" }], :Tracks => [{:Id => "6e862d28-8476-11e3-be7e-ac220b82800d", :Title => "Brown Sugar"}, {:Id => "6e862d50-8476-11e3-be7e-ac220b82800d", :Title => "Sway"}]) }
|
8
8
|
subject { album }
|
9
9
|
|
10
|
+
it { should respond_to(:Id) }
|
10
11
|
it { should respond_to(:Title) }
|
11
12
|
it { should respond_to(:FeaturedArtistString) }
|
13
|
+
it { should respond_to(:FeaturedArtists) }
|
12
14
|
it { should respond_to(:IsUnofficial) }
|
13
15
|
it { should respond_to(:Identifiers) }
|
14
16
|
it { should respond_to(:Genres) }
|
15
17
|
it { should respond_to(:Tracks) }
|
16
18
|
|
17
|
-
describe "identifiers_initialize" do
|
18
|
-
before { album.identifiers_initialize }
|
19
|
-
it "should set initializers to an array" do
|
20
|
-
album.Identifiers.should be_an_instance_of Array
|
21
|
-
end
|
22
|
-
it "should set initializers to an array of Decibel::Identifier s" do
|
23
|
-
album.Identifiers[0].should be_an_instance_of Decibel::Identifier
|
24
|
-
end
|
25
|
-
end
|
26
19
|
|
27
|
-
|
28
|
-
|
29
|
-
it "should set genres to an array" do
|
30
|
-
album.Genres.should be_an_instance_of Array
|
31
|
-
end
|
32
|
-
it "should set genres to an array of Decibel::Genre s" do
|
33
|
-
album.Genres[0].should be_an_instance_of Decibel::Genre
|
34
|
-
end
|
20
|
+
it "should set initializers to an array" do
|
21
|
+
album.Identifiers.should be_an_instance_of Array
|
35
22
|
end
|
36
|
-
|
37
|
-
|
38
|
-
|
23
|
+
it "should set initializers to an array of Decibel::Identifier s" do
|
24
|
+
album.Identifiers[0].should be_an_instance_of Decibel::Identifier
|
25
|
+
end
|
26
|
+
it "should set featured artists to an array" do
|
27
|
+
album.FeaturedArtists.should be_an_instance_of Array
|
28
|
+
end
|
29
|
+
it "should set featured artists to an array of Decibel::FeaturedArtists" do
|
30
|
+
album.FeaturedArtists[0].should be_an_instance_of Decibel::FeaturedArtist
|
39
31
|
end
|
32
|
+
it "should set genres to an array" do
|
33
|
+
album.Genres.should be_an_instance_of Array
|
34
|
+
end
|
35
|
+
it "should set genres to an array of Decibel::Genres" do
|
36
|
+
album.Genres[0].should be_an_instance_of Decibel::Genre
|
37
|
+
end
|
38
|
+
it "should set tracks to an array" do
|
39
|
+
album.Tracks.should be_an_instance_of Array
|
40
|
+
end
|
41
|
+
it "should set tracks to an array of Decibel::Recordings" do
|
42
|
+
album.Tracks[0].should be_an_instance_of Decibel::Recording
|
43
|
+
end
|
44
|
+
|
40
45
|
|
41
46
|
end
|
@@ -2,17 +2,16 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Decibel::Participant do
|
4
4
|
|
5
|
-
let(:wrapper) {
|
5
|
+
let(:wrapper) { $wrapper }
|
6
6
|
let(:decibal_participant) { wrapper.participant(:id => '5e9c115a-7e00-11e3-be7b-ac220b82800d') }
|
7
|
-
let(:participant) { Decibel::Participant.new(:Id => "1fe03321-463a-e311-be6d-ac220b82800d", :Name => "The Rolling Stones", :StageName => "The Rolling Stones", :Members => [:Id => "1fe03321-463a-e311-be6d-ac220b82800d", :Name => "The Rolling Stones", :StageName => "The Rolling Stones", :Identifiers => [{:IdentifierType => "DiscogsName", :Value => "Rolling Stones, The"}, {:IdentifierType => "DiscogsID", :Value => "a20991"}]], :Identifiers => [{:IdentifierType => "DiscogsName", :Value => "Rolling Stones, The"}, {:IdentifierType => "DiscogsID", :Value => "a20991"}], :ParticipantType => 1) }
|
7
|
+
let(:participant) { Decibel::Participant.new(:Id => "1fe03321-463a-e311-be6d-ac220b82800d", :Name => "The Rolling Stones", :StageName => "The Rolling Stones", :Members => [:Id => "1fe03321-463a-e311-be6d-ac220b82800d", :Name => "The Rolling Stones", :StageName => "The Rolling Stones", :Identifiers => [{:IdentifierType => "DiscogsName", :Value => "Rolling Stones, The"}, {:IdentifierType => "DiscogsID", :Value => "a20991"}]], :Identifiers => [{:IdentifierType => "DiscogsName", :Value => "Rolling Stones, The"}, {:IdentifierType => "DiscogsID", :Value => "a20991"}], :Annotations => [{:Text => "Annotation 1"}, {:Text => "Annotation 2"}], :ParticipantType => 1) }
|
8
8
|
subject { participant }
|
9
9
|
|
10
10
|
it { should respond_to(:Id) }
|
11
11
|
it { should respond_to(:Name) }
|
12
12
|
it { should respond_to(:StageName) }
|
13
13
|
it { should respond_to(:Identifiers) }
|
14
|
-
it { should respond_to(:
|
15
|
-
it { should respond_to(:BiographySnippet) }
|
14
|
+
it { should respond_to(:Annotations) }
|
16
15
|
it { should respond_to(:Members) }
|
17
16
|
|
18
17
|
it "should set Members to an array" do
|
@@ -21,5 +20,11 @@ describe Decibel::Participant do
|
|
21
20
|
it "should set Members to an array of Decibel::Participants" do
|
22
21
|
participant.Members[0].should be_an_instance_of Decibel::Participant
|
23
22
|
end
|
23
|
+
it "should set Members to an array" do
|
24
|
+
participant.Annotations.should be_an_instance_of Array
|
25
|
+
end
|
26
|
+
it "should set Members to an array of String" do
|
27
|
+
participant.Annotations[0].should be_an_instance_of String
|
28
|
+
end
|
24
29
|
|
25
30
|
end
|
@@ -2,8 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Decibel::Participation do
|
4
4
|
|
5
|
-
let(:wrapper) {
|
6
|
-
#let(:decibal_participant) { wrapper.recording(:id => '5e9c115a-7e00-11e3-be7b-ac220b82800d') }
|
5
|
+
let(:wrapper) { $wrapper }
|
7
6
|
let(:participation) { Decibel::Participation.new(:LiteralMainIdentities => "Chad Smith", :MainIdentities => [{:Id => "f8d2a321-463a-e311-be6d-ac220b82800d", :LiteralName => "Chad Smith"}], :LiteralActivity => "Drums", :Activities => [{:Name => "Drums"}]) }
|
8
7
|
subject { participation }
|
9
8
|
|
@@ -2,17 +2,21 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Decibel::Recording do
|
4
4
|
|
5
|
-
let(:wrapper) {
|
5
|
+
let(:wrapper) { $wrapper }
|
6
6
|
let(:decibal_recording) { wrapper.recording(:id => '5e9c115a-7e00-11e3-be7b-ac220b82800d') }
|
7
7
|
let(:recording) { Decibel::Recording.new(:Id => '5e9c115a-7e00-11e3-be7b-ac220b82800d', :Title => "Zephyr Song", :Genres => [{:Name => "House"}, {:Name => "Electro"}], :Duration => 232.0, :FeaturedArtists => [{:Id => "efcd42f6-7dff-11e3-be7b-ac220b82800d", :LiteralName => "Red Hot Chili Peppers"}], :Participations => [{:LiteralMainIdentities => "Chad Smith", :MainIdentities => [{:Id => "f8d2a321-463a-e311-be6d-ac220b82800d", :LiteralName => "Chad Smith"}], :LiteralActivity => "Drums", :Activities => [{:Name => "Drums"}]}], :Authors => [{:LiteralMainIdentities => "John Frusciante", :MainIdentities => [{:Id => "03d85421-463a-e311-be6d-ac220b82800d", :LiteralName => "John Frusciante"}], :LiteralActivity => "Written-By", :Activities => [{:Name => "Written By"}]}]) }
|
8
8
|
let(:blank_recording) { Decibel::Recording.new(:Id => "") }
|
9
9
|
subject { recording }
|
10
10
|
|
11
11
|
it { should respond_to(:Id) }
|
12
|
+
it { should respond_to(:AlbumSequence) }
|
12
13
|
it { should respond_to(:Title) }
|
13
14
|
it { should respond_to(:FeaturedArtistString) }
|
14
15
|
it { should respond_to(:Duration) }
|
15
16
|
it { should respond_to(:FeaturedArtists) }
|
17
|
+
it { should respond_to(:Genres) }
|
18
|
+
it { should respond_to(:Participations) }
|
19
|
+
it { should respond_to(:Authors) }
|
16
20
|
|
17
21
|
it "should set FeaturedArtists to an array" do
|
18
22
|
recording.FeaturedArtists.should be_an_instance_of Array
|
@@ -2,9 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Decibel::Wrapper do
|
4
4
|
|
5
|
-
let(:wrapper) {
|
5
|
+
let(:wrapper) { $wrapper }
|
6
6
|
let(:test_query) { "albums/?title=the%20fame%20monster&depth=Tracks;TrackAuthors" }
|
7
7
|
let(:album_query) { "album/?id=cd94ce57-533a-e311-be6d-ac220b82800d" }
|
8
|
+
subject { wrapper }
|
9
|
+
|
10
|
+
it { should respond_to(:decibel_app_id) }
|
11
|
+
it { should respond_to(:decibel_app_key) }
|
8
12
|
|
9
13
|
# Album
|
10
14
|
describe "album" do
|