gingerhendrix-echonest 0.2.0 → 0.3.0
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.
- data/VERSION.yml +1 -1
- data/examples/artist_audio.rb +33 -0
- data/lib/echonest.rb +39 -29
- data/lib/echonest/artist.rb +57 -53
- data/lib/echonest/paged_result.rb +33 -0
- data/lib/echonest/xml/artist_doc.rb +23 -0
- data/lib/echonest/xml/artist_search_results.rb +14 -0
- data/lib/echonest/xml/audio_doc.rb +20 -0
- data/lib/echonest/xml/audio_result.rb +13 -0
- data/lib/echonest/xml/audio_results.rb +16 -0
- data/lib/echonest/xml/blogs_doc.rb +15 -0
- data/lib/echonest/xml/blogs_result.rb +14 -0
- data/lib/echonest/xml/blogs_results.rb +18 -0
- data/lib/echonest/xml/familiarity_result.rb +12 -0
- data/lib/echonest/xml/hotttnesss_result.rb +12 -0
- data/lib/echonest/xml/news_doc.rb +15 -0
- data/lib/echonest/xml/news_result.rb +14 -0
- data/lib/echonest/xml/news_results.rb +16 -0
- data/lib/echonest/xml/profile_result.rb +12 -0
- data/lib/echonest/xml/reviews_doc.rb +16 -0
- data/lib/echonest/xml/reviews_result.rb +15 -0
- data/lib/echonest/xml/reviews_results.rb +17 -0
- data/lib/echonest/xml/similar_doc.rb +15 -0
- data/lib/echonest/xml/similar_result.rb +14 -0
- data/lib/echonest/xml/similar_results.rb +16 -0
- data/lib/echonest/xml/urls_result.rb +14 -0
- data/lib/echonest/xml/video_doc.rb +16 -0
- data/lib/echonest/xml/video_result.rb +14 -0
- data/lib/echonest/xml/video_results.rb +17 -0
- data/spec/echonest/paged_result_spec.rb +66 -0
- data/spec/echonest/xml/artist_search_results_spec.rb +25 -0
- data/spec/echonest/{audio_result_spec.rb → xml/audio_result_spec.rb} +9 -9
- data/spec/echonest/{blog_result_spec.rb → xml/blogs_result_spec.rb} +10 -10
- data/spec/echonest/{familiarity_result_spec.rb → xml/familiarity_result_spec.rb} +7 -7
- data/spec/echonest/{hotttness_result_spec.rb → xml/hotttness_result_spec.rb} +7 -7
- data/spec/echonest/{news_result_spec.rb → xml/news_result_spec.rb} +9 -9
- data/spec/echonest/{profile_result_spec.rb → xml/profile_result_spec.rb} +5 -5
- data/spec/echonest/xml/refactor.rb +12 -0
- data/spec/echonest/{reviews_result_spec.rb → xml/reviews_result_spec.rb} +9 -9
- data/spec/echonest/{similar_result_spec.rb → xml/similar_result_spec.rb} +7 -7
- data/spec/echonest/{urls_result_spec.rb → xml/urls_result_spec.rb} +6 -6
- data/spec/echonest/{video_result_spec.rb → xml/video_result_spec.rb} +9 -9
- data/spec/spec_helper.rb +2 -0
- metadata +57 -48
- data/lib/echonest/artist_search.rb +0 -18
- data/lib/echonest/audio_doc.rb +0 -18
- data/lib/echonest/audio_result.rb +0 -12
- data/lib/echonest/audio_results.rb +0 -15
- data/lib/echonest/blog_doc.rb +0 -13
- data/lib/echonest/blog_result.rb +0 -12
- data/lib/echonest/blog_results.rb +0 -15
- data/lib/echonest/familiarity_result.rb +0 -11
- data/lib/echonest/hotttnesss_result.rb +0 -11
- data/lib/echonest/news_doc.rb +0 -13
- data/lib/echonest/news_result.rb +0 -12
- data/lib/echonest/news_results.rb +0 -15
- data/lib/echonest/profile_result.rb +0 -11
- data/lib/echonest/reviews_doc.rb +0 -15
- data/lib/echonest/reviews_result.rb +0 -12
- data/lib/echonest/reviews_results.rb +0 -15
- data/lib/echonest/similar_doc.rb +0 -13
- data/lib/echonest/similar_result.rb +0 -12
- data/lib/echonest/similar_results.rb +0 -11
- data/lib/echonest/urls_result.rb +0 -11
- data/lib/echonest/video_doc.rb +0 -14
- data/lib/echonest/video_result.rb +0 -12
- data/lib/echonest/video_results.rb +0 -15
- data/spec/echonest/search_spec.rb +0 -51
@@ -1,18 +0,0 @@
|
|
1
|
-
|
2
|
-
module EchoNest
|
3
|
-
class ArtistSearch
|
4
|
-
include HappyMapper
|
5
|
-
|
6
|
-
tag :response
|
7
|
-
|
8
|
-
# has_one :status, RequestStatus
|
9
|
-
# has_one :query, RequestQuery
|
10
|
-
has_many :artists, Artist
|
11
|
-
|
12
|
-
def self.search(query)
|
13
|
-
request = ApiRequest.new("search_artists", {:query => query})
|
14
|
-
parse(request.fetch)
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
data/lib/echonest/audio_doc.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
|
2
|
-
module EchoNest
|
3
|
-
class AudioDoc
|
4
|
-
include HappyMapper
|
5
|
-
|
6
|
-
tag :doc
|
7
|
-
|
8
|
-
element :artist_id, String
|
9
|
-
element :foreign_artist_id, String
|
10
|
-
element :artist, String
|
11
|
-
element :release, String
|
12
|
-
element :title, String
|
13
|
-
element :url, String
|
14
|
-
element :link, String
|
15
|
-
element :date, String
|
16
|
-
element :length, String
|
17
|
-
end
|
18
|
-
end
|
data/lib/echonest/blog_doc.rb
DELETED
data/lib/echonest/blog_result.rb
DELETED
data/lib/echonest/news_doc.rb
DELETED
data/lib/echonest/news_result.rb
DELETED
data/lib/echonest/reviews_doc.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
module EchoNest
|
3
|
-
class ReviewsDoc
|
4
|
-
include HappyMapper
|
5
|
-
|
6
|
-
tag :doc
|
7
|
-
|
8
|
-
#TODO: Add document elements
|
9
|
-
element :name, String
|
10
|
-
element :review_text, String
|
11
|
-
element :url, String
|
12
|
-
element :summary, String
|
13
|
-
element :date_found, String
|
14
|
-
end
|
15
|
-
end
|
data/lib/echonest/similar_doc.rb
DELETED
data/lib/echonest/urls_result.rb
DELETED
data/lib/echonest/video_doc.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe "ArtistSearch" do
|
4
|
-
|
5
|
-
describe "#search" do
|
6
|
-
before(:each) do
|
7
|
-
@mock_request = mock "Request"
|
8
|
-
@mock_request.stub!(:fetch)
|
9
|
-
EchoNest::ApiRequest.stub!(:new).and_return(@mock_request)
|
10
|
-
EchoNest::ArtistSearch.stub!(:parse)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should create a new ApiRequest with resource 'search_artists' and :query => query" do
|
14
|
-
EchoNest::ApiRequest.should_receive(:new).with('search_artists', :query=> "QUERY").and_return(@mock_request)
|
15
|
-
EchoNest::ArtistSearch.search("QUERY")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should call fetch on the api request" do
|
19
|
-
@mock_request.should_receive(:fetch)
|
20
|
-
EchoNest::ArtistSearch.search("QUERY")
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should call parse on the results of fetch" do
|
24
|
-
@mock_request.stub!(:fetch).and_return("RESULT")
|
25
|
-
EchoNest::ArtistSearch.should_receive(:parse).with("RESULT").and_return("search_result")
|
26
|
-
EchoNest::ArtistSearch.search("QUERY").should == "search_result"
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "#parse" do
|
32
|
-
|
33
|
-
before(:each) do
|
34
|
-
@xml = File.read(File.dirname(__FILE__) + "/../fixtures/search_artists/wavves.xml")
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should parse xml" do
|
38
|
-
EchoNest::ArtistSearch.parse(@xml)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should have list of artists" do
|
42
|
-
search = EchoNest::ArtistSearch.parse(@xml)
|
43
|
-
search.artists.should be_kind_of(Array)
|
44
|
-
search.artists[0].should be_kind_of(EchoNest::Artist)
|
45
|
-
search.artists[0].name.should == "Wavves"
|
46
|
-
search.artists[0].id.should == "music://id.echonest.com/~/AR/ARVVZQP11E2835DBCB"
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|