Class: Twilio::REST::Verify::V2::ServiceContext::WebhookContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Verify::V2::ServiceContext::WebhookContext
- Defined in:
- lib/twilio-ruby/rest/verify/v2/service/webhook.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the WebhookInstance.
-
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance.
-
#initialize(version, service_sid, sid) ⇒ WebhookContext
constructor
Initialize the WebhookContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
Constructor Details
#initialize(version, service_sid, sid) ⇒ WebhookContext
Initialize the WebhookContext
177 178 179 180 181 182 183 184 185 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 177 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Webhooks/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the WebhookInstance
189 190 191 192 193 194 195 196 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 189 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 201 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) WebhookInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
267 268 269 270 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 267 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Verify.V2.WebhookContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
260 261 262 263 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 260 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Verify.V2.WebhookContext #{context}>" end |
#update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset) ⇒ WebhookInstance
Update the WebhookInstance
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 226 def update( friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'EventTypes' => Twilio.serialize_list(event_types) { |e| e }, 'WebhookUrl' => webhook_url, 'Status' => status, 'Version' => version, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) WebhookInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |