echowrap 0.0.1

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.
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,387 @@
1
+ require 'echowrap/api/utils'
2
+
3
+ module Echowrap
4
+ module API
5
+ module Artist
6
+ include Echowrap::API::Utils
7
+
8
+ # Get a list of artist biographies.
9
+ #
10
+ # @see http://developer.echonest.com/docs/v4/artist.html#biographies
11
+ # @authentication Requires api key
12
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid. # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
13
+ # @return [Array<Echowrap::Biography>]
14
+ # @param options [Hash] A customizable set of options.
15
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
16
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
17
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
18
+ # @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
19
+ # @option options [String] :license The desired license of the returned images. Not required, can send multiple, must be one of ['echo-source', 'all-rights-reserved', 'cc-by-sa', 'cc-by-nc', 'cc-by-nc-nd', 'cc-by-nc-sa', 'cc-by-nd', 'cc-by', 'public-domain', 'unknown'].
20
+ # @example Biographies via id
21
+ # Echowrap.artist_biographies(:id => 'ARH6W4X1187B99274F')
22
+ def artist_biographies(options={})
23
+ objects_from_response(Echowrap::Biography, :get, '/api/v4/artist/biographies', :biographies, options)
24
+ end
25
+
26
+ # Get a list of artist blogs.
27
+ #
28
+ # @see http://developer.echonest.com/docs/v4/artist.html#blogs
29
+ # @authentication Requires api key
30
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid. # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
31
+ # @return [Array<Echowrap::Blog>]
32
+ # @param options [Hash] A customizable set of options.
33
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
34
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
35
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
36
+ # @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
37
+ # @option options [String] :high_relevance If true only items that are highly relevant for this artist will be returned. Not require, must be one of ['true', 'false'].
38
+ # @example blogs via id
39
+ # Echowrap.artist_blogs(:id => 'ARH6W4X1187B99274F')
40
+ def artist_blogs(options={})
41
+ objects_from_response(Echowrap::Blog, :get, '/api/v4/artist/blogs', :blogs, options)
42
+ end
43
+
44
+ # Extract artist names from text.
45
+ #
46
+ # @see http://developer.echonest.com/docs/v4/artist.html#extract-beta
47
+ # @authentication Requires api key
48
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
49
+ # @param options [Hash] A customizable set of options.
50
+ # @option options [String] :bucket Indicates what data should be returned with each artist. Not required, may send multiple, must be one of ['biographies', 'blogs', 'doc_counts', 'familiarity', 'hotttnesss', 'images', 'artist_location', 'news', 'reviews', 'songs', 'terms', 'urls', 'video', 'years_active', 'id:Rosetta-space']. Example: 'songs'.
51
+ # @option options [String] :limit If 'true' limit the results to any of the given idspaces or catalogs. Not required, defaults to 'false'.
52
+ # @option options [String] :text Text that contains artist names. Not required. Example: 'Siriusmo is my favorite, but I also like hrvatski'.
53
+ # @option options [Float] :max_familiarity The maximum familiarity for the artist, the valid range for max_familiairty is 0.0 to 1.0, with 1.0 as default.
54
+ # @option options [Float] :min_familiarity The minimum famliiarity for the artist, the valid range for min_familiarity is 1.0 to 0.0, with 0.0 as default.
55
+ # @option options [Float] :max_hotttnesss The maximum hotttnesss of any artist's artist, the valid range for artist_max_hotttnesss is 0.0 to 1.0, with 1.0 as default.
56
+ # @option options [Float] :min_hotttnesss The minimum hotttnesss of any artist's artist, the valid range for the artist_min_hotttnesss is 0.0 to 1.0, with 0.0 as default.
57
+ # @option options [String] :sort Indicates how the artists results should be ordered. Must be one of ['familiarity-asc', 'hotttnesss-asc', 'familiarity-desc', 'hotttnesss-desc', 'artist_start_year-asc', 'artist_start_year-desc', 'artist_end_year-asc', 'artist_end_year-desc', 'artist_start_year-asc', 'artist_start_year-desc', 'artist_end_year-asc', 'artist_end_year-desc'].
58
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
59
+ # @return [Array<Echowrap::artist>]
60
+ # @example Return an array of artists with artist 'Daft Punk'
61
+ # Echowrap.artist_search(:artist => "Daft Punk")
62
+ def artist_extract(options={})
63
+ objects_from_response(Echowrap::Artist, :get, '/api/v4/artist/extract', :artists, options)
64
+ end
65
+ # Get numerical estimation of how familiar an artist currently is to the world.
66
+ #
67
+ # @see http://developer.echonest.com/docs/v4/artist.html#familiarity
68
+ # @authentication Requires api key
69
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid. # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
70
+ # @return [Echowrap::Familiarity]
71
+ # @param options [Hash] A customizable set of options.
72
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
73
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
74
+ # @example familiarity via id
75
+ # Echowrap.artist_familiarity(:id => 'ARH6W4X1187B99274F')
76
+ def artist_familiarity(options={})
77
+ object_from_response(Echowrap::Familiarity, :get, '/api/v4/artist/familiarity', :artist, options)
78
+ end
79
+
80
+ # Get numerical description of how hottt an artist currently is.
81
+ #
82
+ # @see http://developer.echonest.com/docs/v4/artist.html#hotttnesss
83
+ # @authentication Requires api key
84
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid. # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
85
+ # @return [Echowrap::Hotttnesss]
86
+ # @param options [Hash] A customizable set of options.
87
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
88
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
89
+ # @example hotttnesss via id
90
+ # Echowrap.artist_hotttnesss(:id => 'ARH6W4X1187B99274F')
91
+ def artist_hotttnesss(options={})
92
+ object_from_response(Echowrap::Hotttnesss, :get, '/api/v4/artist/hotttnesss', :artist, options)
93
+ end
94
+
95
+ # Get a list of artist images.
96
+ #
97
+ # @see http://developer.echonest.com/docs/v4/artist.html#images
98
+ # @authentication Requires api key
99
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
100
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
101
+ # @return [Array<Echowrap::Image>]
102
+ # @param options [Hash] A customizable set of options.
103
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
104
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
105
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
106
+ # @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
107
+ # @option options [String] :license The desired license of the returned images. Not required, can send multiple, must be one of ['echo-source', 'all-rights-reserved', 'cc-by-sa', 'cc-by-nc', 'cc-by-nc-nd', 'cc-by-nc-sa', 'cc-by-nd', 'cc-by', 'public-domain', 'unknown'].
108
+ # @example images via id
109
+ # Echowrap.artist_images(:id => 'ARH6W4X1187B99274F')
110
+ def artist_images(options={})
111
+ objects_from_response(Echowrap::Image, :get, '/api/v4/artist/images', :images, options)
112
+ end
113
+
114
+ # Get a list of the available genres for use with search and playlisting. This method returns a list of genres suitable for use in the artist/search call when searching by description and for the creation of genre-radio playlists. The returned list of genres is inclusive of all supported genres.
115
+ #
116
+ # @see http://developer.echonest.com/docs/v4/artist.html#genres
117
+ # @authentication Requires api key
118
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
119
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
120
+ # @param options [Hash] A customizable set of options.
121
+ # @return [Array<Echowrap::Genre>]
122
+ # @param options [Hash] A customizable set of options.
123
+ # @example artist_list_genres
124
+ # Echowrap.artist_list_genres
125
+ def artist_list_genres(options={})
126
+ objects_from_response(Echowrap::Genre, :get, '/api/v4/artist/list_genres', :genres, options)
127
+ end
128
+
129
+ # Get a list of the available terms for use with search and playlisting. This method returns a list of genres suitable for use in the artist/search call when searching by description and for the creation of genre-radio playlists. The returned list of genres is inclusive of all supported genres.
130
+ #
131
+ # @see http://developer.echonest.com/docs/v4/artist.html#terms
132
+ # @authentication Requires api key
133
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
134
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
135
+ # @param options [Hash] A customizable set of options.
136
+ # @option options [String] :type The type of term that is of interest. Not required, must be one of ['style', 'mood'].
137
+ # @return [Array<Echowrap::term>]
138
+ # @param options [Hash] A customizable set of options.
139
+ # @example artist_list_terms
140
+ # Echowrap.artist_list_terms
141
+ def artist_list_terms(options={})
142
+ objects_from_response(Echowrap::Term, :get, '/api/v4/artist/list_terms', :terms, options)
143
+ end
144
+
145
+ # Get a list of news articles found on the web related to an artist.
146
+ #
147
+ # @see http://developer.echonest.com/docs/v4/artist.html#news
148
+ # @authentication Requires api key
149
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid. # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
150
+ # @return [Array<Echowrap::NewsArticle>]
151
+ # @param options [Hash] A customizable set of options.
152
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
153
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
154
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
155
+ # @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
156
+ # @option options [String] :high_relevance If true only items that are highly relevant for this artist will be returned. Not require, must be one of ['true', 'false'].
157
+ # @example news via id
158
+ # Echowrap.artist_news(:id => 'ARH6W4X1187B99274F')
159
+ def artist_news(options={})
160
+ objects_from_response(Echowrap::NewsArticle, :get, '/api/v4/artist/news', :news, options)
161
+ end
162
+
163
+ # Get basic information about an artist.
164
+ #
165
+ # @see http://developer.echonest.com/docs/v4/artist.html
166
+ # @authentication Requires api key
167
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
168
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
169
+ # @return [Echowrap::artist] The artist.
170
+ # @param options [Hash] A customizable set of options.
171
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'SOCZMFK12AC468668F'.
172
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
173
+ # @option options [String] :bucket The type of track data that should be returned. Not required, can send multiple, may be any of ['biographies', 'blogs', 'doc_counts', 'familiarity', 'hotttnesss', 'images', 'artist_location', 'news', 'reviews', 'songs', 'terms', 'urls', 'video', 'years_active', 'id:rosetta-stone'].
174
+ # @example Profile via id
175
+ # Echowrap.artist_profile(:id => 'SOCZMFK12AC468668F')
176
+ def artist_profile(options={})
177
+ object_from_response(Echowrap::Artist, :get, '/api/v4/artist/profile', :artist, options)
178
+ end
179
+
180
+ # Search for artists given different query types
181
+ #
182
+ # @see http://developer.echonest.com/docs/v4/artist.html
183
+ # @authentication Requires api key
184
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
185
+ # @param options [Hash] A customizable set of options.
186
+ # @option options [String] :bucket Indicates what data should be returned with each artist. Not required, may send multiple, must be one of ['biographies', 'blogs', 'doc_counts', 'familiarity', 'hotttnesss', 'images', 'artist_location', 'news', 'reviews', 'songs', 'terms', 'urls', 'video', 'years_active', 'id:Rosetta-space']. Example: 'songs'.
187
+ # @option options [String] :limit If 'true' limit the results to any of the given idspaces or catalogs. Not required, defaults to 'false'.
188
+ # @option options [String] :artist_location The name of the location of interest. Not required, location names can optionally be qualified with a type specifier of 'city', 'region', 'city'. Example: 'boston', 'boston+ma+us', 'city:washington', 'region:washington', 'country:united+states'.
189
+ # @option options [String] :name The name of the artist to search for. Not required. Example: 'radiohead'.
190
+ # @option options [String] :description A description of the artist, Warning Description cannot be used in conjunction with title, artist, combined, or artist_id. Not required, cannot be combined with 'name'. Examples: 'alt-rock','-emo', 'harp^2'. See http://developer.echonest.com/docs/v4/artist.html#search for more examples.
191
+ # @option options [String] :genre A musical genre like rock, jazz, or funky. Not required, may send multiple. Examples are: 'jazz', 'metal'.
192
+ # @option options [String] :style A musical style like rock, jazz, or funky. Not required, may send multiple. Examples are: 'jazz', 'metal^2'.
193
+ # @option options [String] :mood A mood like happy or sad, some examples are: 'happy', 'sad^.5'.
194
+ # @option options [String] :rank_type For search by description, style or mood indicates whether results should be ranked by query relevance or by artist familiarity, must be one of ['relevance', 'familiarity'], with 'relevance' as default
195
+ # @option options [String] :fuzzy_match If 'true', a fuzzy match is performed. Not required, must be one of ['true', 'false'].
196
+ # @option options [Float] :max_familiarity The maximum familiarity for the artist, the valid range for max_familiairty is 0.0 to 1.0, with 1.0 as default.
197
+ # @option options [Float] :min_familiarity The minimum famliiarity for the artist, the valid range for min_familiarity is 1.0 to 0.0, with 0.0 as default.
198
+ # @option options [Float] :max_hotttnesss The maximum hotttnesss of any artist's artist, the valid range for artist_max_hotttnesss is 0.0 to 1.0, with 1.0 as default.
199
+ # @option options [Float] :min_hotttnesss The minimum hotttnesss of any artist's artist, the valid range for the artist_min_hotttnesss is 0.0 to 1.0, with 0.0 as default.
200
+ # @option options [String] :artist_start_year_before Matches artists that have an earliest start year before the given value, some examples are '1970', '2011', 'present'.
201
+ # @option options [String] :artist_start_year_after Matches artists that have an earliest start year after the given value, some examples are '1970', '2011', 'present'.
202
+ # @option options [String] :artist_end_year_before Matches artists that have an latest start year before the given value, some examples are '1970', '2011', 'present'.
203
+ # @option options [String] :artist_end_year_after Matches artists that have an latest start year after the given value, some examples are '1970', '2011', 'present'.
204
+ # @option options [String] :sort Indicates how the artists results should be ordered. Must be one of ['familiarity-asc', 'hotttnesss-asc', 'familiarity-desc', 'hotttnesss-desc', 'artist_start_year-asc', 'artist_start_year-desc', 'artist_end_year-asc', 'artist_end_year-desc', 'artist_start_year-asc', 'artist_start_year-desc', 'artist_end_year-asc', 'artist_end_year-desc'].
205
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
206
+ # @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
207
+ # @return [Array<Echowrap::artist>]
208
+ # @example Return an array of artists with artist 'Daft Punk'
209
+ # Echowrap.artist_search(:artist => "Daft Punk")
210
+ def artist_search(options={})
211
+ objects_from_response(Echowrap::Artist, :get, '/api/v4/artist/search', :artists, options)
212
+ end
213
+
214
+ # @see http://developer.echonest.com/docs/v4/artist.html#reviews
215
+ # @authentication Requires api key
216
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
217
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
218
+ # @return [Array<Echowrap::Review>]
219
+ # @param options [Hash] A customizable set of options.
220
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
221
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
222
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
223
+ # @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
224
+ # @example reviews via id
225
+ # Echowrap.artist_reviews(:id => 'ARH6W4X1187B99274F')
226
+ def artist_reviews(options={})
227
+ objects_from_response(Echowrap::Review, :get, '/api/v4/artist/reviews', :reviews, options)
228
+ end
229
+
230
+ # Return similar artists given one or more artists for comparison. The Echo Nest provides up-to-the-minute artist similarity and recommendations from their real-time musical and cultural analysis of what people are saying across the Internet and what the music sounds like.
231
+ #
232
+ # @see http://developer.echonest.com/docs/v4/artist.html#similar
233
+ # @authentication Requires api key
234
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
235
+ # @param options [Hash] A customizable set of options.
236
+ # @option options [String] :name The name of the artist to search for. Not required. Example: 'radiohead'.
237
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
238
+ # @option options [Integer] :min_results Indicates the minimum number of results to be returned regardless of constraints, the valid range is 0 to 100, with 15 as the default
239
+ # @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
240
+ # @option options [String] :bucket Indicates what data should be returned with each artist. Not required, may send multiple, must be one of ['biographies', 'blogs', 'doc_counts', 'familiarity', 'hotttnesss', 'images', 'artist_location', 'news', 'reviews', 'songs', 'terms', 'urls', 'video', 'years_active', 'id:Rosetta-space']. Example: 'songs'.
241
+ # @option options [Float] :max_familiarity The maximum familiarity for the artist, the valid range for max_familiairty is 0.0 to 1.0, with 1.0 as default.
242
+ # @option options [Float] :min_familiarity The minimum famliiarity for the artist, the valid range for min_familiarity is 1.0 to 0.0, with 0.0 as default.
243
+ # @option options [Float] :max_hotttnesss The maximum hotttnesss of any artist's artist, the valid range for artist_max_hotttnesss is 0.0 to 1.0, with 1.0 as default.
244
+ # @option options [Float] :min_hotttnesss The minimum hotttnesss of any artist's artist, the valid range for the artist_min_hotttnesss is 0.0 to 1.0, with 0.0 as default.
245
+ # @option options [String] :artist_start_year_before Matches artists that have an earliest start year before the given value, some examples are '1970', '2011', 'present'.
246
+ # @option options [String] :artist_start_year_after Matches artists that have an earliest start year after the given value, some examples are '1970', '2011', 'present'.
247
+ # @option options [String] :artist_end_year_before Matches artists that have an latest start year before the given value, some examples are '1970', '2011', 'present'.
248
+ # @option options [String] :artist_end_year_after Matches artists that have an latest start year after the given value, some examples are '1970', '2011', 'present'.
249
+ # @option options [String] :limit If 'true' limit the results to any of the given idspaces or catalogs. Not required, defaults to 'false'.
250
+ # @option options [String] :seed_catalog Only give similars to those in a catalog or catalogs, An Echo Nest artist catalog identifier. Muliple are allowed, up to 5, example: 'CAKSMUX1321A708AA4'.
251
+ # @return [Array<Echowrap::artist>]
252
+ # @example Return an array of artists with artist 'Daft Punk'
253
+ # Echowrap.artist_similar(:name => "Daft Punk")
254
+ def artist_similar(options={})
255
+ objects_from_response(Echowrap::Artist, :get, '/api/v4/artist/similar', :artists, options)
256
+ end
257
+
258
+ # @see http://developer.echonest.com/docs/v4/artist.html#songs
259
+ # @authentication Requires api key
260
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
261
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
262
+ # @return [Array<Echowrap::Song>]
263
+ # @param options [Hash] A customizable set of options.
264
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
265
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
266
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
267
+ # @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
268
+ # @example songs via id
269
+ # Echowrap.artist_songs(:id => 'ARH6W4X1187B99274F')
270
+ def artist_songs(options={})
271
+ objects_from_response(Echowrap::Song, :get, '/api/v4/artist/songs', :songs, options)
272
+ end
273
+
274
+ # Suggest artists based upon partial names. This method will return a list of potential artist matches based upon a query string. The method returns the most familiar best matching artist for the query.
275
+ #
276
+ # @see http://developer.echonest.com/docs/v4/artist.html#suggest
277
+ # @authentication Requires api key
278
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
279
+ # @param options [Hash] A customizable set of options.
280
+ # @option options [String] :name A partial artist name. Not required. Examples: ["r", "rad", "radioh"].
281
+ # @option options [String] :q A partial artist name (an alias for 'name', to be jQuery friendly). Not required. Examples: ["r", "rad", "radioh"].
282
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
283
+ # @return [Array<Echowrap::artist>]
284
+ # @example Return an array of artists with artist 'Daft Pu'
285
+ # Echowrap.artist_suggest(:name => "Daft Pu")
286
+ def artist_suggest(options={})
287
+ objects_from_response(Echowrap::Artist, :get, '/api/v4/artist/suggest', :artists, options)
288
+ end
289
+
290
+ # Get a list of most descriptive terms for an artist
291
+ #
292
+ # @see http://developer.echonest.com/docs/v4/artist.html#terms
293
+ # @authentication Requires api key
294
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
295
+ # @param options [Hash] A customizable set of options.
296
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
297
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
298
+ # @option options [String] :sort Sort terms based upon weight or frequency. Not required, must be one of ['weight', 'frequency'], with 'frequency' as default.
299
+ # @return [Array<Echowrap::Term>]
300
+ # @example Return an array of terms with name 'Daft Punk'
301
+ # Echowrap.artist_terms(:name => "Daft Punk")
302
+ def artist_terms(options={})
303
+ objects_from_response(Echowrap::Term, :get, '/api/v4/artist/terms', :terms, options)
304
+ end
305
+
306
+ # Return a list of the top hottt artists.
307
+ #
308
+ # @see http://developer.echonest.com/docs/v4/artist.html#top_hottt
309
+ # @authentication Requires api key
310
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
311
+ # @param options [Hash] A customizable set of options.
312
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
313
+ # @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
314
+ # @option options [String] :genre A musical genre like rock, jazz, or funky. Not required, may send multiple. Examples are: 'jazz', 'metal'.
315
+ # @option options [String] :bucket Indicates what data should be returned with each artist. Not required, may send multiple, must be one of ['biographies', 'blogs', 'doc_counts', 'familiarity', 'hotttnesss', 'images', 'artist_location', 'news', 'reviews', 'songs', 'terms', 'urls', 'video', 'years_active', 'id:Rosetta-space']. Example: 'songs'.
316
+ # @option options [String] :limit If 'true' limit the results to any of the given idspaces or catalogs. Not required, defaults to 'false'.
317
+ # @return [Array<Echowrap::Artist>]
318
+ # @example Return an array of artists with top genre 'dance'
319
+ # Echowrap.artist_top_hottt(:genre => "dance")
320
+ def artist_top_hottt(options={})
321
+ objects_from_response(Echowrap::Artist, :get, '/api/v4/artist/top_hottt', :artists, options)
322
+ end
323
+
324
+ # Returns a list of the overall top terms.
325
+ #
326
+ # @see http://developer.echonest.com/docs/v4/artist.html#top_terms
327
+ # @authentication Requires api key
328
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
329
+ # @param options [Hash] A customizable set of options.
330
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
331
+ # @return [Array<Echowrap::Term>]
332
+ # @example Return an array of terms
333
+ # Echowrap.artist_top_terms
334
+ def artist_top_terms(options={})
335
+ objects_from_response(Echowrap::Term, :get, '/api/v4/artist/top_terms', :terms, options)
336
+ end
337
+
338
+ # Gets the twitter handle for an artist
339
+ #
340
+ # @see http://developer.echonest.com/docs/v4/artist.html#twitter
341
+ # @authentication Requires api key
342
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
343
+ # @param options [Hash] A customizable set of options.
344
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
345
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
346
+ # @return [Array<Echowrap::Term>]
347
+ # @example Return an artist with name of 'Daft Punk'
348
+ # Echowrap.artist_twitter(:name => "Daft Punk")
349
+ def artist_twitter(options={})
350
+ object_from_response(Echowrap::Artist, :get, '/api/v4/artist/twitter', :artist, options)
351
+ end
352
+
353
+ # Get links to the artist's official site, MusicBrainz site, MySpace site, Wikipedia article, Amazon list, and iTunes page.
354
+ #
355
+ # @see http://developer.echonest.com/docs/v4/artist.html#urls
356
+ # @authentication Requires api key
357
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
358
+ # @param options [Hash] A customizable set of options.
359
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
360
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
361
+ # @return [Array<Echowrap::Urls>]
362
+ # @example Return urls for artist with name of 'Daft Punk'
363
+ # Echowrap.artist_urls(:name => "Daft Punk")
364
+ def artist_urls(options={})
365
+ object_from_response(Echowrap::Urls, :get, '/api/v4/artist/urls', :urls, options)
366
+ end
367
+
368
+ # Get a list of video documents found on the web related to an artist.
369
+ # @see http://developer.echonest.com/docs/v4/artist.html#video
370
+ # @authentication Requires api key
371
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
372
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
373
+ # @return [Array<Echowrap::Video>]
374
+ # @param options [Hash] A customizable set of options.
375
+ # @option options [String] :id The ID of the artist. Required if name is not provided. Example: 'ARH6W4X1187B99274F'.
376
+ # @option options [String] :name The name of the artist. Required if id is not provided. Example: 'Weezer'.
377
+ # @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
378
+ # @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
379
+ # @example video via id
380
+ # Echowrap.artist_video(:id => 'ARH6W4X1187B99274F')
381
+ def artist_video(options={})
382
+ objects_from_response(Echowrap::Video, :get, '/api/v4/artist/video', :video, options)
383
+ end
384
+
385
+ end
386
+ end
387
+ end
@@ -0,0 +1,25 @@
1
+ require 'echowrap/api/utils'
2
+
3
+ module Echowrap
4
+ module API
5
+ module Oauth
6
+ include Echowrap::API::Utils
7
+
8
+ # Returns the current time of The Echo Nest API server. This time can be used to synchronize the local time with The Echo Nest allowing you to set a proper timestamp used generate authenticated requests to the API. This call returns the number of seconds elapsed since midnight, 1 January 1970.
9
+ # @see http://developer.echonest.com/docs/v4/oauth.html#timestamp
10
+ # @authentication Requires api key
11
+ # @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
12
+ # @return [Integer]
13
+ # @param options [Hash] A customizable set of options.
14
+ #
15
+ # @return [Integer]
16
+ # @example Return integer timestamp
17
+ # Echowrap.oauth_timestamp
18
+ def oauth_timestamp(options={})
19
+ response = send(:get, '/api/v4/oauth/timestamp', options)
20
+ response[:body][:response][:current_time]
21
+ end
22
+
23
+ end
24
+ end
25
+ end