officialfm 0.1.2 → 0.2.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/.gitignore +0 -5
- data/Gemfile +6 -0
- data/Gemfile.lock +41 -0
- data/README.md +174 -42
- data/Rakefile +0 -1
- data/lib/officialfm/client.rb +59 -55
- data/lib/officialfm/playlists.rb +35 -131
- data/lib/officialfm/projects.rb +65 -0
- data/lib/officialfm/tracks.rb +12 -194
- data/lib/officialfm/version.rb +1 -1
- data/lib/officialfm.rb +2 -8
- data/officialfm.gemspec +10 -16
- data/test/client_test.rb +97 -0
- data/test/helper.rb +10 -36
- data/test/tracks_test.rb +17 -38
- metadata +88 -216
- data/.document +0 -5
- data/LICENSE +0 -24
- data/changelog.md +0 -25
- data/lib/faraday/request/officialfm_oauth.rb +0 -23
- data/lib/officialfm/authentication.rb +0 -31
- data/lib/officialfm/users.rb +0 -251
- data/test/fixtures/charts.json +0 -1552
- data/test/fixtures/latest.json +0 -1552
- data/test/fixtures/playlist.json +0 -20
- data/test/fixtures/playlist_votes.json +0 -21
- data/test/fixtures/playlists.json +0 -122
- data/test/fixtures/track.json +0 -33
- data/test/fixtures/track_votes.json +0 -306
- data/test/fixtures/tracks.json +0 -157
- data/test/fixtures/user.json +0 -22
- data/test/fixtures/user_contacts.json +0 -40
- data/test/fixtures/user_playlists.json +0 -38
- data/test/fixtures/user_subscribers.json +0 -40
- data/test/fixtures/user_subscriptions.json +0 -40
- data/test/fixtures/user_tracks.json +0 -66
- data/test/fixtures/voted_playlists.json +0 -50
- data/test/fixtures/voted_tracks.json +0 -96
- data/test/playlists_test.rb +0 -32
- data/test/users_test.rb +0 -87
metadata
CHANGED
@@ -1,280 +1,152 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: officialfm
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 2
|
10
|
-
version: 0.1.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
7
|
+
authors:
|
8
|
+
- Dimiter Petrov
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-08-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: faraday
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &18735100 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 6
|
33
|
-
version: "0.6"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.8.1
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: faraday_middleware
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *18735100
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: faraday_middleware
|
27
|
+
requirement: &18734120 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
29
|
+
requirements:
|
42
30
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 6
|
48
|
-
version: "0.6"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.8.8
|
49
33
|
type: :runtime
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: hashie
|
53
34
|
prerelease: false
|
54
|
-
|
35
|
+
version_requirements: *18734120
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: hashie
|
38
|
+
requirement: &18733300 !ruby/object:Gem::Requirement
|
55
39
|
none: false
|
56
|
-
requirements:
|
40
|
+
requirements:
|
57
41
|
- - ~>
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
segments:
|
61
|
-
- 1
|
62
|
-
- 0
|
63
|
-
version: "1.0"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.2'
|
64
44
|
type: :runtime
|
65
|
-
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: simple_oauth
|
68
45
|
prerelease: false
|
69
|
-
|
70
|
-
|
71
|
-
requirements:
|
72
|
-
- - ~>
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
hash: 17
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
- 1
|
78
|
-
- 5
|
79
|
-
version: 0.1.5
|
80
|
-
type: :runtime
|
81
|
-
version_requirements: *id004
|
82
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
version_requirements: *18733300
|
47
|
+
- !ruby/object:Gem::Dependency
|
83
48
|
name: bundler
|
84
|
-
|
85
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
49
|
+
requirement: &18732340 !ruby/object:Gem::Requirement
|
86
50
|
none: false
|
87
|
-
requirements:
|
51
|
+
requirements:
|
88
52
|
- - ~>
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
segments:
|
92
|
-
- 1
|
93
|
-
- 0
|
94
|
-
version: "1.0"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
95
55
|
type: :development
|
96
|
-
version_requirements: *id005
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: fakeweb
|
99
56
|
prerelease: false
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
hash: 9
|
106
|
-
segments:
|
107
|
-
- 1
|
108
|
-
- 3
|
109
|
-
version: "1.3"
|
110
|
-
type: :development
|
111
|
-
version_requirements: *id006
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: jnunemaker-matchy
|
114
|
-
prerelease: false
|
115
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
57
|
+
version_requirements: *18732340
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: &18748220 !ruby/object:Gem::Requirement
|
116
61
|
none: false
|
117
|
-
requirements:
|
62
|
+
requirements:
|
118
63
|
- - ~>
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
|
121
|
-
segments:
|
122
|
-
- 0
|
123
|
-
- 4
|
124
|
-
version: "0.4"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0.8'
|
125
66
|
type: :development
|
126
|
-
version_requirements: *id007
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: json_pure
|
129
67
|
prerelease: false
|
130
|
-
|
68
|
+
version_requirements: *18748220
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: shoulda
|
71
|
+
requirement: &18747620 !ruby/object:Gem::Requirement
|
131
72
|
none: false
|
132
|
-
requirements:
|
73
|
+
requirements:
|
133
74
|
- - ~>
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
|
136
|
-
segments:
|
137
|
-
- 1
|
138
|
-
- 5
|
139
|
-
version: "1.5"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.11'
|
140
77
|
type: :development
|
141
|
-
version_requirements: *id008
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: rake
|
144
78
|
prerelease: false
|
145
|
-
|
79
|
+
version_requirements: *18747620
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: jnunemaker-matchy
|
82
|
+
requirement: &18747000 !ruby/object:Gem::Requirement
|
146
83
|
none: false
|
147
|
-
requirements:
|
84
|
+
requirements:
|
148
85
|
- - ~>
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
|
151
|
-
segments:
|
152
|
-
- 0
|
153
|
-
- 8
|
154
|
-
version: "0.8"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0.4'
|
155
88
|
type: :development
|
156
|
-
version_requirements: *id009
|
157
|
-
- !ruby/object:Gem::Dependency
|
158
|
-
name: shoulda
|
159
89
|
prerelease: false
|
160
|
-
|
161
|
-
|
162
|
-
requirements:
|
163
|
-
- - ~>
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
hash: 21
|
166
|
-
segments:
|
167
|
-
- 2
|
168
|
-
- 11
|
169
|
-
version: "2.11"
|
170
|
-
type: :development
|
171
|
-
version_requirements: *id010
|
172
|
-
- !ruby/object:Gem::Dependency
|
90
|
+
version_requirements: *18747000
|
91
|
+
- !ruby/object:Gem::Dependency
|
173
92
|
name: test-unit
|
174
|
-
|
175
|
-
requirement: &id011 !ruby/object:Gem::Requirement
|
93
|
+
requirement: &18746160 !ruby/object:Gem::Requirement
|
176
94
|
none: false
|
177
|
-
requirements:
|
95
|
+
requirements:
|
178
96
|
- - ~>
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
|
181
|
-
segments:
|
182
|
-
- 2
|
183
|
-
- 1
|
184
|
-
version: "2.1"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '2.1'
|
185
99
|
type: :development
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *18746160
|
102
|
+
description: Official Ruby bindings for the official.fm v2 API
|
103
|
+
email:
|
104
|
+
- dimiter@official.fm
|
190
105
|
executables: []
|
191
|
-
|
192
106
|
extensions: []
|
193
|
-
|
194
107
|
extra_rdoc_files: []
|
195
|
-
|
196
|
-
files:
|
197
|
-
- .document
|
108
|
+
files:
|
198
109
|
- .gitignore
|
199
110
|
- Gemfile
|
200
|
-
-
|
111
|
+
- Gemfile.lock
|
201
112
|
- README.md
|
202
113
|
- Rakefile
|
203
|
-
- changelog.md
|
204
|
-
- lib/faraday/request/officialfm_oauth.rb
|
205
114
|
- lib/officialfm.rb
|
206
|
-
- lib/officialfm/authentication.rb
|
207
115
|
- lib/officialfm/client.rb
|
208
116
|
- lib/officialfm/playlists.rb
|
117
|
+
- lib/officialfm/projects.rb
|
209
118
|
- lib/officialfm/tracks.rb
|
210
|
-
- lib/officialfm/users.rb
|
211
119
|
- lib/officialfm/version.rb
|
212
120
|
- officialfm.gemspec
|
213
|
-
- test/
|
214
|
-
- test/fixtures/latest.json
|
215
|
-
- test/fixtures/playlist.json
|
216
|
-
- test/fixtures/playlist_votes.json
|
217
|
-
- test/fixtures/playlists.json
|
218
|
-
- test/fixtures/track.json
|
219
|
-
- test/fixtures/track_votes.json
|
220
|
-
- test/fixtures/tracks.json
|
221
|
-
- test/fixtures/user.json
|
222
|
-
- test/fixtures/user_contacts.json
|
223
|
-
- test/fixtures/user_playlists.json
|
224
|
-
- test/fixtures/user_subscribers.json
|
225
|
-
- test/fixtures/user_subscriptions.json
|
226
|
-
- test/fixtures/user_tracks.json
|
227
|
-
- test/fixtures/voted_playlists.json
|
228
|
-
- test/fixtures/voted_tracks.json
|
121
|
+
- test/client_test.rb
|
229
122
|
- test/helper.rb
|
230
|
-
- test/playlists_test.rb
|
231
123
|
- test/tracks_test.rb
|
232
|
-
|
233
|
-
has_rdoc: true
|
234
|
-
homepage: http://github.com/officialfm/officialfm-ruby
|
124
|
+
homepage: http://github.com/officialfm/officialfm-v2-ruby
|
235
125
|
licenses: []
|
236
|
-
|
237
|
-
|
238
|
-
********************************************************************************
|
239
|
-
|
240
|
-
Follow @ofmdev on Twitter for announcements, updates, and news.
|
241
|
-
https://twitter.com/ofmdev
|
242
|
-
|
243
|
-
Don't forget to get your API key here:
|
244
|
-
http://official.fm/developers/manager
|
245
|
-
|
246
|
-
********************************************************************************
|
247
|
-
|
126
|
+
post_install_message: ! "********************************************************************************\n\n
|
127
|
+
\ Follow @ofmdev on Twitter for announcements, updates, and news.\n https://twitter.com/ofmdev\n\n********************************************************************************\n"
|
248
128
|
rdoc_options: []
|
249
|
-
|
250
|
-
require_paths:
|
129
|
+
require_paths:
|
251
130
|
- lib
|
252
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
253
132
|
none: false
|
254
|
-
requirements:
|
255
|
-
- -
|
256
|
-
- !ruby/object:Gem::Version
|
257
|
-
|
258
|
-
|
259
|
-
- 0
|
260
|
-
version: "0"
|
261
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
262
138
|
none: false
|
263
|
-
requirements:
|
264
|
-
- -
|
265
|
-
- !ruby/object:Gem::Version
|
266
|
-
hash: 23
|
267
|
-
segments:
|
268
|
-
- 1
|
269
|
-
- 3
|
270
|
-
- 6
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
271
142
|
version: 1.3.6
|
272
143
|
requirements: []
|
273
|
-
|
274
144
|
rubyforge_project:
|
275
|
-
rubygems_version: 1.
|
145
|
+
rubygems_version: 1.8.10
|
276
146
|
signing_key:
|
277
147
|
specification_version: 3
|
278
|
-
summary: Official Ruby bindings for the official.fm API
|
279
|
-
test_files:
|
280
|
-
|
148
|
+
summary: Official Ruby bindings for the official.fm v2 API
|
149
|
+
test_files:
|
150
|
+
- test/client_test.rb
|
151
|
+
- test/helper.rb
|
152
|
+
- test/tracks_test.rb
|
data/.document
DELETED
data/LICENSE
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
Copyright (c) 2011, Amos Wenger
|
2
|
-
All rights reserved.
|
3
|
-
|
4
|
-
Redistribution and use in source and binary forms, with or without
|
5
|
-
modification, are permitted provided that the following conditions are met:
|
6
|
-
* Redistributions of source code must retain the above copyright
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
8
|
-
* Redistributions in binary form must reproduce the above copyright
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
10
|
-
documentation and/or other materials provided with the distribution.
|
11
|
-
* Neither the name of the <organization> nor the
|
12
|
-
names of its contributors may be used to endorse or promote products
|
13
|
-
derived from this software without specific prior written permission.
|
14
|
-
|
15
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
-
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
19
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/changelog.md
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# Changelog
|
2
|
-
|
3
|
-
## 0.1.1 Aug 03, 2011
|
4
|
-
* Missing parameter in add_track_to_playlist and remove_track_from_playlist - fixed
|
5
|
-
|
6
|
-
## 0.1.0 Aug 03, 2011
|
7
|
-
* Advanced API is now fully supported, see docs here: http://official.fm/developers/advanced
|
8
|
-
* OAuth sign-in demo can be found here: https://github.com/officialfm/sign-in-with-officialfm-ruby
|
9
|
-
|
10
|
-
## 0.0.4 May 20, 2011
|
11
|
-
* Removed 'tracks' workaround, as the official API now includes it by default
|
12
|
-
|
13
|
-
## 0.0.3 May 18, 2011
|
14
|
-
* Added support for voted_playlists and voted_tracks requests
|
15
|
-
|
16
|
-
## 0.0.2 April 21, 2011
|
17
|
-
* s/Unofficial/Official, this gem is now endorsed by official.fm
|
18
|
-
* Playlist IDs no longer escaped
|
19
|
-
* Removed dependency on OAuth2, as it's not needed for the Simple API
|
20
|
-
* Better README
|
21
|
-
|
22
|
-
## 0.0.1 March 23, 2011
|
23
|
-
* Initial version
|
24
|
-
* Supports tracks, users, playlists
|
25
|
-
* Improved playlist support: tracks, running_time
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'faraday'
|
2
|
-
|
3
|
-
module Faraday
|
4
|
-
class Request::OfficialFMOAuth < Faraday::Middleware
|
5
|
-
dependency 'simple_oauth'
|
6
|
-
|
7
|
-
def call(env)
|
8
|
-
params = env[:body] || {}
|
9
|
-
signature_params = params
|
10
|
-
|
11
|
-
params.map{ |k,v| signature_params = {} if v.respond_to?(:content_type) }
|
12
|
-
|
13
|
-
header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options)
|
14
|
-
env[:request_headers]['Authorization'] = header.to_s
|
15
|
-
|
16
|
-
@app.call(env)
|
17
|
-
end
|
18
|
-
|
19
|
-
def initialize(app, options)
|
20
|
-
@app, @options = app, options
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module OfficialFM
|
2
|
-
# @private
|
3
|
-
module Authentication
|
4
|
-
private
|
5
|
-
|
6
|
-
# Authentication hash
|
7
|
-
#
|
8
|
-
# @return [Hash]
|
9
|
-
def authentication
|
10
|
-
{
|
11
|
-
:consumer_key => @api_key,
|
12
|
-
:consumer_secret => @api_secret,
|
13
|
-
:token => @access_token,
|
14
|
-
:token_secret => @access_secret,
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
# Check whether user is authenticated
|
19
|
-
#
|
20
|
-
# @return [Boolean]
|
21
|
-
def authenticated?
|
22
|
-
authentication[:token] != nil
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def check_auth(name)
|
28
|
-
raise "#{name} is an advanced API method - lacking OAuth credentials." unless authenticated?
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|