echonest-ruby-api 0.2.1 → 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6973ea1d95b1e5b83d0f9c141f3b9dcc90e55493
4
+ data.tar.gz: ab72b549e5e177393998f4c157dac3feb7a12b9e
5
+ SHA512:
6
+ metadata.gz: 241b76c80fb7257379988a8858fbc3dfa3c49bef444c76d8673d2fca2f507adf9a220416e7b45144ec8d60837051db4c2c29b48c1b43812e8e1915f9ce435efb
7
+ data.tar.gz: c5cda9d1dcf0885d13e620ddfdfa42099f3bd8ff689fb1717261f85555aea4d6ae600a4780723dc7c70a9755ecc8aadb5bddb996952356f6e88fbc3a15b6c167
data/README.md CHANGED
@@ -14,7 +14,9 @@
14
14
 
15
15
  In your Gemfile:
16
16
 
17
- gem 'echonest-ruby-api'
17
+ ```ruby
18
+ gem 'echonest-ruby-api'
19
+ ```
18
20
 
19
21
  and then `bundle install`
20
22
 
@@ -27,23 +29,29 @@ Or install locally:
27
29
 
28
30
  Require the gem in your file:
29
31
 
30
- require 'echonest-ruby-api'
32
+ ```ruby
33
+ require 'echonest-ruby-api'
34
+ ```
31
35
 
32
36
  ## Artist
33
37
 
34
38
  Create an instance of an object
35
39
 
36
- artist = Echonest::Artist.new('YOUR-API-KEY', 'Weezer')
40
+ ```ruby
41
+ artist = Echonest::Artist.new('YOUR-API-KEY', 'Weezer')
42
+ ```
37
43
 
38
44
  Then you have access to a bunch of methods:
39
45
 
40
- artist.name
41
- artist.biographies
42
- artist.blogs
43
- artist.familiarity
44
- artist.hotttnesss
45
- artist.images
46
- artist.songs
46
+ ```ruby
47
+ artist.name
48
+ artist.biographies
49
+ artist.blogs
50
+ artist.familiarity
51
+ artist.hotttnesss
52
+ artist.images
53
+ artist.songs
54
+ ```
47
55
 
48
56
  *Exact response are specified in the RDoc but the method names try to be as self-explanatory as possible.*
49
57
 
@@ -51,13 +59,17 @@ Then you have access to a bunch of methods:
51
59
 
52
60
  Create an instance of the Song module.
53
61
 
54
- song = Echonest::Song.new('YOUR-API-KEY')
62
+ ```ruby
63
+ song = Echonest::Song.new('YOUR-API-KEY')
64
+ ```
55
65
 
56
66
  Then you have access to the song/search endpoint:
57
67
  *(this is where it gets clever)*
58
68
 
59
- params = { mood: "sad^.5", results: 10, min_tempo: 130, max_tempo: 150 }
60
- song.search(params)
69
+ ```ruby
70
+ params = { mood: "sad^.5", results: 10, min_tempo: 130, max_tempo: 150 }
71
+ song.search(params)
72
+ ```
61
73
 
