lib/twilio.rb in twilio-2.9.0 vs lib/twilio.rb in twilio-3.0.0
- old
+ new
@@ -21,18 +21,33 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
require 'httparty'
require 'builder'
+
require 'twilio/twilio_object'
+
require 'twilio/account'
+require 'twilio/available_phone_numbers'
require 'twilio/call'
-require 'twilio/sms'
-require 'twilio/connection'
+require 'twilio/conference'
require 'twilio/incoming_phone_number'
-require 'twilio/local_phone_number'
require 'twilio/notification'
require 'twilio/outgoing_caller_id'
require 'twilio/recording'
-require 'twilio/toll_free_phone_number'
-require 'twilio/conference'
-require 'twilio/verb'
\ No newline at end of file
+require 'twilio/sms'
+require 'twilio/verb'
+
+module Twilio
+ include HTTParty
+ TWILIO_URL = "https://api.twilio.com/2010-04-01/Accounts"
+ SSL_CA_PATH = "/etc/ssl/certs"
+
+ # The connect method caches your Twilio account id and authentication token
+ # Example:
+ # Twilio.connect('AC309475e5fede1b49e100272a8640f438', '3a2630a909aadbf60266234756fb15a0')
+ def self.connect(account_sid, auth_token)
+ self.base_uri "#{TWILIO_URL}/#{account_sid}"
+ self.basic_auth account_sid, auth_token
+ self.default_options[:ssl_ca_path] ||= SSL_CA_PATH unless self.default_options[:ssl_ca_file]
+ end
+end