twilio_recordings 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/twilio_recordings.rb +16 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b82464745bd864b23b18200a752942e511554f8d
|
4
|
+
data.tar.gz: 48db032d6c9ace15122eaca0217703c18da0ccd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6ff3f5523953e6452b08ac4130fe0fbb982283252fa0689b75962f2fa4223f1f7cb251e80f75ea3d2ea4afa21ff3b3279319aa36e99b010773cdaa7cd80a5b5
|
7
|
+
data.tar.gz: 9859f7880ecce0dedaf94d7a05a937780da9dbb436b42da393c8f054080c49729fe4d58d383debbe48becca24ba3fbe8894f5085c762f2d469d9618da5bb839b
|
data/lib/twilio_recordings.rb
CHANGED
@@ -6,10 +6,10 @@ class TwilioRecordings
|
|
6
6
|
|
7
7
|
##
|
8
8
|
# Instantiate a new TwilioRecordings object.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Example:
|
11
11
|
# >> t = TwilioRecordings.new(account_sid, recording_sids, tmp_dir: './my_tmp_dir')
|
12
|
-
# => #<TwilioRecordings:0x00... >
|
12
|
+
# => #<TwilioRecordings:0x00... >
|
13
13
|
#
|
14
14
|
# Arguments:
|
15
15
|
# account_sid: The Twilio account SID, e.g. "AC12345678901234567890123456789012"
|
@@ -17,7 +17,7 @@ class TwilioRecordings
|
|
17
17
|
# tmp_dir: The directory that the recordings will be temporarily downloaded to. (optional, default is '/tmp')
|
18
18
|
def initialize(account_sid, recording_sids, options={})
|
19
19
|
@account_sid = account_sid
|
20
|
-
@recording_sids = recording_sids
|
20
|
+
@recording_sids = recording_sids.map{ |sid| self.class.sanitize(sid) }
|
21
21
|
@tmp_dir = options[:tmp_dir] || File.join('','tmp')
|
22
22
|
@recording_downloads = {}
|
23
23
|
end
|
@@ -44,7 +44,7 @@ class TwilioRecordings
|
|
44
44
|
|
45
45
|
##
|
46
46
|
# Return the Faraday connection used to download the recordings.
|
47
|
-
#
|
47
|
+
#
|
48
48
|
# Will create a new connection if one has not already been set with connection=.
|
49
49
|
#
|
50
50
|
# Example:
|
@@ -88,7 +88,7 @@ class TwilioRecordings
|
|
88
88
|
##
|
89
89
|
# Join the recordings together into a single file. Returns the output filename.
|
90
90
|
#
|
91
|
-
# Example:
|
91
|
+
# Example:
|
92
92
|
# >> t.join('~/my_file.mp3')
|
93
93
|
# => "~/my_file.mp3"
|
94
94
|
#
|
@@ -99,4 +99,15 @@ class TwilioRecordings
|
|
99
99
|
`cat #{filenames.join(" ")} > #{output}`
|
100
100
|
output
|
101
101
|
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# Sanitize the filename.
|
105
|
+
#
|
106
|
+
# Returns the sanitized filename.
|
107
|
+
#
|
108
|
+
# Example:
|
109
|
+
# TwilioRecordings.sanitize('../etc/passwd') => 'etcpasswd'
|
110
|
+
def self.sanitize(filename)
|
111
|
+
filename.gsub(/[^a-zA-Z0-9]/, '')
|
112
|
+
end
|
102
113
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio_recordings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Boxley
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.0.
|
67
|
+
rubygems_version: 2.0.14
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: TwilioRecordings
|