soundcloud 0.3.4 → 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.
- checksums.yaml +5 -5
- data/README.md +7 -0
- data/lib/soundcloud/client.rb +11 -5
- data/lib/soundcloud/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: df5b0cab01fdc8985e0059c4fbaebbb29672f58c17c33ce1cce2765861eeee3c
|
4
|
+
data.tar.gz: 730fc7f919b60e2aa582e755560284ebc07957d51054115da4093adfa71ced0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93d8a10bd11b13c43b18e6c5449a3e640f0f43e93eb40473869f3326d84e4f6c4c347929acf9e93ddb0e4f1fa6cf8df75f68d25818636f6738efbe2a2dfafd54
|
7
|
+
data.tar.gz: 71e706b85e323052f13bd39c1f32368c4cbaaccb41ceaf5e2eed65438502dc025e8adf30191af06ae9ea35efad492faad3a85443ef2cb0d57b4ad0a0b29c6e66
|
data/README.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# ⚠️⚠️DEPRECATED - NO LONGER MAINTAINED⚠️⚠️
|
2
|
+
This repository is no longer maintained by the SoundCloud team due to capacity constraints. We're instead focusing our efforts on improving the API & the developer platform. Please note, at the time of updating this, the repo is already not in sync with the latest API changes.
|
3
|
+
|
4
|
+
We recommend the community to fork this repo in order to maintain the SDK. We'd be more than happy to make a reference on our developer that the developers can use different SDKs build by the community. In case you need to reach out to us, please head over to https://github.com/soundcloud/api/issues
|
5
|
+
|
6
|
+
---
|
7
|
+
|
1
8
|
# SoundCloud API Wrapper
|
2
9
|
|
3
10
|
[](https://travis-ci.org/soundcloud/soundcloud-ruby)
|
data/lib/soundcloud/client.rb
CHANGED
@@ -18,7 +18,7 @@ module SoundCloud
|
|
18
18
|
|
19
19
|
def initialize(options={})
|
20
20
|
store_options(options)
|
21
|
-
if access_token.nil? && (options_for_refresh_flow_present? || options_for_credentials_flow_present? || options_for_code_flow_present?)
|
21
|
+
if access_token.nil? && (options_for_refresh_flow_present? || options_for_credentials_flow_present? || options_for_code_flow_present? || client_secret)
|
22
22
|
exchange_token
|
23
23
|
end
|
24
24
|
raise ArgumentError, "At least a client_id or an access_token must be present" if client_id.nil? && access_token.nil?
|
@@ -108,13 +108,14 @@ module SoundCloud
|
|
108
108
|
def exchange_token(options={})
|
109
109
|
store_options(options)
|
110
110
|
raise ArgumentError, 'client_id and client_secret is required to retrieve an access_token' if client_id.nil? || client_secret.nil?
|
111
|
-
|
111
|
+
|
112
112
|
params = if options_for_refresh_flow_present?
|
113
113
|
{
|
114
114
|
:grant_type => 'refresh_token',
|
115
115
|
:refresh_token => refresh_token,
|
116
116
|
}
|
117
117
|
elsif options_for_credentials_flow_present?
|
118
|
+
puts "Warning: Password grant is deprecated, see https://developers.soundcloud.com/blog/security-updates-api"
|
118
119
|
{
|
119
120
|
:grant_type => 'password',
|
120
121
|
:username => @options[:username],
|
@@ -126,11 +127,16 @@ module SoundCloud
|
|
126
127
|
:redirect_uri => @options[:redirect_uri],
|
127
128
|
:code => @options[:code],
|
128
129
|
}
|
130
|
+
elsif client_secret
|
131
|
+
{ :grant_type => 'client_credentials' }
|
129
132
|
end
|
130
|
-
|
133
|
+
|
134
|
+
params.merge!(:client_id => client_id, :client_secret => client_secret)
|
135
|
+
|
131
136
|
response = handle_response(false) {
|
132
137
|
self.class.post("https://#{api_host}#{TOKEN_PATH}", :query => params)
|
133
138
|
}
|
139
|
+
|
134
140
|
@options.merge!(:access_token => response.access_token, :refresh_token => response.refresh_token)
|
135
141
|
@options[:expires_at] = Time.now + response.expires_in if response.expires_in
|
136
142
|
@options[:on_exchange_token].call(*[(self if @options[:on_exchange_token].arity == 1)].compact)
|
@@ -187,8 +193,9 @@ module SoundCloud
|
|
187
193
|
options[body_or_query] ||= {}
|
188
194
|
options[body_or_query][:format] = "json"
|
189
195
|
if access_token
|
190
|
-
options[
|
196
|
+
options[:headers] = { 'Authorization' => "OAuth #{access_token}" }
|
191
197
|
else
|
198
|
+
puts "Warning: Authorization via ClientId is deprecated, see https://developers.soundcloud.com/blog/security-updates-api"
|
192
199
|
options[body_or_query][CLIENT_ID_PARAM_NAME] = client_id
|
193
200
|
end
|
194
201
|
[
|
@@ -200,6 +207,5 @@ module SoundCloud
|
|
200
207
|
def response_is_a?(response, type)
|
201
208
|
response.is_a?(type) || (response.respond_to?(:parsed_response) && response.parsed_response.is_a?(type))
|
202
209
|
end
|
203
|
-
|
204
210
|
end
|
205
211
|
end
|
data/lib/soundcloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soundcloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Wagener
|
8
8
|
- Erik Michaels-Ober
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httmultiparty
|
@@ -72,7 +72,7 @@ files:
|
|
72
72
|
homepage: https://dev.soundcloud.com
|
73
73
|
licenses: []
|
74
74
|
metadata: {}
|
75
|
-
post_install_message:
|
75
|
+
post_install_message:
|
76
76
|
rdoc_options: []
|
77
77
|
require_paths:
|
78
78
|
- lib
|
@@ -87,9 +87,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 1.3.5
|
89
89
|
requirements: []
|
90
|
-
|
91
|
-
|
92
|
-
signing_key:
|
90
|
+
rubygems_version: 3.1.2
|
91
|
+
signing_key:
|
93
92
|
specification_version: 4
|
94
93
|
summary: The official SoundCloud API wrapper.
|
95
94
|
test_files: []
|