Class: Mock::Twilio::Webhooks::CustomerProfiles
- Defined in:
- lib/mock/twilio/webhooks/customer_profiles.rb
Constant Summary collapse
- URL =
"/webhooks/twilio/customer_profiles_compliance"
Constants inherited from Base
Class Method Summary collapse
Methods inherited from Base
auth_twilio, build_signature_for_request, headers, twilio_client, webhook_client
Class Method Details
.trigger(sid, status) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mock/twilio/webhooks/customer_profiles.rb', line 9 def self.trigger(sid, status) # Wait simulation from twilio sleep DELAY.sample request_url = Mock::Twilio.proto + "://" + Mock::Twilio.forwarded_host + URL data = { :BundleSid=>sid, :Status=>status } signature = build_signature_for_request(request_url, data) response = webhook_client.request(Mock::Twilio.host, Mock::Twilio.port, 'POST', URL, nil, data, headers.merge!({ 'X-Twilio-Signature': signature }), auth_twilio, nil) case response.status when 200..204 response when 400..600 raise Webhooks::RestError, Mock::Twilio::ErrorHandler.new(response).raise end end |