Class: Twilio::REST::Conversations::V1::ServiceContext::ConfigurationInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/service/configuration.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, chat_service_sid: nil) ⇒ ConfigurationInstance

Initialize the ConfigurationInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • account_sid (String) —

    The SID of the Account that created this Configuration resource.

  • sid (String) —

    The SID of the Call resource to fetch.



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 307

def initialize(version, payload , chat_service_sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'chat_service_sid' => payload['chat_service_sid'],
        'default_conversation_creator_role_sid' => payload['default_conversation_creator_role_sid'],
        'default_conversation_role_sid' => payload['default_conversation_role_sid'],
        'default_chat_service_role_sid' => payload['default_chat_service_role_sid'],
        'url' => payload['url'],
        'links' => payload['links'],
        'reachability_enabled' => payload['reachability_enabled'],
    }

    # Context
    @instance_context = nil
    @params = { 'chat_service_sid' => chat_service_sid  || @properties['chat_service_sid']  , }
end

Instance Method Details

#chat_service_sid ⇒ String

Returns The unique string that we created to identify the Service configuration resource.

Returns:

  • (String) —

    The unique string that we created to identify the Service configuration resource.



340
341
342
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 340

def chat_service_sid
    @properties['chat_service_sid']
end

#context ⇒ ConfigurationContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



331
332
333
334
335
336
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 331

def context
    unless @instance_context
        @instance_context = ConfigurationContext.new(@version , @params['chat_service_sid'])
    end
    @instance_context
end

#default_chat_service_role_sid ⇒ String

Returns The service-level role assigned to users when they are added to the service. See Conversation Role for more info about roles.

Returns:

  • (String) —

    The service-level role assigned to users when they are added to the service. See Conversation Role for more info about roles.



358
359
360
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 358

def default_chat_service_role_sid
    @properties['default_chat_service_role_sid']
end

#default_conversation_creator_role_sid ⇒ String

Returns The conversation-level role assigned to a conversation creator when they join a new conversation. See Conversation Role for more info about roles.

Returns:

  • (String) —

    The conversation-level role assigned to a conversation creator when they join a new conversation. See Conversation Role for more info about roles.



346
347
348
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 346

def default_conversation_creator_role_sid
    @properties['default_conversation_creator_role_sid']
end

#default_conversation_role_sid ⇒ String

Returns The conversation-level role assigned to users when they are added to a conversation. See Conversation Role for more info about roles.

Returns:

  • (String) —

    The conversation-level role assigned to users when they are added to a conversation. See Conversation Role for more info about roles.



352
353
354
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 352

def default_conversation_role_sid
    @properties['default_conversation_role_sid']
end

#fetch ⇒ ConfigurationInstance

Fetch the ConfigurationInstance

Returns:



383
384
385
386
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 383

def fetch

    context.fetch
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



433
434
435
436
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 433

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Conversations.V1.ConfigurationInstance #{values}>"
end

Returns Contains an absolute API resource URL to access the push notifications configuration of this service.

Returns:

  • (Hash) —

    Contains an absolute API resource URL to access the push notifications configuration of this service.



370
371
372
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 370

def links
    @properties['links']
end

#notifications ⇒ notifications

Access the notifications

Returns:



420
421
422
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 420

def notifications
    context.notifications
end

#reachability_enabled ⇒ Boolean

Returns Whether the Reachability Indicator is enabled for this Conversations Service. The default is false.

Returns:

  • (Boolean) —

    Whether the Reachability Indicator is enabled for this Conversations Service. The default is false.



376
377
378
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 376

def reachability_enabled
    @properties['reachability_enabled']
end

#to_s ⇒ Object

Provide a user friendly representation



426
427
428
429
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 426

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Conversations.V1.ConfigurationInstance #{values}>"
end

#update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset, reachability_enabled: :unset) ⇒ ConfigurationInstance

Update the ConfigurationInstance

Parameters:

  • default_conversation_creator_role_sid (String) (defaults to: :unset) —

    The conversation-level role assigned to a conversation creator when they join a new conversation. See Conversation Role for more info about roles.

  • default_conversation_role_sid (String) (defaults to: :unset) —

    The conversation-level role assigned to users when they are added to a conversation. See Conversation Role for more info about roles.

  • default_chat_service_role_sid (String) (defaults to: :unset) —

    The service-level role assigned to users when they are added to the service. See Conversation Role for more info about roles.

  • reachability_enabled (Boolean) (defaults to: :unset) —

    Whether the Reachability Indicator is enabled for this Conversations Service. The default is false.

Returns:



395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 395

def update(
  default_conversation_creator_role_sid: :unset, 
  default_conversation_role_sid: :unset, 
  default_chat_service_role_sid: :unset, 
  reachability_enabled: :unset
)

    context.update(
        default_conversation_creator_role_sid: default_conversation_creator_role_sid, 
        default_conversation_role_sid: default_conversation_role_sid, 
        default_chat_service_role_sid: default_chat_service_role_sid, 
        reachability_enabled: reachability_enabled, 
    )
end

#url ⇒ String

Returns An absolute API resource URL for this service configuration.

Returns:

  • (String) —

    An absolute API resource URL for this service configuration.



364
365
366
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 364

def url
    @properties['url']
end

#webhooks ⇒ webhooks

Access the webhooks

Returns:



413
414
415
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 413

def webhooks
    context.webhooks
end