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

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

Defined Under Namespace

Classes: NotificationContext, NotificationInstance, NotificationList, NotificationPage

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.


71
72
73
74
75
76
77
78
79
80
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 71

def initialize(version, chat_service_sid)
  super(version)

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

  # Components
  @notifications = nil
end

Instance Method Details

#fetchConfigurationInstance

Fetch the ConfigurationInstance

Returns:


85
86
87
88
89
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 85

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


139
140
141
142
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 139

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

#notificationsNotificationContext

Access the notifications

Returns:


126
127
128
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 126

def notifications
  return NotificationContext.new(@version, @solution[:chat_service_sid], )
end

#to_sObject

Provide a user friendly representation


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

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, 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 the 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 the 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 the 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:


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

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

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

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