62
74
  See the full list of params [here](http://developer.echonest.com/docs/v4/song.html#search)
63
75
 
@@ -90,31 +102,35 @@ This should then allow you to use the `echoprint-codegen` command at the command
90
102
 
91
103
  Then just use this method call:
92
104
 
93
- song = Echonest::Song.new('YOUR-API-KEY')
94
- code = song.echoprint_code('path/to/audio/file')
95
- puts code.identify(code)
105
+ ```ruby
106
+ song = Echonest::Song.new('YOUR-API-KEY')
107
+ code = song.echoprint_code('path/to/audio/file')
108
+ puts song.identify(code)
109
+ ```
96
110
 
97
111
  If there's a positive match, it'll return something like this:
98
112
 
99
- {
100
- "response": {
101
- "status": {
102
- "code": 0,
103
- "message": "Success",
104
- "version": "4.2"
105
- },
106
- "songs": [
107
- {
108
- "title": "Billie Jean",
109
- "artist_name": "Michael Jackson",
110
- "artist_id": "ARXPPEY1187FB51DF4",
111
- "score": 49,
112
- "message": "OK (match type 5)",
113
- "id": "SOKHYNL12A8C142FC7"
114
- }
115
- ]
113
+ ```ruby
114
+ {
115
+ "response": {
116
+ "status": {
117
+ "code": 0,
118
+ "message": "Success",
119
+ "version": "4.2"
120
+ },
121
+ "songs": [
122
+ {
123
+ "title": "Billie Jean",
124
+ "artist_name": "Michael Jackson",
125
+ "artist_id": "ARXPPEY1187FB51DF4",
126
+ "score": 49,
127
+ "message": "OK (match type 5)",
128
+ "id": "SOKHYNL12A8C142FC7"
116
129
  }
117
- }
130
+ ]
131
+ }
132
+ }
133
+ ```
118
134
 
119
135
  Checkout `spec/song_spec.rb` for an example code to test it out.
120
136
 
@@ -132,3 +148,8 @@ Testing is done using RSpec. Just run `guard` in the root directory and it'll ru
132
148
  * jordanpoulton
133
149
  * makersacademy
134
150
  * deadroxy
151
+ * [Devon Blandin](https://github.com/dblandin)
152
+
153
+
154
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/maxehmookau/echonest-ruby-api/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
155
+
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://developer.echonest.com/api/v4/artist/hotttnesss?api_key=BNOAEBT3IZYZI6WXI&format=json&name=Weezer
5
+ uri: http://developer.echonest.com/api/v4/artist/hotttnesss?api_key=BNOAEBT3IZYZI6WXI&format=json&name=Weezer&type=overall
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -13,38 +13,203 @@ http_interactions:
13
13
  message: OK
14
14
  headers:
15
15
  Date:
16
- - Sat, 23 Feb 2013 13:05:46 GMT
16
+ - Mon, 02 Sep 2013 00:30:28 GMT
17
17
  Content-Type:
18
18
  - application/json; charset=utf-8
19
+ Content-Length:
20
+ - '170'
21
+ Vary:
22
+ - Accept-Encoding
23
+ X-Request-Id:
24
+ - eDP46hPZRBW057iKbKSE1A
25
+ Etag:
26
+ - ! '"db4a58343e66279b7a1d0a879e3aa2b619395963"'
27
+ X-Worker-Node:
28
+ - d1c7d:30417
29
+ X-Ratelimit-Remaining:
30
+ - '17'
31
+ Server:
32
+ - TornadoServer/3.0.1
33
+ X-Ratelimit-Limit:
34
+ - '20'
35
+ X-Api-Key:
36
+ - BNOAEBT3IZYZI6WXI
37
+ Cache-Control:
38
+ - max-age=86400
39
+ Access-Control-Allow-Origin:
40
+ - ! '*'
41
+ X-Ratelimit-Used:
42
+ - '3'
19
43
  Connection:
20
- - keep-alive
44
+ - Keep-alive
45
+ Keep-Alive:
46
+ - timeout=15, max=100
47
+ Via:
48
+ - 1.1 ID-0000627501223666 uproxy-3
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ! '{"response": {"status": {"version": "4.2", "code": 0, "message":
52
+ "Success"}, "artist": {"hotttnesss": 0.74428000000000005, "id": "AR633SY1187B9AC3B9",
53
+ "name": "Weezer"}}}'
54
+ http_version:
55
+ recorded_at: Mon, 02 Sep 2013 00:30:30 GMT
56
+ - request:
57
+ method: get
58
+ uri: http://developer.echonest.com/api/v4/artist/hotttnesss?api_key=BNOAEBT3IZYZI6WXI&format=json&name=Weezer&type=social
59
+ body:
60
+ encoding: US-ASCII
61
+ string: ''
62
+ headers: {}
63
+ response:
64
+ status:
65
+ code: 200
66
+ message: OK
67
+ headers:
68
+ Date:
69
+ - Mon, 02 Sep 2013 00:30:28 GMT
70
+ Content-Type:
71
+ - application/json; charset=utf-8
72
+ Content-Length:
73
+ - '170'
21
74
  Vary:
22
75
  - Accept-Encoding
23
76
  X-Request-Id:
24
- - MOIIYqqCTpW0LxylRaQ7wA
77
+ - weNnCgizTGSZYaCeLZ2p7w
25
78
  Etag:
26
- - ! '"5826c5479542eca3a88f60adc26bf81874f65939"'
79
+ - ! '"db4a58343e66279b7a1d0a879e3aa2b619395963"'
27
80
  X-Worker-Node:
28
- - c125c:9835
81
+ - 04371:24564
82
+ X-Ratelimit-Remaining:
83
+ - '16'
84
+ Server:
85
+ - TornadoServer/3.0.1
86
+ X-Ratelimit-Limit:
87
+ - '20'
88
+ X-Api-Key:
89
+ - BNOAEBT3IZYZI6WXI
90
+ Cache-Control:
91
+ - max-age=86400
92
+ Access-Control-Allow-Origin:
93
+ - ! '*'
94
+ X-Ratelimit-Used:
95
+ - '4'
96
+ Connection:
97
+ - Keep-alive
98
+ Keep-Alive:
99
+ - timeout=15, max=100
100
+ Via:
101
+ - 1.1 ID-0000627501223666 uproxy-2
102
+ body:
103
+ encoding: US-ASCII
104
+ string: ! '{"response": {"status": {"version": "4.2", "code": 0, "message":
105
+ "Success"}, "artist": {"hotttnesss": 0.74428000000000005, "id": "AR633SY1187B9AC3B9",
106
+ "name": "Weezer"}}}'
107
+ http_version:
108
+ recorded_at: Mon, 02 Sep 2013 00:30:30 GMT
109
+ - request:
110
+ method: get
111
+ uri: http://developer.echonest.com/api/v4/artist/hotttnesss?api_key=BNOAEBT3IZYZI6WXI&format=json&name=Weezer&type=reviews
112
+ body:
113
+ encoding: US-ASCII
114
+ string: ''
115
+ headers: {}
116
+ response:
117
+ status:
118
+ code: 200
119
+ message: OK
120
+ headers:
121
+ Date:
122
+ - Mon, 02 Sep 2013 00:30:28 GMT
123
+ Content-Type:
124
+ - application/json; charset=utf-8
29
125
  Content-Length:
