Class: Twilio::REST::Verify::V2::ServiceContext::EntityContext::ChallengeContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Verify::V2::ServiceContext::EntityContext::ChallengeContext
- Defined in:
- lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb,
lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb
Defined Under Namespace
Classes: NotificationInstance, NotificationList, NotificationListResponse, NotificationPage, NotificationPageMetadata
Instance Method Summary collapse
-
#fetch ⇒ ChallengeInstance
Fetch the ChallengeInstance.
-
#fetch_with_metadata ⇒ ChallengeInstance
Fetch the ChallengeInstanceMetadata.
-
#initialize(version, service_sid, identity, sid) ⇒ ChallengeContext
constructor
Initialize the ChallengeContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#notifications ⇒ NotificationList, NotificationContext
Access the notifications.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(auth_payload: :unset, metadata: :unset) ⇒ ChallengeInstance
Update the ChallengeInstance.
-
#update_with_metadata(auth_payload: :unset, metadata: :unset) ⇒ ChallengeInstance
Update the ChallengeInstanceMetadata.
Constructor Details
#initialize(version, service_sid, identity, sid) ⇒ ChallengeContext
Initialize the ChallengeContext
286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 286 def initialize(version, service_sid, identity, sid) super(version) # Path Solution @solution = { service_sid: service_sid, identity: identity, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}/Challenges/#{@solution[:sid]}" # Dependents @notifications = nil end |
Instance Method Details
#fetch ⇒ ChallengeInstance
Fetch the ChallengeInstance
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 300 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ChallengeInstance.new( @version, payload, service_sid: @solution[:service_sid], identity: @solution[:identity], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ ChallengeInstance
Fetch the ChallengeInstanceMetadata
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 321 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) challenge_instance = ChallengeInstance.new( @version, response.body, service_sid: @solution[:service_sid], identity: @solution[:identity], sid: @solution[:sid], ) ChallengeInstanceMetadata.new( @version, challenge_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
434 435 436 437 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 434 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Verify.V2.ChallengeContext #{context}>" end |
#notifications ⇒ NotificationList, NotificationContext
Access the notifications
417 418 419 420 421 422 423 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 417 def notifications unless @notifications @notifications = NotificationList.new( @version, service_sid: @solution[:service_sid], identity: @solution[:identity], challenge_sid: @solution[:sid], ) end @notifications end |
#to_s ⇒ Object
Provide a user friendly representation
427 428 429 430 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 427 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Verify.V2.ChallengeContext #{context}>" end |
#update(auth_payload: :unset, metadata: :unset) ⇒ ChallengeInstance
Update the ChallengeInstance
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 350 def update( auth_payload: :unset, metadata: :unset ) data = Twilio::Values.of({ 'AuthPayload' => auth_payload, 'Metadata' => Twilio.serialize_object(), }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) ChallengeInstance.new( @version, payload, service_sid: @solution[:service_sid], identity: @solution[:identity], sid: @solution[:sid], ) end |
#update_with_metadata(auth_payload: :unset, metadata: :unset) ⇒ ChallengeInstance
Update the ChallengeInstanceMetadata
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 381 def ( auth_payload: :unset, metadata: :unset ) data = Twilio::Values.of({ 'AuthPayload' => auth_payload, 'Metadata' => Twilio.serialize_object(), }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) challenge_instance = ChallengeInstance.new( @version, response.body, service_sid: @solution[:service_sid], identity: @solution[:identity], sid: @solution[:sid], ) ChallengeInstanceMetadata.new( @version, challenge_instance, response.headers, response.status_code ) end |