twilio_recordings 0.0.6 → 0.0.7

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/twilio_recordings.rb +16 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c20ea2d1480a07c313a62fa6b2ff6b30983ddd6c
4
- data.tar.gz: afeb189f72a82658cb4a35cb39de1299f9ca25d6
3
+ metadata.gz: b82464745bd864b23b18200a752942e511554f8d
4
+ data.tar.gz: 48db032d6c9ace15122eaca0217703c18da0ccd6
5
5
  SHA512:
6
- metadata.gz: bc9df51265dcd918f6a6ff9c25cd1ff134d668b71f4a556cf18712515927009eaf17b7f87dc92b7a78aab03941d08ca7b161dd4d3738240fd0837077b41b4276
7
- data.tar.gz: afc2cd3426bf0931b5f36ecc1216feaa3b72d5dc04ef456a07eb191cc30e8a032ed262214e96a4a1e2185586a1b29e60f7b9d18e72f66232364ae2ee78382ad2
6
+ metadata.gz: a6ff3f5523953e6452b08ac4130fe0fbb982283252fa0689b75962f2fa4223f1f7cb251e80f75ea3d2ea4afa21ff3b3279319aa36e99b010773cdaa7cd80a5b5
7
+ data.tar.gz: 9859f7880ecce0dedaf94d7a05a937780da9dbb436b42da393c8f054080c49729fe4d58d383debbe48becca24ba3fbe8894f5085c762f2d469d9618da5bb839b
@@ -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.6
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.2
67
+ rubygems_version: 2.0.14
68
68
  signing_key:
69
69
  specification_version: 4
70
70
  summary: TwilioRecordings