soundcloud 0.3.2 → 0.3.3
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 +7 -0
- data/LICENSE.md +20 -0
- data/README.md +16 -4
- data/lib/soundcloud/client.rb +9 -3
- data/lib/soundcloud/version.rb +1 -1
- metadata +18 -25
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6979d8c612a346e92f06cb4a5739c24ba92e69cb
|
4
|
+
data.tar.gz: 5417602bad7afe6f608f1f74af05466abf632986
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 24e2fb1531884f9658ab5c4a32783633394d10fbee4cbb0bf2529b60941cc9d2168f2ac7bff581999b2662b6a50d5220955d4e8d0f5ac61eb430a0a07e6e3be6
|
7
|
+
data.tar.gz: ce1ffe5122e0164fcaf0e306205f98e8fdb27029b8eecdc9ba8f2be1cb223eb91532e6aa7ed8459110b0f93ac0e0c5c38511bb586607f6b28e0793b1ab584553
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009-2015 SoundCloud Ltd., Johannes Wagener, Erik Michaels-Ober
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -12,12 +12,20 @@ gem install soundcloud
|
|
12
12
|
```
|
13
13
|
|
14
14
|
## Examples
|
15
|
-
|
15
|
+
|
16
|
+
The following examples are for the [latest gem version](https://rubygems.org/gems/soundcloud).
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
SoundCloud::VERSION
|
20
|
+
# => "0.3.3"
|
21
|
+
```
|
22
|
+
|
23
|
+
#### Print links of the 10 most recent tracks
|
16
24
|
```ruby
|
17
25
|
# register a client with YOUR_CLIENT_ID as client_id_
|
18
26
|
client = SoundCloud.new(:client_id => YOUR_CLIENT_ID)
|
19
|
-
# get
|
20
|
-
tracks = client.get('/tracks', :limit => 10
|
27
|
+
# get newest tracks
|
28
|
+
tracks = client.get('/tracks', :limit => 10)
|
21
29
|
# print each link
|
22
30
|
tracks.each do |track|
|
23
31
|
puts track.permalink_url
|
@@ -64,7 +72,7 @@ client = SoundCloud.new({
|
|
64
72
|
:refresh_token => SOME_REFRESH_TOKEN
|
65
73
|
})
|
66
74
|
|
67
|
-
# upload a new track with
|
75
|
+
# upload a new track with audio.mp3 as audio and image.jpg as artwork
|
68
76
|
track = client.post('/tracks', :track => {
|
69
77
|
:title => 'a new track',
|
70
78
|
:asset_data => File.new('audio.mp3')
|
@@ -168,3 +176,7 @@ Will return true or false depending on if `expires_at` is in the past.
|
|
168
176
|
In case a request was not successful a SoundCloud::ResponseError will be
|
169
177
|
raised. The original HTTParty response is available through
|
170
178
|
`SoundCloud::ResponseError#response`.
|
179
|
+
|
180
|
+
## Documentation
|
181
|
+
|
182
|
+
For more code examples, please visit the [SoundCloud API Documentation](http://developers.soundcloud.com/docs).
|
data/lib/soundcloud/client.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
require 'soundcloud/version'
|
2
|
+
|
1
3
|
module SoundCloud
|
2
4
|
class Client
|
3
5
|
include HTTMultiParty
|
4
|
-
USER_AGENT = "SoundCloud Ruby Wrapper #{VERSION}"
|
6
|
+
USER_AGENT = "SoundCloud Ruby Wrapper #{SoundCloud::VERSION}"
|
5
7
|
CLIENT_ID_PARAM_NAME = :client_id
|
6
8
|
API_SUBHOST = 'api'
|
7
9
|
AUTHORIZE_PATH = '/connect'
|
@@ -151,9 +153,9 @@ module SoundCloud
|
|
151
153
|
else
|
152
154
|
raise ResponseError.new(response)
|
153
155
|
end
|
154
|
-
elsif
|
156
|
+
elsif response_is_a?(response, Hash)
|
155
157
|
HashResponseWrapper.new(response)
|
156
|
-
elsif
|
158
|
+
elsif response_is_a?(response, Array)
|
157
159
|
ArrayResponseWrapper.new(response)
|
158
160
|
elsif response && response.success?
|
159
161
|
response
|
@@ -195,5 +197,9 @@ module SoundCloud
|
|
195
197
|
]
|
196
198
|
end
|
197
199
|
|
200
|
+
def response_is_a?(response, type)
|
201
|
+
response.is_a?(type) || (response.respond_to?(:parsed_response) && response.parsed_response.is_a?(type))
|
202
|
+
end
|
203
|
+
|
198
204
|
end
|
199
205
|
end
|
data/lib/soundcloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,102 +1,95 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soundcloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Johannes Wagener
|
8
|
+
- Erik Michaels-Ober
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-09-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httmultiparty
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
17
|
requirements:
|
19
|
-
- - ~>
|
18
|
+
- - "~>"
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: 0.3.0
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
|
-
- - ~>
|
25
|
+
- - "~>"
|
28
26
|
- !ruby/object:Gem::Version
|
29
27
|
version: 0.3.0
|
30
28
|
- !ruby/object:Gem::Dependency
|
31
29
|
name: hashie
|
32
30
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
31
|
requirements:
|
35
|
-
- - ~>
|
32
|
+
- - "~>"
|
36
33
|
- !ruby/object:Gem::Version
|
37
34
|
version: '2.0'
|
38
35
|
type: :runtime
|
39
36
|
prerelease: false
|
40
37
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
38
|
requirements:
|
43
|
-
- - ~>
|
39
|
+
- - "~>"
|
44
40
|
- !ruby/object:Gem::Version
|
45
41
|
version: '2.0'
|
46
42
|
- !ruby/object:Gem::Dependency
|
47
43
|
name: bundler
|
48
44
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
45
|
requirements:
|
51
|
-
- - ~>
|
46
|
+
- - "~>"
|
52
47
|
- !ruby/object:Gem::Version
|
53
48
|
version: '1.0'
|
54
49
|
type: :development
|
55
50
|
prerelease: false
|
56
51
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
52
|
requirements:
|
59
|
-
- - ~>
|
53
|
+
- - "~>"
|
60
54
|
- !ruby/object:Gem::Version
|
61
55
|
version: '1.0'
|
62
56
|
description: The official SoundCloud API wrapper. It provides simple methods to handle
|
63
57
|
authorization and to execute HTTP calls.
|
64
58
|
email:
|
65
|
-
-
|
59
|
+
- api@soundcloud.com
|
66
60
|
executables: []
|
67
61
|
extensions: []
|
68
62
|
extra_rdoc_files: []
|
69
63
|
files:
|
64
|
+
- LICENSE.md
|
65
|
+
- README.md
|
66
|
+
- lib/soundcloud.rb
|
70
67
|
- lib/soundcloud/array_response_wrapper.rb
|
71
68
|
- lib/soundcloud/client.rb
|
72
69
|
- lib/soundcloud/hash_response_wrapper.rb
|
73
70
|
- lib/soundcloud/response_error.rb
|
74
71
|
- lib/soundcloud/version.rb
|
75
|
-
- lib/soundcloud.rb
|
76
|
-
- README.md
|
77
72
|
homepage: http://dev.soundcloud.com
|
78
73
|
licenses: []
|
74
|
+
metadata: {}
|
79
75
|
post_install_message:
|
80
76
|
rdoc_options: []
|
81
77
|
require_paths:
|
82
78
|
- lib
|
83
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
80
|
requirements:
|
86
|
-
- -
|
81
|
+
- - ">="
|
87
82
|
- !ruby/object:Gem::Version
|
88
83
|
version: '0'
|
89
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
85
|
requirements:
|
92
|
-
- -
|
86
|
+
- - ">="
|
93
87
|
- !ruby/object:Gem::Version
|
94
88
|
version: 1.3.5
|
95
89
|
requirements: []
|
96
90
|
rubyforge_project:
|
97
|
-
rubygems_version:
|
91
|
+
rubygems_version: 2.5.1
|
98
92
|
signing_key:
|
99
|
-
specification_version:
|
93
|
+
specification_version: 4
|
100
94
|
summary: The official SoundCloud API wrapper.
|
101
95
|
test_files: []
|
102
|
-
has_rdoc:
|