echowrap 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. data/.gitignore +22 -0
  2. data/.travis.yml +16 -0
  3. data/Gemfile +13 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +111 -0
  6. data/Rakefile +1 -0
  7. data/echowrap.gemspec +24 -0
  8. data/lib/echowrap/analysis.rb +39 -0
  9. data/lib/echowrap/api/artist.rb +387 -0
  10. data/lib/echowrap/api/oauth.rb +25 -0
  11. data/lib/echowrap/api/playlist.rb +248 -0
  12. data/lib/echowrap/api/sandbox.rb +45 -0
  13. data/lib/echowrap/api/song.rb +111 -0
  14. data/lib/echowrap/api/taste_profile.rb +296 -0
  15. data/lib/echowrap/api/track.rb +64 -0
  16. data/lib/echowrap/api/utils.rb +57 -0
  17. data/lib/echowrap/artist.rb +73 -0
  18. data/lib/echowrap/asset.rb +12 -0
  19. data/lib/echowrap/audio_summary.rb +15 -0
  20. data/lib/echowrap/base.rb +88 -0
  21. data/lib/echowrap/biography.rb +13 -0
  22. data/lib/echowrap/blog.rb +8 -0
  23. data/lib/echowrap/call_list.rb +8 -0
  24. data/lib/echowrap/category_map.rb +8 -0
  25. data/lib/echowrap/client.rb +80 -0
  26. data/lib/echowrap/configurable.rb +84 -0
  27. data/lib/echowrap/default.rb +88 -0
  28. data/lib/echowrap/doc_counts.rb +8 -0
  29. data/lib/echowrap/echonest_id.rb +8 -0
  30. data/lib/echowrap/error/bad_gateway.rb +11 -0
  31. data/lib/echowrap/error/bad_request.rb +10 -0
  32. data/lib/echowrap/error/client_error.rb +35 -0
  33. data/lib/echowrap/error/configuration_error.rb +8 -0
  34. data/lib/echowrap/error/forbidden.rb +10 -0
  35. data/lib/echowrap/error/gateway_timeout.rb +11 -0
  36. data/lib/echowrap/error/internal_server_error.rb +11 -0
  37. data/lib/echowrap/error/not_acceptable.rb +10 -0
  38. data/lib/echowrap/error/not_found.rb +10 -0
  39. data/lib/echowrap/error/server_error.rb +28 -0
  40. data/lib/echowrap/error/service_unavailable.rb +11 -0
  41. data/lib/echowrap/error/too_many_requests.rb +12 -0
  42. data/lib/echowrap/error/unauthorized.rb +10 -0
  43. data/lib/echowrap/error/unprocessable_entity.rb +10 -0
  44. data/lib/echowrap/error.rb +32 -0
  45. data/lib/echowrap/familiarity.rb +8 -0
  46. data/lib/echowrap/feed.rb +14 -0
  47. data/lib/echowrap/foreign_id.rb +10 -0
  48. data/lib/echowrap/genre.rb +8 -0
  49. data/lib/echowrap/hotttnesss.rb +8 -0
  50. data/lib/echowrap/image.rb +15 -0
  51. data/lib/echowrap/item.rb +95 -0
  52. data/lib/echowrap/item_request.rb +8 -0
  53. data/lib/echowrap/keyvalues.rb +8 -0
  54. data/lib/echowrap/license.rb +10 -0
  55. data/lib/echowrap/location.rb +8 -0
  56. data/lib/echowrap/meta.rb +9 -0
  57. data/lib/echowrap/news_article.rb +8 -0
  58. data/lib/echowrap/options.rb +10 -0
  59. data/lib/echowrap/playlist.rb +47 -0
  60. data/lib/echowrap/prediction.rb +7 -0
  61. data/lib/echowrap/rate_limit.rb +47 -0
  62. data/lib/echowrap/reference.rb +8 -0
  63. data/lib/echowrap/request/multipart_with_file.rb +36 -0
  64. data/lib/echowrap/response/parse_json.rb +25 -0
  65. data/lib/echowrap/response/raise_error.rb +31 -0
  66. data/lib/echowrap/review.rb +8 -0
  67. data/lib/echowrap/rule.rb +8 -0
  68. data/lib/echowrap/sandbox.rb +11 -0
  69. data/lib/echowrap/seeds.rb +9 -0
  70. data/lib/echowrap/sequenced_data/bar.rb +4 -0
  71. data/lib/echowrap/sequenced_data/beat.rb +4 -0
  72. data/lib/echowrap/sequenced_data/section.rb +6 -0
  73. data/lib/echowrap/sequenced_data/segment.rb +4 -0
  74. data/lib/echowrap/sequenced_data/tatum.rb +4 -0
  75. data/lib/echowrap/sequenced_data.rb +12 -0
  76. data/lib/echowrap/song.rb +24 -0
  77. data/lib/echowrap/status.rb +12 -0
  78. data/lib/echowrap/taste_profile.rb +28 -0
  79. data/lib/echowrap/term.rb +8 -0
  80. data/lib/echowrap/track.rb +21 -0
  81. data/lib/echowrap/update_info.rb +8 -0
  82. data/lib/echowrap/urls.rb +9 -0
  83. data/lib/echowrap/version.rb +18 -0
  84. data/lib/echowrap/video.rb +7 -0
  85. data/lib/echowrap/years_active.rb +8 -0
  86. data/lib/echowrap.rb +78 -0
  87. data/spec/echonest/api/artist_spec.rb +901 -0
  88. data/spec/echonest/api/oauth_spec.rb +29 -0
  89. data/spec/echonest/api/playlist_spec.rb +274 -0
  90. data/spec/echonest/api/sandbox_spec.rb +67 -0
  91. data/spec/echonest/api/song_spec.rb +326 -0
  92. data/spec/echonest/api/taste_profile_spec.rb +403 -0
  93. data/spec/echonest/api/track_spec.rb +167 -0
  94. data/spec/echonest/base_spec.rb +119 -0
  95. data/spec/echonest/client_spec.rb +174 -0
  96. data/spec/echonest/error_spec.rb +20 -0
  97. data/spec/echonest/rate_limit_spec.rb +76 -0
  98. data/spec/echonest_spec.rb +65 -0
  99. data/spec/fixtures/artist/biographies.json +1 -0
  100. data/spec/fixtures/artist/blogs.json +1 -0
  101. data/spec/fixtures/artist/extract.json +1 -0
  102. data/spec/fixtures/artist/familiarity.json +1 -0
  103. data/spec/fixtures/artist/hotttnesss.json +1 -0
  104. data/spec/fixtures/artist/images.json +1 -0
  105. data/spec/fixtures/artist/list_genres.json +1 -0
  106. data/spec/fixtures/artist/list_terms.json +1 -0
  107. data/spec/fixtures/artist/news.json +1 -0
  108. data/spec/fixtures/artist/profile.json +1 -0
  109. data/spec/fixtures/artist/reviews.json +1 -0
  110. data/spec/fixtures/artist/search.json +1 -0
  111. data/spec/fixtures/artist/similar.json +1 -0
  112. data/spec/fixtures/artist/songs.json +1 -0
  113. data/spec/fixtures/artist/suggest.json +1 -0
  114. data/spec/fixtures/artist/terms.json +1 -0
  115. data/spec/fixtures/artist/top_hottt.json +1 -0
  116. data/spec/fixtures/artist/top_terms.json +1 -0
  117. data/spec/fixtures/artist/twitter.json +1 -0
  118. data/spec/fixtures/artist/urls.json +1 -0
  119. data/spec/fixtures/artist/video.json +1 -0
  120. data/spec/fixtures/billie_jean_fingerprint.txt +1 -0
  121. data/spec/fixtures/billie_jean_query.json +16 -0
  122. data/spec/fixtures/oauth/timestamp.json +1 -0
  123. data/spec/fixtures/playlist/basic.json +1 -0
  124. data/spec/fixtures/playlist/dynamic/create.json +1 -0
  125. data/spec/fixtures/playlist/dynamic/delete.json +1 -0
  126. data/spec/fixtures/playlist/dynamic/feedback.json +1 -0
  127. data/spec/fixtures/playlist/dynamic/info.json +1 -0
  128. data/spec/fixtures/playlist/dynamic/next.json +1 -0
  129. data/spec/fixtures/playlist/dynamic/restart.json +1 -0
  130. data/spec/fixtures/playlist/dynamic/steer.json +1 -0
  131. data/spec/fixtures/playlist/static.json +1 -0
  132. data/spec/fixtures/sandbox/access.json +19 -0
  133. data/spec/fixtures/sandbox/list.json +1 -0
  134. data/spec/fixtures/song/identify.json +19 -0
  135. data/spec/fixtures/song/profile.json +1 -0
  136. data/spec/fixtures/song/search.json +1 -0
  137. data/spec/fixtures/taste_profile/ban.json +9 -0
  138. data/spec/fixtures/taste_profile/create.json +1 -0
  139. data/spec/fixtures/taste_profile/delete.json +11 -0
  140. data/spec/fixtures/taste_profile/favorite.json +9 -0
  141. data/spec/fixtures/taste_profile/feed.json +1 -0
  142. data/spec/fixtures/taste_profile/keyvalues.json +4 -0
  143. data/spec/fixtures/taste_profile/list.json +1 -0
  144. data/spec/fixtures/taste_profile/play.json +9 -0
  145. data/spec/fixtures/taste_profile/predict.json +1 -0
  146. data/spec/fixtures/taste_profile/profile.json +1 -0
  147. data/spec/fixtures/taste_profile/rate.json +9 -0
  148. data/spec/fixtures/taste_profile/read.json +1 -0
  149. data/spec/fixtures/taste_profile/similar.json +14 -0
  150. data/spec/fixtures/taste_profile/skip.json +9 -0
  151. data/spec/fixtures/taste_profile/status.json +2 -0
  152. data/spec/fixtures/taste_profile/update.json +10 -0
  153. data/spec/fixtures/taste_profile/update_request_data.json +4 -0
  154. data/spec/fixtures/technolol-music.mp3 +0 -0
  155. data/spec/fixtures/track/analysis.json +3 -0
  156. data/spec/fixtures/track/profile.json +35 -0
  157. data/spec/fixtures/track/upload.json +21 -0
  158. data/spec/helper.rb +50 -0
  159. metadata +323 -0
