Class: Twilio::REST::Conversations::V1::ServiceContext::ConfigurationContext

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

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, chat_service_sid) ⇒ ConfigurationContext

Initialize the ConfigurationContext

Parameters:

  • version (Version)

    Version that contains the resource

  • chat_service_sid (String)

    The SID of the Service configuration resource to fetch.



77
78
79
80
81
82
83
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 77

def initialize(version, chat_service_sid)
  super(version)

  # Path Solution
  @solution = {chat_service_sid: chat_service_sid, }
  @uri = "/Services/#{@solution[:chat_service_sid]}/Configuration"
end

Instance Method Details

#fetchConfigurationInstance

Fetch the ConfigurationInstance

Returns:



88
89
90
91
92
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 88

def fetch
  payload = @version.fetch('GET', @uri)

  ConfigurationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
end

#inspectObject

Provide a detailed, user friendly representation



130
131
132
133
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 130

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

#to_sObject

Provide a user friendly representation



123
124
125
126
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 123

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

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

Update the ConfigurationInstance

Parameters:

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

    The role assigned to a conversation creator when they join a new conversation. See the [Role resource](www.twilio.com/docs/chat/rest/role-resource) for more info about roles.

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

    The role assigned to users when they are added to a conversation. See the [Role resource](www.twilio.com/docs/chat/rest/role-resource) for more info about roles.

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

    The service role assigned to users when they are added to the service. See the [Role resource](www.twilio.com/docs/chat/rest/role-resource) for more info about roles.

Returns:



109
110
111
112
113
114
115
116
117
118
119
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 109

def update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset)
  data = Twilio::Values.of({
      'DefaultConversationCreatorRoleSid' => default_conversation_creator_role_sid,
      'DefaultConversationRoleSid' => default_conversation_role_sid,
      'DefaultChatServiceRoleSid' => default_chat_service_role_sid,
  })

  payload = @version.update('POST', @uri, data: data)

  ConfigurationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
end