soundcloud2 0.3.3 → 0.3.5
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/.rspec +1 -0
- data/.rvmrc +1 -2
- data/.travis.yml +5 -0
- data/Gemfile +1 -0
- data/README.md +7 -1
- data/lib/soundcloud2.rb +193 -121
- data/lib/soundcloud2/comments.rb +8 -5
- data/lib/soundcloud2/groups.rb +5 -1
- data/lib/soundcloud2/playlists.rb +1 -1
- data/lib/soundcloud2/tracks.rb +1 -1
- data/lib/soundcloud2/users.rb +24 -14
- data/lib/soundcloud2/version.rb +1 -1
- data/soundcloud2.gemspec +22 -24
- data/spec/client_spec.rb +55 -0
- data/spec/soundcloud2/comments_spec.rb +23 -0
- data/spec/soundcloud2/groups_spec.rb +63 -0
- data/spec/soundcloud2/playlists_spec.rb +39 -0
- data/spec/soundcloud2/search_tracks.rb +15 -0
- data/spec/soundcloud2/tracks_spec.rb +55 -0
- data/spec/soundcloud2/users_spec.rb +98 -0
- data/spec/spec_helper.rb +12 -4
- metadata +79 -70
- data/spec/client/client_spec.rb +0 -41
- data/spec/client/comments_spec.rb +0 -21
- data/spec/client/groups_spec.rb +0 -46
- data/spec/client/playlists_spec.rb +0 -31
- data/spec/client/search_tracks.rb +0 -35
- data/spec/client/tracks_spec.rb +0 -40
- data/spec/client/users_spec.rb +0 -71
data/lib/soundcloud2/version.rb
CHANGED
data/soundcloud2.gemspec
CHANGED
@@ -1,35 +1,33 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'soundcloud2/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
6
|
+
s.name = 'soundcloud2'
|
7
7
|
s.version = Soundcloud2::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = [
|
10
|
-
s.email = [
|
11
|
-
s.homepage =
|
12
|
-
s.summary = %q{A wrapper for the Soundcloud
|
13
|
-
s.description = %q{A wrapper for the Soundcloud
|
9
|
+
s.authors = ['Alex Manelis']
|
10
|
+
s.email = ['amanelis@console.fm']
|
11
|
+
s.homepage = 'http://github.com/amanelis/soundcloud2'
|
12
|
+
s.summary = %q{A wrapper for the Soundcloud API}
|
13
|
+
s.description = %q{A wrapper for the Soundcloud API}
|
14
14
|
|
15
|
-
s.rubyforge_project =
|
16
|
-
s.add_development_dependency('rake'
|
17
|
-
s.add_development_dependency('rspec'
|
18
|
-
s.add_development_dependency('simplecov'
|
19
|
-
s.add_development_dependency('
|
20
|
-
s.add_development_dependency('
|
21
|
-
|
22
|
-
s.
|
23
|
-
s.add_runtime_dependency(
|
24
|
-
s.add_runtime_dependency(
|
25
|
-
s.add_runtime_dependency('
|
26
|
-
s.add_runtime_dependency('
|
27
|
-
s.add_runtime_dependency('multi_json', '~> 1.0.3')
|
28
|
-
# s.add_runtime_dependency('multi_json', '~> 0.0.2')
|
15
|
+
s.rubyforge_project = 'soundcloud2'
|
16
|
+
s.add_development_dependency('rake')
|
17
|
+
s.add_development_dependency('rspec')
|
18
|
+
s.add_development_dependency('simplecov')
|
19
|
+
s.add_development_dependency('yard')
|
20
|
+
s.add_development_dependency('maruku')
|
21
|
+
|
22
|
+
s.add_runtime_dependency('faraday')
|
23
|
+
s.add_runtime_dependency('faraday_middleware')
|
24
|
+
s.add_runtime_dependency('hashie')
|
25
|
+
s.add_runtime_dependency('yajl-ruby')
|
26
|
+
s.add_runtime_dependency('multi_json')
|
29
27
|
|
30
28
|
|
31
29
|
s.files = `git ls-files`.split("\n")
|
32
30
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
33
31
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
34
|
-
s.require_paths = [
|
35
|
-
end
|
32
|
+
s.require_paths = ['lib']
|
33
|
+
end
|
data/spec/client_spec.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Soundcloud2::Client do
|
4
|
+
before(:all) do
|
5
|
+
@client = Soundcloud2::Client.new(API_KEY)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#initialize' do
|
9
|
+
subject { @client }
|
10
|
+
|
11
|
+
context 'when initialized with a valid API_KEY' do
|
12
|
+
it { should_not be_nil }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#api_key' do
|
17
|
+
subject { @client.api_key }
|
18
|
+
|
19
|
+
context 'when calling the #api_key method' do
|
20
|
+
it { should eq(API_KEY) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#groups' do
|
25
|
+
subject { @client.groups(:q => 'dubstep').first }
|
26
|
+
|
27
|
+
context 'when calling the #groups method' do
|
28
|
+
it { should_not be_nil }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# describe '#playlists' do
|
33
|
+
# subject { @client.playlists(:q => 'dubstep').first }
|
34
|
+
#
|
35
|
+
# context 'when calling the #playlists method' do
|
36
|
+
# it { should_not be_nil }
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
|
40
|
+
describe '#tracks' do
|
41
|
+
subject { @client.tracks(:q => 'A new world').first }
|
42
|
+
|
43
|
+
context 'when calling the #tracks method' do
|
44
|
+
it { should_not be_nil }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#users' do
|
49
|
+
subject { @client.users(:q => 'skrillex').first }
|
50
|
+
|
51
|
+
context 'when calling the #users method' do
|
52
|
+
it { should_not be_nil }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe Soundcloud2::Comments do
|
4
|
+
before(:all) do
|
5
|
+
@comments = Soundcloud2::Comments.new(API_KEY)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#initialize' do
|
9
|
+
subject { @comments.api_key }
|
10
|
+
|
11
|
+
context 'when initialized with a valid API_KEY' do
|
12
|
+
it { should_not be_nil }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#groups' do
|
17
|
+
subject { @comments.comments('23145109') }
|
18
|
+
|
19
|
+
context 'when called with a valid group_id' do
|
20
|
+
it { should_not be_nil }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe Soundcloud2::Groups do
|
4
|
+
before(:all) do
|
5
|
+
@groups = Soundcloud2::Groups.new(API_KEY)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#initialize' do
|
9
|
+
subject { @groups.api_key }
|
10
|
+
|
11
|
+
context 'when initialized with a valid API_KEY' do
|
12
|
+
it { should_not be_nil }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#groups' do
|
17
|
+
subject { @groups.groups('11440') }
|
18
|
+
|
19
|
+
context 'when called with a valid group_id' do
|
20
|
+
it { should_not be_nil }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#groups_moderators' do
|
25
|
+
subject { @groups.groups_moderators('11440').first }
|
26
|
+
|
27
|
+
context 'when called with a valid group_id' do
|
28
|
+
it { should_not be_nil }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#groups_members' do
|
33
|
+
subject { @groups.groups_members('11440').first }
|
34
|
+
|
35
|
+
context 'when called with a valid group_id' do
|
36
|
+
it { should_not be_nil }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#groups_contributors' do
|
41
|
+
subject { @groups.groups_contributors('11440').first }
|
42
|
+
|
43
|
+
context 'when called with a valid group_id' do
|
44
|
+
it { should_not be_nil }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#groups_users' do
|
49
|
+
subject { @groups.groups_users('11440').first }
|
50
|
+
|
51
|
+
context 'when called with a valid group_id' do
|
52
|
+
it { should_not be_nil }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#groups_tracks' do
|
57
|
+
subject { @groups.groups_tracks('11440').first }
|
58
|
+
|
59
|
+
context 'when called with a valid group_id' do
|
60
|
+
it { should_not be_nil }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe Soundcloud2::Playlists do
|
4
|
+
before(:all) do
|
5
|
+
@playlists = Soundcloud2::Playlists.new(API_KEY)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#initialize' do
|
9
|
+
subject { @playlists.api_key }
|
10
|
+
|
11
|
+
context 'when initialized with a valid API_KEY' do
|
12
|
+
it { should_not be_nil }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#playlists' do
|
17
|
+
subject { @playlists.playlists('920731') }
|
18
|
+
|
19
|
+
context 'when called with a valid playlist_id' do
|
20
|
+
it { should_not be_nil }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#playlists_shared_to_users' do
|
25
|
+
subject { @playlists.playlists_shared_to_users('4201929') }
|
26
|
+
|
27
|
+
context 'when called with a valid user_id' do
|
28
|
+
it { should_not be_nil }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#playlists_shared_to_emails' do
|
33
|
+
subject { @playlists.playlists_shared_to_emails('amanelis') }
|
34
|
+
|
35
|
+
context 'when called with a valid username' do
|
36
|
+
it { should_not be_nil }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe Soundcloud2::Client do
|
4
|
+
before(:all) do
|
5
|
+
@client = Soundcloud2::Client.new(API_KEY)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#playlists' do
|
9
|
+
subject { @client.tracks(:q => 'Skrillex - Do Da Oliphant', :order => 'hotness').first }
|
10
|
+
|
11
|
+
context 'when called with a valid query and an order' do
|
12
|
+
it { should_not be_nil }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe Soundcloud2::Tracks do
|
4
|
+
before(:all) do
|
5
|
+
@tracks = Soundcloud2::Tracks.new(API_KEY)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#initialize' do
|
9
|
+
subject { @tracks.api_key }
|
10
|
+
|
11
|
+
context 'when initialized with a valid API_KEY' do
|
12
|
+
it { should_not be_nil }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#tracks' do
|
17
|
+
subject { @tracks.tracks('20296934') }
|
18
|
+
|
19
|
+
context 'when called with a valid track_id' do
|
20
|
+
it { should_not be_nil }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#tracks_comments' do
|
25
|
+
subject { @tracks.tracks_comments('20296934') }
|
26
|
+
|
27
|
+
context 'when called with a valid track_id' do
|
28
|
+
it { should_not be_nil }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#tracks_comments/:id' do
|
33
|
+
subject { @tracks.tracks_comments('20296934', '23145109') }
|
34
|
+
|
35
|
+
context 'when called with a valid track_id and comment_id' do
|
36
|
+
it { should_not be_nil }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#tracks_favoriters/:id' do
|
41
|
+
subject { @tracks.tracks_favoriters('20296934', '2769794') }
|
42
|
+
|
43
|
+
context 'when called with a valid track_id user_id' do
|
44
|
+
it { should_not be_nil }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#tracks_favoriters' do
|
49
|
+
subject { @tracks.tracks_favoriters('20296934') }
|
50
|
+
|
51
|
+
context 'when called with a valid track_id' do
|
52
|
+
it { should_not be_nil }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe Soundcloud2::Users do
|
4
|
+
before(:all) do
|
5
|
+
@users = Soundcloud2::Users.new(API_KEY)
|
6
|
+
@diplo = {:id => '16730'}
|
7
|
+
@djzaxx = {:id => '4201929'}
|
8
|
+
@tiesto = {:id => '108842'}
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#initialize' do
|
12
|
+
subject { @users.api_key }
|
13
|
+
|
14
|
+
context 'when initialized with a valid API_KEY' do
|
15
|
+
it { should_not be_nil }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#users' do
|
20
|
+
subject { @users.users(@djzaxx[:id]) }
|
21
|
+
|
22
|
+
context 'when called with a valid user' do
|
23
|
+
it { should_not be_nil }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#users_playlists' do
|
28
|
+
subject { @users.users_playlists(@diplo[:id]).first }
|
29
|
+
|
30
|
+
context 'when called with a valid user' do
|
31
|
+
it { should_not be_nil }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#users_followings' do
|
36
|
+
subject { @users.users_followings(@djzaxx[:id]).first }
|
37
|
+
|
38
|
+
context 'when called with a valid user' do
|
39
|
+
it { should_not be_nil }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#users_followings/:id' do
|
44
|
+
subject { @users.users_followings(@djzaxx[:id], @tiesto[:id]) }
|
45
|
+
|
46
|
+
context 'when called with a valid user and a second valid user' do
|
47
|
+
it { should_not be_nil }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#users_followers' do
|
52
|
+
subject { @users.users_followers(@djzaxx[:id]).first }
|
53
|
+
|
54
|
+
context 'when called with a valid user' do
|
55
|
+
it { should_not be_nil }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#users_followers/:id' do
|
60
|
+
subject { @users.users_followers(@djzaxx[:id], @tiesto[:id]) }
|
61
|
+
|
62
|
+
context 'when called with a valid user and a second valid user' do
|
63
|
+
it { should_not be_nil }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#users_comments' do
|
68
|
+
subject { @users.users_comments(@djzaxx[:id]).first }
|
69
|
+
|
70
|
+
context 'when called with a valid user' do
|
71
|
+
it { should_not be_nil }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#users_favorites' do
|
76
|
+
subject { @users.users_favorites(@djzaxx[:id]).first }
|
77
|
+
|
78
|
+
context 'when called with a valid user' do
|
79
|
+
it { should_not be_nil }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#users_favorites/:id' do
|
84
|
+
subject { @users.users_favorites(@djzaxx[:id], @tiesto[:id]) }
|
85
|
+
|
86
|
+
context 'when called with a valid user and a second valid user' do
|
87
|
+
it { should_not be_nil }
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '#users_groups' do
|
92
|
+
subject { @users.users_groups(@djzaxx[:id]).first }
|
93
|
+
|
94
|
+
context 'when called with a valid user' do
|
95
|
+
it { should_not be_nil }
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,21 @@
|
|
1
|
+
|
2
|
+
# Loading more in this block will cause your tests to run faster. However,
|
3
|
+
# if you change any configuration or code from libraries loaded here, you'll
|
4
|
+
# need to restart spork for it take effect.
|
5
|
+
require 'rspec'
|
1
6
|
require 'simplecov'
|
2
7
|
|
8
|
+
ENV["RAILS_ENV"] ||= 'test'
|
9
|
+
require File.expand_path('../../lib/soundcloud2', __FILE__)
|
10
|
+
|
3
11
|
SimpleCov.start do
|
4
12
|
add_group 'Soundcloud2', 'lib/soundcloud2'
|
5
13
|
add_group 'Specs', 'spec'
|
6
14
|
end
|
7
15
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
16
|
+
RSpec.configure do |config|
|
17
|
+
config.color_enabled = true
|
18
|
+
config.tty = true
|
19
|
+
end
|
12
20
|
|
13
21
|
API_KEY = "734a173874da8c420aeb59fd03623454"
|