30
126
  - '170'
127
+ Vary:
128
+ - Accept-Encoding
129
+ X-Request-Id:
130
+ - rtJhZrvPSeG6AxEz+mZDqQ
131
+ Etag:
132
+ - ! '"db4a58343e66279b7a1d0a879e3aa2b619395963"'
133
+ X-Worker-Node:
134
+ - a0306:17448
31
135
  X-Ratelimit-Remaining:
136
+ - '15'
137
+ Server:
138
+ - TornadoServer/3.0.1
139
+ X-Ratelimit-Limit:
32
140
  - '20'
141
+ X-Api-Key:
142
+ - BNOAEBT3IZYZI6WXI
143
+ Cache-Control:
144
+ - max-age=86400
145
+ Access-Control-Allow-Origin:
146
+ - ! '*'
147
+ X-Ratelimit-Used:
148
+ - '5'
149
+ Connection:
150
+ - Keep-alive
151
+ Keep-Alive:
152
+ - timeout=15, max=100
153
+ Via:
154
+ - 1.1 ID-0000627501223666 uproxy-3
155
+ body:
156
+ encoding: US-ASCII
157
+ string: ! '{"response": {"status": {"version": "4.2", "code": 0, "message":
158
+ "Success"}, "artist": {"hotttnesss": 0.74428000000000005, "id": "AR633SY1187B9AC3B9",
159
+ "name": "Weezer"}}}'
160
+ http_version:
161
+ recorded_at: Mon, 02 Sep 2013 00:30:30 GMT
162
+ - request:
163
+ method: get
164
+ uri: http://developer.echonest.com/api/v4/artist/hotttnesss?api_key=BNOAEBT3IZYZI6WXI&format=json&name=Weezer&type=mainstream
165
+ body:
166
+ encoding: US-ASCII
167
+ string: ''
168
+ headers: {}
169
+ response:
170
+ status:
171
+ code: 200
172
+ message: OK
173
+ headers:
174
+ Date:
175
+ - Mon, 02 Sep 2013 00:30:28 GMT
176
+ Content-Type:
177
+ - application/json; charset=utf-8
178
+ Content-Length:
179
+ - '170'
180
+ Vary:
181
+ - Accept-Encoding
182
+ X-Request-Id:
183
+ - pL0tjBvAS5iPqubTZV7O8A
184
+ Etag:
185
+ - ! '"db4a58343e66279b7a1d0a879e3aa2b619395963"'
186
+ X-Worker-Node:
187
+ - c6357:18864
188
+ X-Ratelimit-Remaining:
189
+ - '14'
33
190
  Server:
