soundcloud 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -15
- data/lib/soundcloud.rb +1 -1
- data/lib/soundcloud/hash_response_wrapper.rb +2 -2
- data/lib/soundcloud/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -16,7 +16,7 @@ It is providing simple methods to handle authorization and to execute HTTP calls
|
|
16
16
|
## Examples
|
17
17
|
#### print links of the 10 hottest tracks
|
18
18
|
# register a client with YOUR_CLIENT_ID as client_id_
|
19
|
-
client = Soundcloud.new(:client_id =>
|
19
|
+
client = Soundcloud.new(:client_id => YOUR_CLIENT_ID)
|
20
20
|
# get 10 hottest tracks
|
21
21
|
tracks = client.get('/tracks', :limit => 10, :order => 'hotness')
|
22
22
|
# print each link
|
@@ -27,8 +27,8 @@ It is providing simple methods to handle authorization and to execute HTTP calls
|
|
27
27
|
#### Do the OAuth2 user credentials flow and print the username of the authenticated user
|
28
28
|
# register a new client, which will exchange the username, password for an access_token
|
29
29
|
client = Soundcloud.new({
|
30
|
-
:client_id =>
|
31
|
-
:client_secret =>
|
30
|
+
:client_id => YOUR_CLIENT_ID,
|
31
|
+
:client_secret => YOUR_CLIENT_SECRET,
|
32
32
|
:username => 'some@email.com',
|
33
33
|
:password => 'userpass'
|
34
34
|
})
|
@@ -38,8 +38,8 @@ It is providing simple methods to handle authorization and to execute HTTP calls
|
|
38
38
|
|
39
39
|
#### Do the OAuth2 authorization code flow
|
40
40
|
sc = Soundcloud.new({
|
41
|
-
:client_id =>
|
42
|
-
:client_secret =>
|
41
|
+
:client_id => YOUR_CLIENT_ID,
|
42
|
+
:client_secret => YOUR_CLIENT_SECRET,
|
43
43
|
})
|
44
44
|
|
45
45
|
sc.authorize_url(:redirect_uri => uri)
|
@@ -49,24 +49,23 @@ It is providing simple methods to handle authorization and to execute HTTP calls
|
|
49
49
|
#### Do the OAuth2 refresh token flow, upload a track and print its link
|
50
50
|
# register a new client which will exchange an existing refresh_token for an access_token
|
51
51
|
client = Soundcloud.new({
|
52
|
-
:client_id =>
|
53
|
-
:client_secret =>
|
54
|
-
:refresh_token =>
|
52
|
+
:client_id => YOUR_CLIENT_ID,
|
53
|
+
:client_secret => YOUR_CLIENT_SECRET,
|
54
|
+
:refresh_token => SOME_REFRESH_TOKEN
|
55
55
|
})
|
56
56
|
|
57
57
|
# upload a new track with track.mp3 as audio and image.jpg as artwork
|
58
|
-
track = client.post('/tracks', {
|
58
|
+
track = client.post('/tracks', :track => {
|
59
59
|
:title => 'a new track',
|
60
|
-
:asset_data => File.new('
|
61
|
-
|
62
|
-
})
|
60
|
+
:asset_data => File.new('audio.mp3')
|
61
|
+
}, :format => 'json')
|
63
62
|
|
64
63
|
# print new tracks link
|
65
64
|
puts track.permalink_url
|
66
65
|
|
67
66
|
#### Resolve a track url and print its id
|
68
67
|
# register the client
|
69
|
-
client = Soundcloud.new(:client_id =>
|
68
|
+
client = Soundcloud.new(:client_id => YOUR_CLIENT_ID)
|
70
69
|
|
71
70
|
# call the resolve endpoint with a track url
|
72
71
|
track = client.get('/resolve', :url => "http://soundcloud.com/forss/flickermood")
|
@@ -76,10 +75,10 @@ It is providing simple methods to handle authorization and to execute HTTP calls
|
|
76
75
|
|
77
76
|
#### Register a client for http://sandbox-soundcloud.com with an existing access_token and start following a user
|
78
77
|
# register a client for http://sandbox-soundcloud.com with existing access_token
|
79
|
-
client = Soundcloud.new(:site => 'sandbox-soundcloud.com', :access_token =>
|
78
|
+
client = Soundcloud.new(:site => 'sandbox-soundcloud.com', :access_token => SOME_ACCESS_TOKEN)
|
80
79
|
|
81
80
|
# create a new following
|
82
|
-
user_id_to_follow =
|
81
|
+
user_id_to_follow = 251670
|
83
82
|
client.put("/me/followings/#{user_id_to_follow}")
|
84
83
|
|
85
84
|
## Details
|
data/lib/soundcloud.rb
CHANGED
@@ -66,7 +66,7 @@ class Soundcloud
|
|
66
66
|
{:grant_type => 'authorization_code', :redirect_uri => @options[:redirect_uri], :code => @options[:code]}
|
67
67
|
end
|
68
68
|
params.merge!(client_params)
|
69
|
-
response = handle_response {
|
69
|
+
response = handle_response(false) {
|
70
70
|
self.class.post("https://#{api_host}#{TOKEN_PATH}", :query => params)
|
71
71
|
}
|
72
72
|
@options.merge!(:access_token => response.access_token, :refresh_token => response.refresh_token)
|
data/lib/soundcloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soundcloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Johannes Wagener
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-31 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|