twilio-ruby 3.4.2 → 3.5.0
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.
- data/LICENSE +1 -1
- data/README.md +63 -63
- data/conf/cacert.pem +3376 -0
- data/lib/twilio-ruby/rest/client.rb +26 -10
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +5 -4
|
@@ -79,13 +79,15 @@ module Twilio
|
|
|
79
79
|
#
|
|
80
80
|
# Declare whether to verify the host's ssl cert when setting up the
|
|
81
81
|
# connection to the above domain. Defaults to true, but can be turned off
|
|
82
|
-
# to avoid
|
|
83
|
-
#
|
|
82
|
+
# to avoid ssl certificate verification failures in environments without
|
|
83
|
+
# the necessary ca certificates.
|
|
84
84
|
#
|
|
85
85
|
# === <tt>:ssl_ca_file => '/path/to/ca/file'</tt>
|
|
86
86
|
#
|
|
87
87
|
# Specify the path to the certificate authority bundle you'd like to use
|
|
88
|
-
#
|
|
88
|
+
# to verify Twilio's SSL certificate on each request. If not specified, a
|
|
89
|
+
# certificate bundle extraced from Firefox is packaged with the gem and
|
|
90
|
+
# used by default.
|
|
89
91
|
#
|
|
90
92
|
# === <tt>:timeout => 30</tt>
|
|
91
93
|
#
|
|
@@ -111,7 +113,7 @@ module Twilio
|
|
|
111
113
|
# === <tt>:proxy_pass => 'password'</tt>
|
|
112
114
|
#
|
|
113
115
|
# The password to use for authentication with the proxy. Defaults to nil.
|
|
114
|
-
def initialize(account_sid, auth_token, options
|
|
116
|
+
def initialize(account_sid, auth_token, options={})
|
|
115
117
|
@account_sid, @auth_token = account_sid.strip, auth_token.strip
|
|
116
118
|
set_up_connection_from options
|
|
117
119
|
set_up_subresources
|
|
@@ -148,7 +150,7 @@ module Twilio
|
|
|
148
150
|
# body.
|
|
149
151
|
#
|
|
150
152
|
# Returns the raw Net::HTTP::Response object.
|
|
151
|
-
def request(uri, method
|
|
153
|
+
def request(uri, method='POST', params={}) # :nodoc:
|
|
152
154
|
raise ArgumentError, 'Invalid path parameter' if uri.empty?
|
|
153
155
|
|
|
154
156
|
uri = "/#{uri}" unless uri.start_with? '/'
|
|
@@ -179,19 +181,33 @@ module Twilio
|
|
|
179
181
|
##
|
|
180
182
|
# Set up and cache a Net::HTTP object to use when making requests. This is
|
|
181
183
|
# a private method documented for completeness.
|
|
182
|
-
def set_up_connection_from(options
|
|
184
|
+
def set_up_connection_from(options={}) # :doc:
|
|
183
185
|
config = {:host => 'api.twilio.com', :port => 443, :use_ssl => true,
|
|
184
186
|
:ssl_verify_peer => true, :timeout => 30}.merge! options
|
|
185
187
|
connection_class = Net::HTTP::Proxy config[:proxy_addr],
|
|
186
188
|
config[:proxy_port], config[:proxy_user], config[:proxy_pass]
|
|
187
189
|
@connection = connection_class.new config[:host], config[:port]
|
|
190
|
+
set_up_ssl_from config
|
|
191
|
+
@connection.open_timeout = options[:timeout]
|
|
192
|
+
@connection.read_timeout = options[:timeout]
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
##
|
|
196
|
+
# Set up the ssl properties of the <tt>@connection</tt> Net::HTTP object.
|
|
197
|
+
# This is a private method documented for completeness.
|
|
198
|
+
def set_up_ssl_from(config) # :doc:
|
|
188
199
|
@connection.use_ssl = config[:use_ssl]
|
|
189
|
-
|
|
190
|
-
|
|
200
|
+
if config[:ssl_verify_peer]
|
|
201
|
+
@connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
202
|
+
if config[:ssl_ca_file]
|
|
203
|
+
@connection.ca_file = config[:ssl_ca_file]
|
|
204
|
+
else
|
|
205
|
+
conf_dir = File.dirname(__FILE__) + '/../../../conf'
|
|
206
|
+
@connection.ca_file = conf_dir + '/cacert.pem'
|
|
207
|
+
end
|
|
208
|
+
else
|
|
191
209
|
@connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
192
210
|
end
|
|
193
|
-
@connection.open_timeout = options[:timeout]
|
|
194
|
-
@connection.read_timeout = options[:timeout]
|
|
195
211
|
end
|
|
196
212
|
|
|
197
213
|
##
|
data/lib/twilio-ruby/version.rb
CHANGED
metadata
CHANGED
|
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 3
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
version: 3.
|
|
8
|
+
- 5
|
|
9
|
+
- 0
|
|
10
|
+
version: 3.5.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Andrew Benton
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date:
|
|
18
|
+
date: 2012-01-06 00:00:00 -08:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -146,6 +146,7 @@ files:
|
|
|
146
146
|
- LICENSE
|
|
147
147
|
- README.md
|
|
148
148
|
- Rakefile
|
|
149
|
+
- conf/cacert.pem
|
|
149
150
|
- examples.rb
|
|
150
151
|
- lib/twilio-ruby.rb
|
|
151
152
|
- lib/twilio-ruby/rest/accounts.rb
|