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.


190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 190

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_sidString

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.


222
223
224
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 222

def chat_service_sid
    @properties['chat_service_sid']
end

#contextConfigurationContext

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

Returns:


213
214
215
216
217
218
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 213

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

#default_chat_service_role_sidString

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

Returns:


240
241
242
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 240

def default_chat_service_role_sid
    @properties['default_chat_service_role_sid']
end

#default_conversation_creator_role_sidString

Returns The conversation-level role assigned to a conversation creator when they join a new conversation. See [Conversation Role](www.twilio.com/docs/conversations/api/role-resource) for more info about roles.

Returns:


228
229
230
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 228

def default_conversation_creator_role_sid
    @properties['default_conversation_creator_role_sid']
end

#default_conversation_role_sidString

Returns The conversation-level role assigned to users when they are added to a conversation. See [Conversation Role](www.twilio.com/docs/conversations/api/role-resource) for more info about roles.

Returns:


234
235
236
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 234

def default_conversation_role_sid
    @properties['default_conversation_role_sid']
end

#fetchConfigurationInstance

Fetch the ConfigurationInstance

Returns:


265
266
267
268
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 265

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


315
316
317
318
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 315

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.


252
253
254
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 252

def links
    @properties['links']
end

#notificationsnotifications

Access the notifications

Returns:


302
303
304
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 302

def notifications
    context.notifications
end

#reachability_enabledBoolean

Returns Whether the [Reachability Indicator](www.twilio.com/docs/conversations/reachability) is enabled for this Conversations Service. The default is ‘false`.

Returns:


258
259
260
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 258

def reachability_enabled
    @properties['reachability_enabled']
end

#to_sObject

Provide a user friendly representation


308
309
310
311
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 308

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:

Returns:


277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 277

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

#urlString

Returns An absolute API resource URL for this service configuration.

Returns:

  • (String)

    An absolute API resource URL for this service configuration.


246
247
248
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 246

def url
    @properties['url']
end

#webhookswebhooks

Access the webhooks

Returns:


295
296
297
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration.rb', line 295

def webhooks
    context.webhooks
end