sounddrop 0.0.3 → 0.0.4
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 +8 -8
- data/lib/sounddrop/client.rb +8 -5
- data/lib/sounddrop/drop.rb +6 -6
- data/lib/sounddrop/exceptions.rb +9 -7
- data/lib/sounddrop/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjQ2ZTVmMzAxZjE2MTg3ZTFkYTk3MGI3N2RiMTY3NjY4ZGMwMjkyZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODNiMDU0YWJmZTVhYzMyZGZjMDkyYzIyZWQxMDg0MjcyNjcxNTNjYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTNlNjUyMWYzZDBlNTQyNTg3ZTRiNDllODJlNWFiOTE3YjZiOTcwNjQwOGE1
|
10
|
+
ZmU1ZmZhNzYwNjZhOGIzZThkNTIyMWUwZWU2MWI0NWIzOThlYTcxODg4MTc3
|
11
|
+
ZDI3OTU0ZGNhYjI3NzMwYTA2ZmVjOGYyNWYzMTFhMWU0NmE1ODA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWE3YWVhMDc1MWQ5MDk2NzZlYTY5ZTQyNWVkMzc5MGU5YmEwODNmMzU5Yjgw
|
14
|
+
MTkyNTU1ZDIwNDhjMzFhNmQ3OTYxZjg0Yjk0YTc1YmNkMThkODMzMDg5NTA4
|
15
|
+
MDZjMmQ4NWIxZGI0MGU2NGU1ZjMxMjQ4MjU0ZGFjNTFmOGFjMjI=
|
data/lib/sounddrop/client.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SoundDrop
|
2
2
|
class Client
|
3
3
|
|
4
4
|
###########################################################################
|
@@ -16,6 +16,10 @@ module Sounddrop
|
|
16
16
|
@client = get_client
|
17
17
|
end
|
18
18
|
|
19
|
+
###########################################################################
|
20
|
+
# Core #
|
21
|
+
###########################################################################
|
22
|
+
|
19
23
|
# Did the user specify a username?
|
20
24
|
def username?
|
21
25
|
@USERNAME.nil?
|
@@ -41,14 +45,13 @@ module Sounddrop
|
|
41
45
|
Soundcloud.new(init_opts)
|
42
46
|
end
|
43
47
|
|
44
|
-
# Returns a
|
45
|
-
# The Track object is where most of the data retrieval occurs.
|
48
|
+
# Returns a Drop object that contains useful track information.
|
46
49
|
def get_drop(url)
|
47
50
|
sc_track = client.get('/resolve', url: url)
|
48
|
-
|
51
|
+
SoundDrop::Drop.new(client: client, track: sc_track)
|
49
52
|
end
|
50
53
|
|
51
54
|
private :get_client, :username?, :password?
|
52
55
|
|
53
56
|
end # class Client
|
54
|
-
end # module
|
57
|
+
end # module SoundDrop
|
data/lib/sounddrop/drop.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SoundDrop
|
2
2
|
class Drop
|
3
3
|
|
4
4
|
###########################################################################
|
@@ -7,9 +7,9 @@ module Sounddrop
|
|
7
7
|
|
8
8
|
LOG = Logbert[self]
|
9
9
|
|
10
|
-
def initialize(
|
11
|
-
@TRACK =
|
12
|
-
@CLIENT = client
|
10
|
+
def initialize(params)
|
11
|
+
@TRACK = params[:track]
|
12
|
+
@CLIENT = params[:client]
|
13
13
|
end
|
14
14
|
|
15
15
|
###########################################################################
|
@@ -37,9 +37,9 @@ module Sounddrop
|
|
37
37
|
r = HTTParty.get("https://api.soundcloud.com/i1/tracks/#{id}/streams?client_id=#{@CLIENT.client_id}")
|
38
38
|
r['http_mp3_128_url']
|
39
39
|
rescue Exception => ex
|
40
|
-
raise
|
40
|
+
raise SoundDrop::Exception::FailedRequest.new(ex)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
end # class Drop
|
45
|
-
end # module
|
45
|
+
end # module SoundDrop
|
data/lib/sounddrop/exceptions.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
module
|
1
|
+
module SoundDrop
|
2
|
+
module Exception
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
class FailedRequest < StandardError
|
5
|
+
attr_reader :message
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
def initialize(message)
|
8
|
+
@message = message
|
9
|
+
end
|
8
10
|
end
|
9
|
-
end
|
10
11
|
|
11
|
-
end # module
|
12
|
+
end # module Exception
|
13
|
+
end # module SoundDrop
|
data/lib/sounddrop/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.0.
|
1
|
+
module SoundDrop
|
2
|
+
VERSION = "0.0.4"
|
3
3
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sounddrop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Bezobchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: soundcloud
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.2.2
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Provides audio and track information about a Soundcloud song given a URL
|