@@ -0,0 +1,8 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class ItemRequest < Echowrap::Base
5
+ attr_reader :artist_name, :item_id, :song_name
6
+
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Keyvalues < Echowrap::Base
5
+ attr_reader :cat_type, :is_active, :timestamp, :version
6
+
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class License < Echowrap::Base
5
+ attr_reader :attribution, :type, :url
6
+
7
+ end
8
+ end
9
+
10
+
@@ -0,0 +1,8 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Location < Echowrap::Base
5
+ attr_reader :city, :country, :location, :region
6
+
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Meta < Echowrap::Base
5
+ attr_reader :analyzer_version, :detailed_status, :filename, :artist,
6
+ :album, :title, :genre, :bitrate, :sample_rate, :seconds,
7
+ :status_code, :timestamp, :analysis_time
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class NewsArticle < Echowrap::Base
5
+ attr_reader :date_found, :date_posted, :id, :name, :summary, :url
6
+ end
7
+ end
8
+
@@ -0,0 +1,10 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Options < Echowrap::Base
5
+ attr_reader :adventurousness, :append_scores, :artist_pick, :buckets,
6
+ :distribution, :dmca, :limit, :playlist_type, :rank_type,
7
+ :song_types, :sort, :variety
8
+
9
+ end
10
+ end
@@ -0,0 +1,47 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Playlist < Echowrap::Base
5
+ attr_reader :actual_history_length, :api_key, :banned_artist_ids, :banned_song_ids,
6
+ :contraints, :favorited_artist_ids, :favorited_song_ids, :favorites_map,
7
+ :history, :invalid_artist_ids, :invalid_songs, :playlist_score, :ratings_map,
8
+ :restart_request_ids, :rules_retries, :rules_run, :rules_runtime, :session_id,
9
+ :skipped_songs, :song_scores
10
+
11
+
12
+ # @return [Array]
13
+ def call_list
14
+ @call_list ||= map_collection(Echowrap::CallList, :call_list)
15
+ end
16
+
17
+ # @return [Echowrap::CategoryMap]
18
+ def category_map
19
+ @category_map ||= Echowrap::CategoryMap.new(@attrs[:category_map])
20
+ end
21
+
22
+ # @return [Array]
23
+ def lookahead
24
+ @lookahead ||= map_collection(Echowrap::Song, :lookahead)
25
+ end
26
+
27
+ # @return [Echowrap::Options]
28
+ def options
29
+ @options ||= Echowrap::Options.new(@attrs[:options])
30
+ end
31
+
32
+ # @return [Array]
33
+ def rules
34
+ @rules ||= map_collection(Echowrap::Rule, :rules)
35
+ end
36
+
37
+ # @return [Echowrap::Seeds]
38
+ def seeds
39
+ @seeds ||= Echowrap::Seeds.new(@attrs[:seeds])
40
+ end
41
+
42
+ # @return [Array]
43
+ def songs
44
+ @songs ||= map_collection(Echowrap::Song, :songs)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,7 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Prediction < Echowrap::Base
5
+ attr_reader :category, :results
6
+ end
7
+ end
@@ -0,0 +1,47 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class RateLimit
5
+ attr_reader :attrs
6
+ alias to_hash attrs
7
+
8
+ # @return [Echowrap::RateLimit]
9
+ def initialize(attrs={})
10
+ @attrs = attrs
11
+ end
12
+
13
+ # @return [Integer]
14
+ def limit
15
+ limit = @attrs['x-rate-limit-limit']
16
+ limit.to_i if limit
17
+ end
18
+
19
+ # @return [Integer]
20
+ def remaining
21
+ remaining = @attrs['x-rate-limit-remaining']
22
+ remaining.to_i if remaining
23
+ end
24
+
25
+ # @return [Time]
26
+ def reset_at
27
+ reset = @attrs['x-rate-limit-reset']
28
+ Time.at(reset.to_i) if reset
29
+ end
30
+
31
+ # @return [Integer]
32
+ def reset_in
33
+ [(reset_at - Time.now).ceil, 0].max if reset_at
34
+ end
35
+ alias retry_after reset_in
36
+
37
+ # Update the attributes of a RateLimit
38
+ #
39
+ # @param attrs [Hash]
40
+ # @return [Echowrap::RateLimit]
41
+ def update(attrs)
42
+ @attrs.update(attrs)
43
+ self
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,8 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Reference < Echowrap::Base
5
+ attr_reader :artist_id, :artist_name
6
+ end
7
+ end
8
+
@@ -0,0 +1,36 @@
1
+ require 'faraday'
2
+
3
+ module Echowrap
4
+ module Request
5
+ class MultipartWithFile < Faraday::Middleware
6
+ CONTENT_TYPE = 'Content-Type'
7
+
8
+ def call(env)
9
+ env[:body].each do |key, value|
10
+ if value.respond_to?(:to_io)
11
+ env[:body][key] = Faraday::UploadIO.new(value, mime_type(value.path), value.path)
12
+ end
13
+ end if env[:body].is_a?(::Hash)
14
+ @app.call(env)
15
+ end
16
+
17
+ private
18
+
19
+ def mime_type(path)
20
+ case path
21
+ when /\.jpe?g/i
22
+ 'image/jpeg'
23
+ when /\.gif$/i
24
+ 'image/gif'
25
+ when /\.png$/i
26
+ 'image/png'
27
+ when /\.mp3$/i
28
+ 'audio/mpeg'
29
+ else
30
+ 'application/octet-stream'
31
+ end
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,25 @@
1
+ require 'faraday'
2
+ require 'multi_json'
3
+
4
+ module Echowrap
5
+ module Response
6
+ class ParseJson < Faraday::Response::Middleware
7
+
8
+ def parse(body)
9
+ case body
10
+ when /\A^\s*$\z/, nil
11
+ nil
12
+ else
13
+ MultiJson.decode(body, :symbolize_keys => true)
14
+ end
15
+ end
16
+
17
+ def on_complete(env)
18
+ if respond_to?(:parse)
19
+ env[:body] = parse(env[:body]) unless [204, 301, 302, 304].include?(env[:status])
20
+ end
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,31 @@
1
+ require 'faraday'
2
+ require 'echowrap/error/bad_gateway'
3
+ require 'echowrap/error/bad_request'
4
+ require 'echowrap/error/forbidden'
5
+ require 'echowrap/error/gateway_timeout'
6
+ require 'echowrap/error/internal_server_error'
7
+ require 'echowrap/error/not_acceptable'
8
+ require 'echowrap/error/not_found'
9
+ require 'echowrap/error/service_unavailable'
10
+ require 'echowrap/error/too_many_requests'
11
+ require 'echowrap/error/unauthorized'
12
+ require 'echowrap/error/unprocessable_entity'
13
+
14
+ module Echowrap
15
+ module Response
16
+ class RaiseError < Faraday::Response::Middleware
17
+
18
+ def on_complete(env)
19
+ status_code = env[:status].to_i
20
+ error_class = @klass.errors[status_code]
21
+ raise error_class.from_response(env) if error_class
22
+ end
23
+
24
+ def initialize(app, klass)
25
+ @klass = klass
26
+ super(app)
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,8 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Review < Echowrap::Base
5
+ attr_reader :date_found, :date_posted, :id, :image_url, :name, :release, :summary, :url
6
+ end
7
+ end
8
+
@@ -0,0 +1,8 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Rule < Echowrap::Base
5
+ attr_reader :rule
6
+
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Sandbox < Echowrap::Base
5
+ attr_reader :start, :total
6
+
7
+ def assets
8
+ @assets ||= map_collection(Echowrap::Asset, :assets)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Seeds < Echowrap::Base
5
+ attr_reader :artist_ids, :descriptions, :genres, :seed_catalogs, :session_catalogs,
6
+ :song_ids, :station_catalogs, :track_ids
7
+
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ module Echowrap
2
+ class Bar < Echowrap::SequencedData
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Echowrap
2
+ class Beat < Echowrap::SequencedData
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Echowrap
2
+ class Section < Echowrap::SequencedData
3
+ attr_reader :loudness_start, :loudness_max_time, :loudness_max,
4
+ :piches, :timbre
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ module Echowrap
2
+ class Segment < Echowrap::SequencedData
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Echowrap
2
+ class Tatum < Echowrap::SequencedData
3
+ end
4
+ end
@@ -0,0 +1,12 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class SequencedData < Echowrap::Base
5
+ attr_reader :start, :duration, :confidence
6
+
7
+ def id
8
+ "#{self.class.to_s.downcase}_#{self.start}"
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,24 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Song < Echowrap::Base
5
+ attr_reader :artist_id, :artist_familiarity, :artist_hotttnesss, :artist_name,
6
+ :attributes, :id, :message, :score, :song_currency, :song_discovery,
7
+ :song_hotttnesss, :song_type, :title
8
+
9
+ # @return [Echowrap::AudioSummary]
10
+ def audio_summary
11
+ @audio_summary ||= Echowrap::AudioSummary.new(@attrs[:audio_summary])
12
+ end
13
+
14
+ # @return [Echowrap::ArtistLocation]
15
+ def artist_location
16
+ @artist_location ||= Echowrap::Location.new(@attrs[:artist_location])
17
+ end
18
+
19
+ # @return [Array]
20
+ def tracks
21
+ @tracks ||= map_collection(Echowrap::Track, :tracks)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,12 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Status < Echowrap::Base
5
+ attr_reader :details, :items_updated, :percent_complete, :ticket_status, :total_items
6
+
7
+ def update_info
8
+ @update_info ||= map_collection(Echowrap::UpdateInfo, :update_info)
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,28 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class TasteProfile < Echowrap::Base
5
+ attr_reader :name, :pending_tickets, :resolved, :score, :ticket, :total, :type
6
+
7
+ # @return [String]
8
+ def id
9
+ @attrs[:id] || @attrs[:ticket]
10
+ end
11
+
12
+ # @return [Array]
13
+ def items
14
+ @items ||= map_collection(Echowrap::Item, :items)
15
+ end
16
+
17
+ # @return [Echowrap::Keyvalues]
18
+ def keyvalues
19
+ @keyvalues ||= Echowrap::Keyvalues.new(@attrs[:keyvalues])
20
+ end
21
+
22
+ # @return [Array]
23
+ def predictions
24
+ @predictions ||= map_collection(Echowrap::Prediction, :predictions)
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,8 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Term < Echowrap::Base
5
+ attr_reader :name, :frequency, :weight
6
+
7
+ end
8
+ end
@@ -0,0 +1,21 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Track < Echowrap::Base
5
+ attr_reader :analysis_channels, :analysis_sample_rate, :analyzer_version, :artist,
6
+ :attributes, :audio_md5, :bitrate, :catalog, :code_version, :codestring,
7
+ :decoder, :duration, :echoprint_version, :echoprintstring, :end_of_fade_in,
8
+ :foreign_id, :foreign_release_id, :id, :key, :key_confidence, :loudness,
9
+ :md5, :mode, :mode_confidence, :num_samples, :offset_seconds, :preview_url,
10
+ :release, :release_image, :sample_md5, :samplerate, :song_id,
11
+ :start_of_fade_out, :status, :synch_version, :synchstring, :tempo,
12
+ :tempo_confidence, :time_signature, :time_signature_confidence, :title,
13
+ :window_seconds
14
+
15
+ # @return [Echowrap::AudioSummary]
16
+ def audio_summary
17
+ @audio_summary ||= Echowrap::AudioSummary.new(@attrs[:audio_summary])
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,8 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class UpdateInfo < Echowrap::Base
5
+ attr_reader :info, :item_id
6
+
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Urls < Echowrap::Base
5
+ attr_reader :amazon_url, :itunes_url, :lastfm_url, :mb_url, :myspace_url,
6
+ :official_url, :wikipedia_url
7
+
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ module Echowrap
2
+ class Version
3
+ MAJOR = 0 unless defined? Echowrap::Version::MAJOR
4
+ MINOR = 0 unless defined? Echowrap::Version::MINOR
5
+ PATCH = 1 unless defined? Echowrap::Version::PATCH
6
+ PRE = nil unless defined? Echowrap::Version::PRE
7
+
8
+ class << self
9
+
10
+ # @return [String]
11
+ def to_s
12
+ [MAJOR, MINOR, PATCH, PRE].compact.join('.')
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class Video < Echowrap::Base
5
+ attr_reader :date_found, :id, :image_url, :site, :title, :url
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ require 'echowrap/base'
2
+
3
+ module Echowrap
4
+ class YearsActive < Echowrap::Base
5
+ attr_reader :start
6
+
7
+ end
8
+ end
data/lib/echowrap.rb ADDED
@@ -0,0 +1,78 @@
1
+ require 'echowrap/analysis'
2
+ require 'echowrap/artist'
3
+ require 'echowrap/asset'
4
+ require 'echowrap/biography'
5
+ require 'echowrap/blog'
6
+ require 'echowrap/audio_summary'
7
+ require 'echowrap/call_list'
8
+ require 'echowrap/category_map'
9
+ require 'echowrap/client'
10
+ require 'echowrap/configurable'
11
+ require 'echowrap/doc_counts'
12
+ require 'echowrap/echonest_id'
13
+ require 'echowrap/error'
14
+ require 'echowrap/familiarity'
15
+ require 'echowrap/feed'
16
+ require 'echowrap/foreign_id'
17
+ require 'echowrap/hotttnesss'
18
+ require 'echowrap/genre'
19
+ require 'echowrap/keyvalues'
20
+ require 'echowrap/image'
21
+ require 'echowrap/item'
22
+ require 'echowrap/item_request'
23
+ require 'echowrap/location'
24
+ require 'echowrap/license'
25
+ require 'echowrap/meta'
26
+ require 'echowrap/news_article'
27
+ require 'echowrap/options'
28
+ require 'echowrap/playlist'
29
+ require 'echowrap/prediction'
30
+ require 'echowrap/rate_limit'
31
+ require 'echowrap/reference'
32
+ require 'echowrap/review'
33
+ require 'echowrap/rule'
34
+ require 'echowrap/seeds'
35
+ require 'echowrap/sequenced_data'
36
+ require 'echowrap/sequenced_data/bar'
37
+ require 'echowrap/sequenced_data/beat'
38
+ require 'echowrap/sequenced_data/section'
39
+ require 'echowrap/sequenced_data/segment'
40
+ require 'echowrap/sequenced_data/tatum'
41
+ require 'echowrap/sandbox'
42
+ require 'echowrap/song'
43
+ require 'echowrap/status'
44
+ require 'echowrap/taste_profile'
45
+ require 'echowrap/term'
46
+ require 'echowrap/track'
47
+ require 'echowrap/update_info'
48
+ require 'echowrap/urls'
49
+ require 'echowrap/version'
50
+ require 'echowrap/video'
51
+ require 'echowrap/years_active'
52
+
53
+
54
+ module Echowrap
55
+ class << self
56
+ include Echowrap::Configurable
57
+
58
+ # Delegate to a Echowrap::Client
59
+ #
60
+ # @return [Echowrap::Client]
61
+ def client
62
+ @client = Echowrap::Client.new(options) unless defined?(@client) && @client.hash == options.hash
63
+ @client
64
+ end
65
+
66
+ def respond_to_missing?(method_name, include_private=false); client.respond_to?(method_name, include_private); end if RUBY_VERSION >= "1.9"
67
+ def respond_to?(method_name, include_private=false); client.respond_to?(method_name, include_private) || super; end if RUBY_VERSION < "1.9"
68
+
69
+ private
70
+
71
+ def method_missing(method_name, *args, &block)
72
+ return super unless client.respond_to?(method_name)
73
+ client.send(method_name, *args, &block)
74
+ end
75
+ end
76
+ end
77
+
78
+ Echowrap.setup