Skip to content

Commit

Permalink
remove the old deprecated request interface
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmbenton committed Feb 3, 2012
1 parent 088e161 commit 5261fa5
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions lib/twilio-ruby/rest/client.rb
Expand Up @@ -161,42 +161,6 @@ def inspect # :nodoc:
end
end

##
# Mimic the old (deprecated) interface. Make an HTTP request to Twilio
# using the given +method+ and +uri+. If the +method+ is <tt>'GET'</tt>
# then +params+ are appended to the +uri+ as urlencoded query parameters.
# If the +method+ is <tt>'POST'</tt> or <tt>'PUT'</tt> then +params+ are
# passed as an application/x-www-form-urlencoded string in the request
# body.
#
# Returns the raw Net::HTTP::Response object.
def request(uri, method='POST', params={}) # :nodoc:
raise ArgumentError, 'Invalid path parameter' if uri.empty?

uri = "/#{uri}" unless uri.start_with? '/'

case method.upcase
when 'GET'
uri << "?#{url_encode(params)}" if params
req = Net::HTTP::Get.new uri
when 'DELETE'
req = Net::HTTP::Delete.new uri
when 'PUT'
req = Net::HTTP::Put.new uri
req.form_data = params
when 'POST'
req = Net::HTTP::Post.new uri
req.form_data = params
else
raise NotImplementedError, "HTTP #{method} not implemented"
end

req['User-Agent'] = 'twilio-ruby/deprecated'
req.basic_auth @account_sid, @auth_token
@last_request = req
@last_response = @connection.request req
end

private

##
Expand Down

0 comments on commit 5261fa5

Please sign in to comment.