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/webhook.rb,
lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb

Defined Under Namespace

Classes: NotificationContext, NotificationInstance, NotificationList, NotificationPage, WebhookContext, WebhookInstance, WebhookList, WebhookPage

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
81
# 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
  @webhooks = nil
end

Instance Method Details

#fetchConfigurationInstance

Fetch the ConfigurationInstance

Returns:


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

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


147
148
149
150
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 147

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

#notificationsNotificationContext

Access the notifications

Returns:


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

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

#to_sObject

Provide a user friendly representation


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

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:


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

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

#webhooksWebhookContext

Access the webhooks

Returns:


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

def webhooks
  return WebhookContext.new(@version, @solution[:chat_service_sid], )
end