34
- - TornadoServer/2.4.1
191
+ - TornadoServer/3.0.1
35
192
  X-Ratelimit-Limit:
36
193
  - '20'
194
+ X-Api-Key:
195
+ - BNOAEBT3IZYZI6WXI
37
196
  Cache-Control:
38
197
  - max-age=86400
39
198
  Access-Control-Allow-Origin:
40
199
  - ! '*'
41
200
  X-Ratelimit-Used:
42
- - '1'
201
+ - '6'
202
+ Connection:
203
+ - Keep-alive
204
+ Keep-Alive:
205
+ - timeout=15, max=100
206
+ Via:
207
+ - 1.1 ID-0000627501223666 uproxy-2
43
208
  body:
44
209
  encoding: US-ASCII
45
210
  string: ! '{"response": {"status": {"version": "4.2", "code": 0, "message":
46
- "Success"}, "artist": {"hotttnesss": 0.53242500000000004, "id": "AR633SY1187B9AC3B9",
211
+ "Success"}, "artist": {"hotttnesss": 0.74428000000000005, "id": "AR633SY1187B9AC3B9",
47
212
  "name": "Weezer"}}}'
48
213
  http_version:
49
- recorded_at: Sat, 23 Feb 2013 13:05:49 GMT
50
- recorded_with: VCR 2.4.0
214
+ recorded_at: Mon, 02 Sep 2013 00:30:30 GMT
215
+ recorded_with: VCR 2.5.0
@@ -39,8 +39,8 @@ module Echonest
39
39
  response[entity_name.to_sym][__method__.to_sym]
40
40
  end
41
41
 
42
- def hotttnesss
43
- response = get_response(name: @name)
42
+ def hotttnesss(options = {})
43
+ response = get_response(name: @name, type: options.fetch(:type, 'overall'))
44
44
  response[entity_name.to_sym][__method__.to_sym]
45
45
  end
46
46
 
@@ -1,3 +1,3 @@
1
1
  module Echonest
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
data/spec/artist_spec.rb CHANGED
@@ -87,6 +87,9 @@ describe Echonest::Artist do
87
87
  VCR.use_cassette('hotttnesss') do
88
88
  create_valid_artist
89
89
  @a.hotttnesss.should be_a Float
90
+ @a.hotttnesss(type: 'social').should be_a Float
91
+ @a.hotttnesss(type: 'reviews').should be_a Float
92
+ @a.hotttnesss(type: 'mainstream').should be_a Float
90
93
  end
91
94
  end
92
95
 
metadata CHANGED
@@ -1,52 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: echonest-ruby-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Max Woolf
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-17 00:00:00.000000000 Z
11
+ date: 2013-09-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: multi_json
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,23 +55,20 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: guard-rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rb-fsevent
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,65 +83,57 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: mocha
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: vcr
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: webmock
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: coveralls
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - '>='
148
130
  - !ruby/object:Gem::Version
149
131
  version: '0'
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - '>='
156
137
  - !ruby/object:Gem::Version
157
138
  version: '0'
158
139
  description: A simple ruby wrapper around the Echonest API
@@ -211,27 +192,26 @@ files:
211
192
  - tmp/rspec_guard_result
212
193
  homepage: https://github.com/maxehmookau/echonest-ruby-api
213
194
  licenses: []
195
+ metadata: {}
214
196
  post_install_message:
215
197
  rdoc_options: []
216
198
  require_paths:
217
199
  - lib
218
200
  required_ruby_version: !ruby/object:Gem::Requirement
219
- none: false
220
201
  requirements:
221
- - - ! '>='
202
+ - - '>='
222
203
  - !ruby/object:Gem::Version
223
204
  version: '0'
224
205
  required_rubygems_version: !ruby/object:Gem::Requirement
225
- none: false
226
206
  requirements:
227
- - - ! '>='
207
+ - - '>='
228
208
  - !ruby/object:Gem::Version
229
209
  version: '0'
230
210
  requirements: []
231
211
  rubyforge_project:
232
- rubygems_version: 1.8.24
212
+ rubygems_version: 2.0.6
233
213
  signing_key:
234
- specification_version: 3
214
+ specification_version: 4
235
215
  summary: A gem to get hold of some echonest stuff!
236
216
  test_files:
237
217
  - spec/artist_spec.rb