musicgraph 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -0
- data/lib/musicgraph.rb +4 -0
- data/lib/musicgraph/album.rb +66 -0
- data/lib/musicgraph/artist.rb +2 -6
- data/lib/musicgraph/version.rb +1 -1
- data/spec/cassettes/album.yml +2738 -0
- data/spec/cassettes/artist.yml +129 -0
- data/spec/musicgraph/album_spec.rb +240 -0
- data/spec/musicgraph/artist_spec.rb +20 -20
- data/spec/spec_helper.rb +3 -3
- metadata +5 -3
data/spec/cassettes/artist.yml
CHANGED
@@ -2859,4 +2859,133 @@ http_interactions:
|
|
2859
2859
|
{"id": "e4de0d41-a6b5-11e0-b446-00251188dd67", "name": "Beck"}}'
|
2860
2860
|
http_version:
|
2861
2861
|
recorded_at: Sun, 22 Feb 2015 21:12:33 GMT
|
2862
|
+
- request:
|
2863
|
+
method: get
|
2864
|
+
uri: http://api.musicgraph.com/api/v2/album/suggest?api_key=<API_KEY>&prefix=Emotion
|
2865
|
+
body:
|
2866
|
+
encoding: US-ASCII
|
2867
|
+
string: ''
|
2868
|
+
headers:
|
2869
|
+
User-Agent:
|
2870
|
+
- Faraday v0.9.1
|
2871
|
+
Accept-Encoding:
|
2872
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
2873
|
+
Accept:
|
2874
|
+
- "*/*"
|
2875
|
+
response:
|
2876
|
+
status:
|
2877
|
+
code: 200
|
2878
|
+
message: OK
|
2879
|
+
headers:
|
2880
|
+
Access-Control-Allow-Headers:
|
2881
|
+
- accept, origin, content-type, x-requested-with, x-requested-by
|
2882
|
+
Access-Control-Allow-Methods:
|
2883
|
+
- GET, POST, PUT, DELETE, OPTIONS
|
2884
|
+
Access-Control-Allow-Origin:
|
2885
|
+
- "*"
|
2886
|
+
Content-Type:
|
2887
|
+
- application/json; charset=UTF-8
|
2888
|
+
Date:
|
2889
|
+
- Sun, 12 Apr 2015 22:06:59 GMT
|
2890
|
+
Server:
|
2891
|
+
- nginx/1.5.11
|
2892
|
+
X-App-Box:
|
2893
|
+
- prod.v3.1d.api.musicgraph.com
|
2894
|
+
X-Branch:
|
2895
|
+
- 0bb18cbb3d226d8f0d560fb2ca551a5fe504e506
|
2896
|
+
X-Environment:
|
2897
|
+
- prod
|
2898
|
+
Content-Length:
|
2899
|
+
- '7015'
|
2900
|
+
Connection:
|
2901
|
+
- keep-alive
|
2902
|
+
body:
|
2903
|
+
encoding: UTF-8
|
2904
|
+
string: '{"status": {"api": "v2", "message": "Success", "code": 0}, "pagination":
|
2905
|
+
{"count": 20, "offset": 1}, "data": [{"artist_name": "Mariah Carey", "name":
|
2906
|
+
"Emotions", "entity_type": "album", "album_artist_id": "b9fae655-9741-b873-9cd0-834c2a9c3e34",
|
2907
|
+
"main_genre": "pop", "album_ref_id": "1449939", "performer_name": "Mariah
|
2908
|
+
Carey", "id": "7869a003-ec31-37f6-7369-4e500de1f577", "slug": "emotions",
|
2909
|
+
"product_form": "Single", "release_year": 2002}, {"artist_name": "Mariah Carey",
|
2910
|
+
"name": "Emotions", "entity_type": "album", "album_artist_id": "b9fae655-9741-b873-9cd0-834c2a9c3e34",
|
2911
|
+
"main_genre": "pop", "album_ref_id": "14842599", "performer_name": "Mariah
|
2912
|
+
Carey", "id": "22a84035-7c3c-5268-e762-68ead77136b3", "slug": "emotions",
|
2913
|
+
"product_form": "Album", "release_year": 1991}, {"artist_name": "The Rolling
|
2914
|
+
Stones", "name": "Mixed Emotions", "entity_type": "album", "album_artist_id":
|
2915
|
+
"e88b6841-a6b5-11e0-b446-00251188dd67", "main_genre": "rock", "album_ref_id":
|
2916
|
+
"15890455", "performer_name": "The Rolling Stones", "id": "78fe2b64-8497-1060-bcc0-de924734bff9",
|
2917
|
+
"slug": "mixed emotions", "product_form": "Single", "release_year": 1990},
|
2918
|
+
{"artist_name": "The Rolling Stones", "name": "Emotional Rescue", "entity_type":
|
2919
|
+
"album", "album_artist_id": "e88b6841-a6b5-11e0-b446-00251188dd67", "main_genre":
|
2920
|
+
"rock", "album_ref_id": "32202849", "performer_name": "The Rolling Stones",
|
2921
|
+
"id": "7cfb88ac-1d50-f210-42d6-57a718fa141c", "slug": "emotional rescue",
|
2922
|
+
"product_form": "Album", "release_year": 1980}, {"artist_name": "Dahlia",
|
2923
|
+
"name": "Emotion Cycles", "entity_type": "album", "album_artist_id": "2d8fb76a-f893-51ec-19c9-572bd3c33c7a",
|
2924
|
+
"main_genre": "electronica/dance", "album_ref_id": "2280143", "performer_name":
|
2925
|
+
"Dahlia", "id": "d3dd87c4-b87a-e0ab-eb9a-4e598a65a71b", "slug": "emotion cycles",
|
2926
|
+
"product_form": "Album", "release_year": 2001}, {"artist_name": "Whitney Houston",
|
2927
|
+
"name": "So Emotional", "entity_type": "album", "album_artist_id": "e398f5d4-a6b5-11e0-b446-00251188dd67",
|
2928
|
+
"main_genre": "pop", "album_ref_id": "69577767", "performer_name": "Whitney
|
2929
|
+
Houston", "id": "16a652e2-d62b-e7d4-2645-b5b68b8c71fb", "slug": "so emotional",
|
2930
|
+
"product_form": "Single", "release_year": 1988}, {"artist_name": "Dinah Washington",
|
2931
|
+
"name": "Mixed Emotions", "entity_type": "album", "album_artist_id": "e3577cbb-a6b5-11e0-b446-00251188dd67",
|
2932
|
+
"main_genre": "jazz", "album_ref_id": "40552099", "performer_name": "Dinah
|
2933
|
+
Washington", "id": "36b97c82-cd64-c754-41be-5b41812395df", "slug": "mixed
|
2934
|
+
emotions", "product_form": "Album", "release_year": 2002}, {"artist_name":
|
2935
|
+
"Tim McGraw", "name": "Emotional Traffic", "entity_type": "album", "album_artist_id":
|
2936
|
+
"8aff6b3e-a023-cead-c16e-5c39d0dedfba", "main_genre": "country", "album_ref_id":
|
2937
|
+
"63234357", "performer_name": "Tim McGraw", "id": "0dae7300-90cb-8c86-db64-1be3a17a2401",
|
2938
|
+
"slug": "emotional traffic", "product_form": "Album", "release_year": 2012},
|
2939
|
+
{"artist_name": "Destiny''s Child", "name": "Emotion [US 12\"]", "entity_type":
|
2940
|
+
"album", "album_artist_id": "ab03f3c2-dc65-d333-406b-0e4dddda1407", "main_genre":
|
2941
|
+
"pop", "album_ref_id": "30914135", "performer_name": "Destiny''s Child", "id":
|
2942
|
+
"f2708bb9-2a65-696b-7f96-3715064096c5", "slug": "emotion us 12", "product_form":
|
2943
|
+
"Single", "release_year": 2001}, {"artist_name": "Oscar Peterson", "name":
|
2944
|
+
"Motions & Emotions", "entity_type": "album", "album_artist_id": "e2cf1db0-a6b5-11e0-b446-00251188dd67",
|
2945
|
+
"main_genre": "jazz", "album_ref_id": "5303273", "performer_name": "Oscar
|
2946
|
+
Peterson", "id": "e698b9f2-0107-5d26-d1d9-9e0a3feced2d", "slug": "motions
|
2947
|
+
emotions", "product_form": "Album", "release_year": 1969}, {"artist_name":
|
2948
|
+
"Brenda Lee", "name": "Emotions", "entity_type": "album", "album_artist_id":
|
2949
|
+
"31fef68f-ebaf-b1a9-6e67-e1ceeb5e8dec", "main_genre": "jazz", "album_ref_id":
|
2950
|
+
"64721737", "performer_name": "Brenda Lee", "id": "10a17706-d760-6784-1c3c-48b1697b679c",
|
2951
|
+
"slug": "emotions", "product_form": "Album", "release_year": 1961}, {"artist_name":
|
2952
|
+
"Barbra Streisand", "name": "Emotion", "entity_type": "album", "album_artist_id":
|
2953
|
+
"e32c6c9d-a6b5-11e0-b446-00251188dd67", "main_genre": "vocals", "album_ref_id":
|
2954
|
+
"527847", "performer_name": "Barbra Streisand", "id": "2207ded9-a5e5-3b8d-1d36-8e969d26564a",
|
2955
|
+
"slug": "emotion", "product_form": "Album", "release_year": 1984}, {"name":
|
2956
|
+
"Emotions", "entity_type": "album", "album_artist_id": "ee25f6da-a6b5-11e0-b446-00251188dd67",
|
2957
|
+
"slug": "emotions", "artist_name": "Sila", "performer_name": "Sila", "id":
|
2958
|
+
"237292d9-12fc-3933-f717-4524ca827daf", "main_genre": "pop", "product_form":
|
2959
|
+
"Single", "album_ref_id": "41154039"}, {"artist_name": "Rosemary Clooney",
|
2960
|
+
"name": "Mixed Emotions", "entity_type": "album", "album_artist_id": "e3c55782-a6b5-11e0-b446-00251188dd67",
|
2961
|
+
"main_genre": "pop", "album_ref_id": "55612349", "performer_name": "Rosemary
|
2962
|
+
Clooney", "id": "d3008d94-17a9-0c86-4ce8-4723f969368b", "slug": "mixed emotions",
|
2963
|
+
"product_form": "Album", "release_year": 1986}, {"artist_name": "The O''Jays",
|
2964
|
+
"name": "Emotionally Yours", "entity_type": "album", "album_artist_id": "e68df63a-a6b5-11e0-b446-00251188dd67",
|
2965
|
+
"main_genre": "soul/r&b", "album_ref_id": "57553", "performer_name": "The
|
2966
|
+
O''Jays", "id": "677bab38-114d-0b4c-049c-70730fe48685", "slug": "emotionally
|
2967
|
+
yours", "product_form": "Album", "release_year": 1991}, {"artist_name": "The
|
2968
|
+
Avett Brothers", "name": "Emotionalism", "entity_type": "album", "album_artist_id":
|
2969
|
+
"f064adc4-a6b5-11e0-b446-00251188dd67", "main_genre": "rock", "album_ref_id":
|
2970
|
+
"10416045", "performer_name": "The Avett Brothers", "id": "4866b11f-6328-4d9d-55e4-641e3573ff52",
|
2971
|
+
"slug": "emotionalism", "product_form": "Album", "release_year": 2007}, {"artist_name":
|
2972
|
+
"TJR", "name": "Mixed Emotions", "entity_type": "album", "album_artist_id":
|
2973
|
+
"f03535e4-a6b5-11e0-b446-00251188dd67", "main_genre": "blues", "album_ref_id":
|
2974
|
+
"86560409", "performer_name": "TJR", "id": "0bb03327-7d28-9784-1197-4a4bf1ab1e7f",
|
2975
|
+
"slug": "mixed emotions", "product_form": "Album", "release_year": 2003},
|
2976
|
+
{"artist_name": "BT", "name": "Emotional Technology", "entity_type": "album",
|
2977
|
+
"album_artist_id": "e2969b62-a6b5-11e0-b446-00251188dd67", "main_genre": "electronica/dance",
|
2978
|
+
"album_ref_id": "46155395", "performer_name": "BT", "id": "3ee8d4d4-03eb-2128-b3ee-dec9cda7c4d0",
|
2979
|
+
"slug": "emotional technology", "product_form": "Album", "release_year": 2003},
|
2980
|
+
{"artist_name": "Chris de Burgh", "name": "Into the Light/High on Emotion",
|
2981
|
+
"entity_type": "album", "album_artist_id": "3edb3f6a-3cda-2ad5-af2d-ff763c197f52",
|
2982
|
+
"main_genre": "rock", "album_ref_id": "4078507", "performer_name": "Chris
|
2983
|
+
De Burgh", "id": "b5626855-2766-17e6-31ba-42398b93c314", "slug": "into the
|
2984
|
+
lighthigh on emotion", "product_form": "Album", "release_year": 2000}, {"artist_name":
|
2985
|
+
"Jeff Beck", "name": "Emotion & Commotion", "entity_type": "album", "album_artist_id":
|
2986
|
+
"e6c88da8-a6b5-11e0-b446-00251188dd67", "main_genre": "rock", "album_ref_id":
|
2987
|
+
"38767673", "performer_name": "Jeff Beck", "id": "7f1f7fb1-1906-ae57-de35-446b4566287b",
|
2988
|
+
"slug": "emotion commotion", "product_form": "Album", "release_year": 2010}]}'
|
2989
|
+
http_version:
|
2990
|
+
recorded_at: Sun, 12 Apr 2015 22:06:54 GMT
|
2862
2991
|
recorded_with: VCR 2.9.3
|
@@ -4,5 +4,245 @@ module MusicGraph
|
|
4
4
|
it "exists" do
|
5
5
|
expect(MusicGraph::Album)
|
6
6
|
end
|
7
|
+
|
8
|
+
describe "#search" do
|
9
|
+
it "returns album title search results" do
|
10
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
11
|
+
album_name = "either/or"
|
12
|
+
albums = MusicGraph::Album.search(album_name)
|
13
|
+
|
14
|
+
expect(albums).to_not be_empty
|
15
|
+
expect(albums.first).to be_an Album
|
16
|
+
expect(albums.first.title).to eql("Either/Or")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it "accepts hash and returns album title search results" do
|
21
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
22
|
+
params = {
|
23
|
+
title: "i and love and you"
|
24
|
+
}
|
25
|
+
albums = MusicGraph::Album.search(params)
|
26
|
+
|
27
|
+
expect(albums).to_not be_empty
|
28
|
+
expect(albums.first).to be_an Album
|
29
|
+
expect(albums.first.title).to eql("I and Love and You")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "accepts hash and returns artist name search results" do
|
34
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
35
|
+
params = {
|
36
|
+
artist_name: "led zeppelin"
|
37
|
+
}
|
38
|
+
albums = MusicGraph::Album.search(params)
|
39
|
+
|
40
|
+
expect(albums).to_not be_empty
|
41
|
+
expect(albums.length).to eql(20)
|
42
|
+
expect(albums.first).to be_an Album
|
43
|
+
expect(albums.first.title).to eql("C'mon Everybody")
|
44
|
+
expect(albums.last.title).to eql("Led Zeppelin [Box Set]")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it "accepts hash and returns similar to albums" do
|
49
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
50
|
+
params = {
|
51
|
+
similar_to: "grace"
|
52
|
+
}
|
53
|
+
albums = MusicGraph::Album.search(params)
|
54
|
+
|
55
|
+
expect(albums).to_not be_empty
|
56
|
+
expect(albums.length).to eql(7)
|
57
|
+
expect(albums.first).to be_an Album
|
58
|
+
expect(albums.first.title).to eql("Tidal")
|
59
|
+
expect(albums.last.title).to eql("Greater Than")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it "accepts hash and returns country search results" do
|
64
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
65
|
+
params = {
|
66
|
+
country: "iceland"
|
67
|
+
}
|
68
|
+
albums = MusicGraph::Album.search(params)
|
69
|
+
|
70
|
+
expect(albums).to_not be_empty
|
71
|
+
expect(albums.length).to eql(20)
|
72
|
+
expect(albums.first).to be_an Album
|
73
|
+
expect(albums.first.title).to eql("For Now I Am Winter")
|
74
|
+
expect(albums.last.title).to eql("My Head Is an Animal")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it "accepts hash and returns decade search results" do
|
79
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
80
|
+
params = {
|
81
|
+
decade: "1960s"
|
82
|
+
}
|
83
|
+
albums = MusicGraph::Album.search(params)
|
84
|
+
|
85
|
+
expect(albums).to_not be_empty
|
86
|
+
expect(albums.length).to eql(20)
|
87
|
+
expect(albums.first).to be_an Album
|
88
|
+
expect(albums.first.title).to eql("Soul Shakedown")
|
89
|
+
expect(albums.last.title).to eql("At Carnegie Hall")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it "accepts hash and returns genre search results" do
|
94
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
95
|
+
params = {
|
96
|
+
genre: "rock"
|
97
|
+
}
|
98
|
+
albums = MusicGraph::Album.search(params)
|
99
|
+
|
100
|
+
expect(albums).to_not be_empty
|
101
|
+
expect(albums.length).to eql(20)
|
102
|
+
expect(albums.first).to be_an Album
|
103
|
+
expect(albums.first.title).to eql("You Are the Night")
|
104
|
+
expect(albums.last.title).to eql("Safety")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
it "accepts hash and returns limited results" do
|
109
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
110
|
+
params = {
|
111
|
+
similar_to: "Sgt. Pepper's Lonely Hearts Club Band",
|
112
|
+
limit: 5
|
113
|
+
}
|
114
|
+
albums = MusicGraph::Album.search(params)
|
115
|
+
|
116
|
+
expect(albums).to_not be_empty
|
117
|
+
expect(albums.length).to eql(5)
|
118
|
+
expect(albums.first).to be_an Album
|
119
|
+
expect(albums.first.title).to eql("Doors")
|
120
|
+
expect(albums.last.title).to eql("Days of Future Passed")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
it "accepts hash and returns offset results" do
|
125
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
126
|
+
params = {
|
127
|
+
similar_to: "Sgt. Pepper's Lonely Hearts Club Band",
|
128
|
+
offset: 2
|
129
|
+
}
|
130
|
+
albums = MusicGraph::Album.search(params)
|
131
|
+
|
132
|
+
expect(albums).to_not be_empty
|
133
|
+
expect(albums.length).to eql(11)
|
134
|
+
expect(albums.first).to be_an Album
|
135
|
+
expect(albums.first.title).to_not eql("Doors")
|
136
|
+
expect(albums.last.title).to eql("Odessa")
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "#suggest" do
|
142
|
+
it "returns a list of matches" do
|
143
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
144
|
+
query = "Emotion"
|
145
|
+
albums = MusicGraph::Album.suggest(query)
|
146
|
+
|
147
|
+
expect(albums.length).to eql(20)
|
148
|
+
expect(albums).to be_an Array
|
149
|
+
expect(albums.first).to be_an Album
|
150
|
+
expect(albums.first.title).to eql("Emotions")
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
it "accepts hash and returns suggestions" do
|
155
|
+
VCR.use_cassette("artist", record: :new_episodes) do
|
156
|
+
params = {
|
157
|
+
prefix: "Emotion"
|
158
|
+
}
|
159
|
+
albums = MusicGraph::Album.suggest(params)
|
160
|
+
|
161
|
+
expect(albums.length).to eql(20)
|
162
|
+
expect(albums).to be_an Array
|
163
|
+
expect(albums.first).to be_an Album
|
164
|
+
expect(albums.first.title).to eql("Emotions")
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe "#find" do
|
170
|
+
it "returns a single album" do
|
171
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
172
|
+
album_id = "7cfb88ac-1d50-f210-42d6-57a718fa141c"
|
173
|
+
album = MusicGraph::Album.find(album_id)
|
174
|
+
|
175
|
+
expect(album).to be_an Album
|
176
|
+
expect(album.release_year).to eql(1980)
|
177
|
+
expect(album.title).to eql("Emotional Rescue")
|
178
|
+
expect(album.entity_type).to eql("album")
|
179
|
+
expect(album.album_artist_id).to eql("e88b6841-a6b5-11e0-b446-00251188dd67")
|
180
|
+
expect(album.id).to eql("7cfb88ac-1d50-f210-42d6-57a718fa141c")
|
181
|
+
expect(album.number_of_tracks).to eql("10")
|
182
|
+
expect(album.album_ref_id).to eql("32202849")
|
183
|
+
expect(album.performer_name).to eql("The Rolling Stones")
|
184
|
+
expect(album.main_genre).to eql("rock")
|
185
|
+
expect(album.product_form).to eql("Album")
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
describe "#edges" do
|
191
|
+
it "returns edges for an album" do
|
192
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
193
|
+
album_id = "7cfb88ac-1d50-f210-42d6-57a718fa141c"
|
194
|
+
album = MusicGraph::Album.find(album_id)
|
195
|
+
|
196
|
+
expect(album.edges).to be_an Array
|
197
|
+
expect(album.edges).to eql(["artists", "tracks"])
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
describe "#metadata" do
|
203
|
+
it "returns metadata for an album" do
|
204
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
205
|
+
album_id = "7cfb88ac-1d50-f210-42d6-57a718fa141c"
|
206
|
+
album = MusicGraph::Album.find(album_id)
|
207
|
+
|
208
|
+
expect(album.metadata).to be_a Hash
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
it "filters by given fields" do
|
213
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
214
|
+
filters = ["id", "title"]
|
215
|
+
album_id = "7cfb88ac-1d50-f210-42d6-57a718fa141c"
|
216
|
+
album = MusicGraph::Album.find(album_id, filters)
|
217
|
+
|
218
|
+
expect(album.title).to eql("Emotional Rescue")
|
219
|
+
expect(album.performer_name).to be(nil)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
describe "#artists" do
|
225
|
+
it "returns artists for an album" do
|
226
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
227
|
+
album_id = "7cfb88ac-1d50-f210-42d6-57a718fa141c"
|
228
|
+
album = MusicGraph::Album.find(album_id)
|
229
|
+
|
230
|
+
expect(album.artists).to be_an Array
|
231
|
+
expect(album.artists.first).to be_an Artist
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
describe "#tracks" do
|
237
|
+
it "returns tracks for an album" do
|
238
|
+
VCR.use_cassette("album", record: :new_episodes) do
|
239
|
+
album_id = "7cfb88ac-1d50-f210-42d6-57a718fa141c"
|
240
|
+
album = MusicGraph::Album.find(album_id)
|
241
|
+
|
242
|
+
expect(album.tracks).to be_an Array
|
243
|
+
expect(album.tracks.first).to be_a Track
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
7
247
|
end
|
8
248
|
end
|
@@ -12,7 +12,7 @@ module MusicGraph
|
|
12
12
|
artists = MusicGraph::Artist.search(artist_name)
|
13
13
|
|
14
14
|
expect(artists).to_not be_empty
|
15
|
-
expect(artists.first).to
|
15
|
+
expect(artists.first).to be_an Artist
|
16
16
|
expect(artists.first.name).to eql("Wilco")
|
17
17
|
end
|
18
18
|
end
|
@@ -25,7 +25,7 @@ module MusicGraph
|
|
25
25
|
artists = MusicGraph::Artist.search(params)
|
26
26
|
|
27
27
|
expect(artists).to_not be_empty
|
28
|
-
expect(artists.first).to
|
28
|
+
expect(artists.first).to be_an Artist
|
29
29
|
expect(artists.first.name).to eql("Local Natives")
|
30
30
|
end
|
31
31
|
end
|
@@ -39,7 +39,7 @@ module MusicGraph
|
|
39
39
|
|
40
40
|
expect(artists).to_not be_empty
|
41
41
|
expect(artists.length).to eql(20)
|
42
|
-
expect(artists.first).to
|
42
|
+
expect(artists.first).to be_an Artist
|
43
43
|
expect(artists.first.name).to eql("David Gilmour")
|
44
44
|
expect(artists.last.name).to eql("Eric Clapton")
|
45
45
|
end
|
@@ -54,7 +54,7 @@ module MusicGraph
|
|
54
54
|
|
55
55
|
expect(artists).to_not be_empty
|
56
56
|
expect(artists.length).to eql(20)
|
57
|
-
expect(artists.first).to
|
57
|
+
expect(artists.first).to be_an Artist
|
58
58
|
expect(artists.first.name).to eql("Lil Wayne")
|
59
59
|
expect(artists.last.name).to eql("Juicy J")
|
60
60
|
end
|
@@ -69,7 +69,7 @@ module MusicGraph
|
|
69
69
|
|
70
70
|
expect(artists).to_not be_empty
|
71
71
|
expect(artists.length).to eql(20)
|
72
|
-
expect(artists.first).to
|
72
|
+
expect(artists.first).to be_an Artist
|
73
73
|
expect(artists.first.name).to eql("Chris Brown")
|
74
74
|
expect(artists.last.name).to eql("Amy Winehouse")
|
75
75
|
end
|
@@ -84,7 +84,7 @@ module MusicGraph
|
|
84
84
|
|
85
85
|
expect(artists).to_not be_empty
|
86
86
|
expect(artists.length).to eql(20)
|
87
|
-
expect(artists.first).to
|
87
|
+
expect(artists.first).to be_an Artist
|
88
88
|
expect(artists.first.name).to eql("Sasha")
|
89
89
|
expect(artists.last.name).to eql("Shakira")
|
90
90
|
end
|
@@ -99,7 +99,7 @@ module MusicGraph
|
|
99
99
|
|
100
100
|
expect(artists).to_not be_empty
|
101
101
|
expect(artists.length).to eql(20)
|
102
|
-
expect(artists.first).to
|
102
|
+
expect(artists.first).to be_an Artist
|
103
103
|
expect(artists.first.name).to eql("Lil Wayne")
|
104
104
|
expect(artists.last.name).to eql("Juicy J")
|
105
105
|
end
|
@@ -115,7 +115,7 @@ module MusicGraph
|
|
115
115
|
|
116
116
|
expect(artists).to_not be_empty
|
117
117
|
expect(artists.length).to eql(5)
|
118
|
-
expect(artists.first).to
|
118
|
+
expect(artists.first).to be_an Artist
|
119
119
|
expect(artists.first.name).to eql("David Gilmour")
|
120
120
|
expect(artists.last.name).to_not eql("Eric Clapton")
|
121
121
|
end
|
@@ -131,7 +131,7 @@ module MusicGraph
|
|
131
131
|
|
132
132
|
expect(artists).to_not be_empty
|
133
133
|
expect(artists.length).to eql(7)
|
134
|
-
expect(artists.first).to
|
134
|
+
expect(artists.first).to be_an Artist
|
135
135
|
expect(artists.first.name).to_not eql("David Gilmour")
|
136
136
|
expect(artists.last.name).to eql("Hess Is More")
|
137
137
|
end
|
@@ -145,8 +145,8 @@ module MusicGraph
|
|
145
145
|
artists = MusicGraph::Artist.suggest(query)
|
146
146
|
|
147
147
|
expect(artists.length).to eql(20)
|
148
|
-
expect(artists).to
|
149
|
-
expect(artists.first).to
|
148
|
+
expect(artists).to be_an Array
|
149
|
+
expect(artists.first).to be_an Artist
|
150
150
|
expect(artists.first.name).to eql("Green Day")
|
151
151
|
end
|
152
152
|
end
|
@@ -160,8 +160,8 @@ module MusicGraph
|
|
160
160
|
artists = MusicGraph::Artist.suggest(params)
|
161
161
|
|
162
162
|
expect(artists.length).to eql(20)
|
163
|
-
expect(artists).to
|
164
|
-
expect(artists.first).to
|
163
|
+
expect(artists).to be_an Array
|
164
|
+
expect(artists.first).to be_an Artist
|
165
165
|
expect(artists.first.name).to eql("Green Day")
|
166
166
|
end
|
167
167
|
end
|
@@ -173,7 +173,7 @@ module MusicGraph
|
|
173
173
|
artist_id = "e4de0d41-a6b5-11e0-b446-00251188dd67"
|
174
174
|
artist = MusicGraph::Artist.find(artist_id)
|
175
175
|
|
176
|
-
expect(artist).to
|
176
|
+
expect(artist).to be_an Artist
|
177
177
|
expect(artist.seven_digital_id).to eql("5843")
|
178
178
|
expect(artist.main_genre).to eql("alternative/indie")
|
179
179
|
expect(artist.country_of_origin).to eql("United States of America")
|
@@ -196,7 +196,7 @@ module MusicGraph
|
|
196
196
|
VCR.use_cassette("artist", record: :new_episodes) do
|
197
197
|
artist = MusicGraph::Artist.find("e4de0d41-a6b5-11e0-b446-00251188dd67")
|
198
198
|
|
199
|
-
expect(artist.edges).to
|
199
|
+
expect(artist.edges).to be_an Array
|
200
200
|
expect(artist.edges).to eql(["albums", "similar", "tracks"])
|
201
201
|
end
|
202
202
|
end
|
@@ -227,8 +227,8 @@ module MusicGraph
|
|
227
227
|
VCR.use_cassette("artist", record: :new_episodes) do
|
228
228
|
artist = MusicGraph::Artist.find("e4de0d41-a6b5-11e0-b446-00251188dd67")
|
229
229
|
|
230
|
-
expect(artist.similar).to
|
231
|
-
expect(artist.similar.first).to
|
230
|
+
expect(artist.similar).to be_an Array
|
231
|
+
expect(artist.similar.first).to be_an Artist
|
232
232
|
expect(artist.similar.first.name).to eql("Bob Forrest")
|
233
233
|
end
|
234
234
|
end
|
@@ -239,8 +239,8 @@ module MusicGraph
|
|
239
239
|
VCR.use_cassette("artist", record: :new_episodes) do
|
240
240
|
artist = MusicGraph::Artist.find("e4de0d41-a6b5-11e0-b446-00251188dd67")
|
241
241
|
|
242
|
-
expect(artist.albums).to
|
243
|
-
expect(artist.albums.first).to
|
242
|
+
expect(artist.albums).to be_an Array
|
243
|
+
expect(artist.albums.first).to be_an Album
|
244
244
|
end
|
245
245
|
end
|
246
246
|
end
|
@@ -250,7 +250,7 @@ module MusicGraph
|
|
250
250
|
VCR.use_cassette("artist", record: :new_episodes) do
|
251
251
|
artist = MusicGraph::Artist.find("e4de0d41-a6b5-11e0-b446-00251188dd67")
|
252
252
|
|
253
|
-
expect(artist.tracks).to
|
253
|
+
expect(artist.tracks).to be_an Array
|
254
254
|
expect(artist.tracks.first).to be_a Track
|
255
255
|
end
|
256
256
|
end
|