Class: Twilio::REST::Trusthub::V1::CustomerProfilesContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb,
lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.rb,
lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.rb,
lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb

Defined Under Namespace

Classes: CustomerProfilesChannelEndpointAssignmentContext, CustomerProfilesChannelEndpointAssignmentInstance, CustomerProfilesChannelEndpointAssignmentInstanceMetadata, CustomerProfilesChannelEndpointAssignmentList, CustomerProfilesChannelEndpointAssignmentListResponse, CustomerProfilesChannelEndpointAssignmentPage, CustomerProfilesChannelEndpointAssignmentPageMetadata, CustomerProfilesEntityAssignmentsContext, CustomerProfilesEntityAssignmentsInstance, CustomerProfilesEntityAssignmentsInstanceMetadata, CustomerProfilesEntityAssignmentsList, CustomerProfilesEntityAssignmentsListResponse, CustomerProfilesEntityAssignmentsPage, CustomerProfilesEntityAssignmentsPageMetadata, CustomerProfilesEvaluationsContext, CustomerProfilesEvaluationsInstance, CustomerProfilesEvaluationsInstanceMetadata, CustomerProfilesEvaluationsList, CustomerProfilesEvaluationsListResponse, CustomerProfilesEvaluationsPage, CustomerProfilesEvaluationsPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ CustomerProfilesContext

Initialize the CustomerProfilesContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The unique string that we created to identify the Customer-Profile resource.



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

def initialize(version, sid)
    super(version)
    

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

    # Dependents
    @customer_profiles_channel_endpoint_assignment = nil
    @customer_profiles_entity_assignments = nil
    @customer_profiles_evaluations = nil
end

Instance Method Details

#customer_profiles_channel_endpoint_assignment(sid = :unset) ⇒ CustomerProfilesChannelEndpointAssignmentList, CustomerProfilesChannelEndpointAssignmentContext

Access the customer_profiles_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/customer_profiles.rb', line 434

def customer_profiles_channel_endpoint_assignment(sid=:unset)

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

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

    unless @customer_profiles_channel_endpoint_assignment
        @customer_profiles_channel_endpoint_assignment = CustomerProfilesChannelEndpointAssignmentList.new(
            @version, customer_profile_sid: @solution[:sid], )
    end

 @customer_profiles_channel_endpoint_assignment
end

#customer_profiles_entity_assignments(sid = :unset) ⇒ CustomerProfilesEntityAssignmentsList, CustomerProfilesEntityAssignmentsContext

Access the customer_profiles_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/customer_profiles.rb', line 453

def customer_profiles_entity_assignments(sid=:unset)

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

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

    unless @customer_profiles_entity_assignments
        @customer_profiles_entity_assignments = CustomerProfilesEntityAssignmentsList.new(
            @version, customer_profile_sid: @solution[:sid], )
    end

 @customer_profiles_entity_assignments
end

#customer_profiles_evaluations(sid = :unset) ⇒ CustomerProfilesEvaluationsList, CustomerProfilesEvaluationsContext

Access the customer_profiles_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/customer_profiles.rb', line 472

def customer_profiles_evaluations(sid=:unset)

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

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

    unless @customer_profiles_evaluations
        @customer_profiles_evaluations = CustomerProfilesEvaluationsList.new(
            @version, customer_profile_sid: @solution[:sid], )
    end

 @customer_profiles_evaluations
end

#deleteBoolean

Delete the CustomerProfilesInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



281
282
283
284
285
286
287
288
289
# File 'lib/twilio-ruby/rest/trusthub/v1/customer_profiles.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 CustomerProfilesInstanceMetadata

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/customer_profiles.rb', line 294

def 

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

#fetchCustomerProfilesInstance

Fetch the CustomerProfilesInstance

Returns:



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

def fetch

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

#fetch_with_metadataCustomerProfilesInstance

Fetch the CustomerProfilesInstanceMetadata

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/customer_profiles.rb', line 332

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    customer_profiles_instance = CustomerProfilesInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    CustomerProfilesInstanceMetadata.new(
        @version,
        customer_profiles_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/customer_profiles.rb', line 497

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

#to_sObject

Provide a user friendly representation



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

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

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

Update the CustomerProfilesInstance

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 Customer-Profile 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/customer_profiles.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)
    CustomerProfilesInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

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

Update the CustomerProfilesInstanceMetadata

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 Customer-Profile 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/customer_profiles.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)
    customer_profiles_instance = CustomerProfilesInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    CustomerProfilesInstanceMetadata.new(
        @version,
        customer_profiles_instance,
        response.headers,
        response.status_code
    )
end