lib/gateway.rb in twilio_contactable-0.8.5 vs lib/gateway.rb in twilio_contactable-0.8.7
- old
+ new
@@ -15,20 +15,24 @@
" but you have not specified this class "+
"as a possible recipient in a controller."
end
end
class Response
- def initialize(*args)
- @options = args.last
+ def initialize(response = nil)
+ @response = response
end
-
+ end
+ class Success < Response
def success?
- :success == @options[:status]
+ true
end
end
- Success = Response.new(:status => :success)
- Error = Response.new(:status => :error)
+ class Error < Response
+ def success?
+ false
+ end
+ end
API_VERSION = '2010-04-01'
class << self
@@ -86,11 +90,11 @@
end
response = post service, data
Net::HTTPCreated == response.code_type ?
- TwilioContactable::Gateway::Success :
- TwilioContactable::Gateway::Error
+ TwilioContactable::Gateway::Success.new(response) :
+ TwilioContactable::Gateway::Error.new(response)
end
def post(service, data = {})
url = "/#{API_VERSION}/Accounts/#{TwilioContactable.configuration.client_id}/#{service}"
account.request url,