Class: Twilio::REST::Trusthub::V1::TrustProductsContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/trusthub/v1/trust_products.rb,
lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_evaluations.rb,
lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.rb,
lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.rb

Defined Under Namespace

Classes: TrustProductsChannelEndpointAssignmentContext, TrustProductsChannelEndpointAssignmentInstance, TrustProductsChannelEndpointAssignmentInstanceMetadata, TrustProductsChannelEndpointAssignmentList, TrustProductsChannelEndpointAssignmentListResponse, TrustProductsChannelEndpointAssignmentPage, TrustProductsChannelEndpointAssignmentPageMetadata, TrustProductsEntityAssignmentsContext, TrustProductsEntityAssignmentsInstance, TrustProductsEntityAssignmentsInstanceMetadata, TrustProductsEntityAssignmentsList, TrustProductsEntityAssignmentsListResponse, TrustProductsEntityAssignmentsPage, TrustProductsEntityAssignmentsPageMetadata, TrustProductsEvaluationsContext, TrustProductsEvaluationsInstance, TrustProductsEvaluationsInstanceMetadata, TrustProductsEvaluationsList, TrustProductsEvaluationsListResponse, TrustProductsEvaluationsPage, TrustProductsEvaluationsPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ TrustProductsContext

Initialize the TrustProductsContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The unique string that we created to identify the Trust Product resource.



265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 265

def initialize(version, sid)
    super(version)
    

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/TrustProducts/#{@solution[:sid]}"

    # Dependents
    @trust_products_channel_endpoint_assignment = nil
    @trust_products_entity_assignments = nil
    @trust_products_evaluations = nil
end

Instance Method Details

#deleteBoolean

Delete the TrustProductsInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



281
282
283
284
285
286
287
288
289
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 281

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the TrustProductsInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 294

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      trustProducts_instance = TrustProductsInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      TrustProductsInstanceMetadata.new(@version, trustProducts_instance, response.headers, response.status_code)
end

#fetchTrustProductsInstance

Fetch the TrustProductsInstance

Returns:



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 313

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    TrustProductsInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#fetch_with_metadataTrustProductsInstance

Fetch the TrustProductsInstanceMetadata

Returns:



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 332

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    trust_products_instance = TrustProductsInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    TrustProductsInstanceMetadata.new(
        @version,
        trust_products_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



497
498
499
500
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 497

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Trusthub.V1.TrustProductsContext #{context}>"
end

#to_sObject

Provide a user friendly representation



490
491
492
493
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 490

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Trusthub.V1.TrustProductsContext #{context}>"
end

#trust_products_channel_endpoint_assignment(sid = :unset) ⇒ TrustProductsChannelEndpointAssignmentList, TrustProductsChannelEndpointAssignmentContext

Access the trust_products_channel_endpoint_assignment

Returns:

Raises:

  • (ArgumentError)


434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 434

def trust_products_channel_endpoint_assignment(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return TrustProductsChannelEndpointAssignmentContext.new(@version, @solution[:sid],sid )
    end

    unless @trust_products_channel_endpoint_assignment
        @trust_products_channel_endpoint_assignment = TrustProductsChannelEndpointAssignmentList.new(
            @version, trust_product_sid: @solution[:sid], )
    end

 @trust_products_channel_endpoint_assignment
end

#trust_products_entity_assignments(sid = :unset) ⇒ TrustProductsEntityAssignmentsList, TrustProductsEntityAssignmentsContext

Access the trust_products_entity_assignments

Returns:

Raises:

  • (ArgumentError)


453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 453

def trust_products_entity_assignments(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return TrustProductsEntityAssignmentsContext.new(@version, @solution[:sid],sid )
    end

    unless @trust_products_entity_assignments
        @trust_products_entity_assignments = TrustProductsEntityAssignmentsList.new(
            @version, trust_product_sid: @solution[:sid], )
    end

 @trust_products_entity_assignments
end

#trust_products_evaluations(sid = :unset) ⇒ TrustProductsEvaluationsList, TrustProductsEvaluationsContext

Access the trust_products_evaluations

Returns:

Raises:

  • (ArgumentError)


472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 472

def trust_products_evaluations(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return TrustProductsEvaluationsContext.new(@version, @solution[:sid],sid )
    end

    unless @trust_products_evaluations
        @trust_products_evaluations = TrustProductsEvaluationsList.new(
            @version, trust_product_sid: @solution[:sid], )
    end

 @trust_products_evaluations
end

#update(status: :unset, status_callback: :unset, friendly_name: :unset, email: :unset) ⇒ TrustProductsInstance

Update the TrustProductsInstance

Parameters:

  • status (Status) (defaults to: :unset)
  • status_callback (String) (defaults to: :unset)

    The URL we call to inform your application of status changes.

  • friendly_name (String) (defaults to: :unset)

    The string that you assigned to describe the resource.

  • email (String) (defaults to: :unset)

    The email address that will receive updates when the Trust Product resource changes status.

Returns:



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 361

def update(
  status: :unset, 
  status_callback: :unset, 
  friendly_name: :unset, 
  email: :unset
)

    data = Twilio::Values.of({
        'Status' => status,
        'StatusCallback' => status_callback,
        'FriendlyName' => friendly_name,
        'Email' => email,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    TrustProductsInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#update_with_metadata(status: :unset, status_callback: :unset, friendly_name: :unset, email: :unset) ⇒ TrustProductsInstance

Update the TrustProductsInstanceMetadata

Parameters:

  • status (Status) (defaults to: :unset)
  • status_callback (String) (defaults to: :unset)

    The URL we call to inform your application of status changes.

  • friendly_name (String) (defaults to: :unset)

    The string that you assigned to describe the resource.

  • email (String) (defaults to: :unset)

    The email address that will receive updates when the Trust Product resource changes status.

Returns:



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 396

def (
  status: :unset, 
  status_callback: :unset, 
  friendly_name: :unset, 
  email: :unset
)

    data = Twilio::Values.of({
        'Status' => status,
        'StatusCallback' => status_callback,
        'FriendlyName' => friendly_name,
        'Email' => email,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    trust_products_instance = TrustProductsInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    TrustProductsInstanceMetadata.new(
        @version,
        trust_products_instance,
        response.headers,
        response.status_code
    )
end