Class: Twilio::REST::IpMessaging::V1::ServiceContext

Inherits:
Twilio::REST::InstanceContext show all
Defined in:
lib/twilio-ruby/rest/ip_messaging/v1/service.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb

Defined Under Namespace

Classes: ChannelContext, ChannelInstance, ChannelInstanceMetadata, ChannelList, ChannelListResponse, ChannelPage, ChannelPageMetadata, RoleContext, RoleInstance, RoleInstanceMetadata, RoleList, RoleListResponse, RolePage, RolePageMetadata, UserContext, UserInstance, UserInstanceMetadata, UserList, UserListResponse, UserPage, UserPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ ServiceContext

Initialize the ServiceContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)


223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 223

def initialize(version, sid)
    super(version)
    

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

    # Dependents
    @channels = nil
    @roles = nil
    @users = nil
end

Instance Method Details

#channels(sid = :unset) ⇒ ChannelList, ChannelContext

Access the channels

Returns:

Raises:

  • (ArgumentError)


692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 692

def channels(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return ChannelContext.new(@version, @solution[:sid],sid )
    end

    unless @channels
        @channels = ChannelList.new(
            @version, service_sid: @solution[:sid], )
    end

 @channels
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



239
240
241
242
243
244
245
246
247
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 239

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the ServiceInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 252

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      service_instance = ServiceInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      ServiceInstanceMetadata.new(@version, service_instance, response.headers, response.status_code)
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 271

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    ServiceInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#fetch_with_metadataServiceInstance

Fetch the ServiceInstanceMetadata

Returns:



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 290

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    service_instance = ServiceInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    ServiceInstanceMetadata.new(
        @version,
        service_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



755
756
757
758
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 755

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

#roles(sid = :unset) ⇒ RoleList, RoleContext

Access the roles

Returns:

Raises:

  • (ArgumentError)


711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 711

def roles(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return RoleContext.new(@version, @solution[:sid],sid )
    end

    unless @roles
        @roles = RoleList.new(
            @version, service_sid: @solution[:sid], )
    end

 @roles
end

#to_sObject

Provide a user friendly representation



748
749
750
751
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 748

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

#update(friendly_name: :unset, default_service_role_sid: :unset, default_channel_role_sid: :unset, default_channel_creator_role_sid: :unset, read_status_enabled: :unset, reachability_enabled: :unset, typing_indicator_timeout: :unset, consumption_report_interval: :unset, notifications_new_message_enabled: :unset, notifications_new_message_template: :unset, notifications_added_to_channel_enabled: :unset, notifications_added_to_channel_template: :unset, notifications_removed_from_channel_enabled: :unset, notifications_removed_from_channel_template: :unset, notifications_invited_to_channel_enabled: :unset, notifications_invited_to_channel_template: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, webhook_method: :unset, webhook_filters: :unset, webhooks_on_message_send_url: :unset, webhooks_on_message_send_method: :unset, webhooks_on_message_update_url: :unset, webhooks_on_message_update_method: :unset, webhooks_on_message_remove_url: :unset, webhooks_on_message_remove_method: :unset, webhooks_on_channel_add_url: :unset, webhooks_on_channel_add_method: :unset, webhooks_on_channel_destroy_url: :unset, webhooks_on_channel_destroy_method: :unset, webhooks_on_channel_update_url: :unset, webhooks_on_channel_update_method: :unset, webhooks_on_member_add_url: :unset, webhooks_on_member_add_method: :unset, webhooks_on_member_remove_url: :unset, webhooks_on_member_remove_method: :unset, webhooks_on_message_sent_url: :unset, webhooks_on_message_sent_method: :unset, webhooks_on_message_updated_url: :unset, webhooks_on_message_updated_method: :unset, webhooks_on_message_removed_url: :unset, webhooks_on_message_removed_method: :unset, webhooks_on_channel_added_url: :unset, webhooks_on_channel_added_method: :unset, webhooks_on_channel_destroyed_url: :unset, webhooks_on_channel_destroyed_method: :unset, webhooks_on_channel_updated_url: :unset, webhooks_on_channel_updated_method: :unset, webhooks_on_member_added_url: :unset, webhooks_on_member_added_method: :unset, webhooks_on_member_removed_url: :unset, webhooks_on_member_removed_method: :unset, limits_channel_members: :unset, limits_user_channels: :unset) ⇒ ServiceInstance

Update the ServiceInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)
  • default_service_role_sid (String) (defaults to: :unset)
  • default_channel_role_sid (String) (defaults to: :unset)
  • default_channel_creator_role_sid (String) (defaults to: :unset)
  • read_status_enabled (Boolean) (defaults to: :unset)
  • reachability_enabled (Boolean) (defaults to: :unset)
  • typing_indicator_timeout (String) (defaults to: :unset)
  • consumption_report_interval (String) (defaults to: :unset)
  • notifications_new_message_enabled (Boolean) (defaults to: :unset)
  • notifications_new_message_template (String) (defaults to: :unset)
  • notifications_added_to_channel_enabled (Boolean) (defaults to: :unset)
  • notifications_added_to_channel_template (String) (defaults to: :unset)
  • notifications_removed_from_channel_enabled (Boolean) (defaults to: :unset)
  • notifications_removed_from_channel_template (String) (defaults to: :unset)
  • notifications_invited_to_channel_enabled (Boolean) (defaults to: :unset)
  • notifications_invited_to_channel_template (String) (defaults to: :unset)
  • pre_webhook_url (String) (defaults to: :unset)
  • post_webhook_url (String) (defaults to: :unset)
  • webhook_method (String) (defaults to: :unset)
  • webhook_filters (Array[String]) (defaults to: :unset)
  • webhooks_on_message_send_url (String) (defaults to: :unset)
  • webhooks_on_message_send_method (String) (defaults to: :unset)
  • webhooks_on_message_update_url (String) (defaults to: :unset)
  • webhooks_on_message_update_method (String) (defaults to: :unset)
  • webhooks_on_message_remove_url (String) (defaults to: :unset)
  • webhooks_on_message_remove_method (String) (defaults to: :unset)
  • webhooks_on_channel_add_url (String) (defaults to: :unset)
  • webhooks_on_channel_add_method (String) (defaults to: :unset)
  • webhooks_on_channel_destroy_url (String) (defaults to: :unset)
  • webhooks_on_channel_destroy_method (String) (defaults to: :unset)
  • webhooks_on_channel_update_url (String) (defaults to: :unset)
  • webhooks_on_channel_update_method (String) (defaults to: :unset)
  • webhooks_on_member_add_url (String) (defaults to: :unset)
  • webhooks_on_member_add_method (String) (defaults to: :unset)
  • webhooks_on_member_remove_url (String) (defaults to: :unset)
  • webhooks_on_member_remove_method (String) (defaults to: :unset)
  • webhooks_on_message_sent_url (String) (defaults to: :unset)
  • webhooks_on_message_sent_method (String) (defaults to: :unset)
  • webhooks_on_message_updated_url (String) (defaults to: :unset)
  • webhooks_on_message_updated_method (String) (defaults to: :unset)
  • webhooks_on_message_removed_url (String) (defaults to: :unset)
  • webhooks_on_message_removed_method (String) (defaults to: :unset)
  • webhooks_on_channel_added_url (String) (defaults to: :unset)
  • webhooks_on_channel_added_method (String) (defaults to: :unset)
  • webhooks_on_channel_destroyed_url (String) (defaults to: :unset)
  • webhooks_on_channel_destroyed_method (String) (defaults to: :unset)
  • webhooks_on_channel_updated_url (String) (defaults to: :unset)
  • webhooks_on_channel_updated_method (String) (defaults to: :unset)
  • webhooks_on_member_added_url (String) (defaults to: :unset)
  • webhooks_on_member_added_method (String) (defaults to: :unset)
  • webhooks_on_member_removed_url (String) (defaults to: :unset)
  • webhooks_on_member_removed_method (String) (defaults to: :unset)
  • limits_channel_members (String) (defaults to: :unset)
  • limits_user_channels (String) (defaults to: :unset)

Returns:



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 369

def update(
  friendly_name: :unset, 
  default_service_role_sid: :unset, 
  default_channel_role_sid: :unset, 
  default_channel_creator_role_sid: :unset, 
  read_status_enabled: :unset, 
  reachability_enabled: :unset, 
  typing_indicator_timeout: :unset, 
  consumption_report_interval: :unset, 
  notifications_new_message_enabled: :unset, 
  notifications_new_message_template: :unset, 
  notifications_added_to_channel_enabled: :unset, 
  notifications_added_to_channel_template: :unset, 
  notifications_removed_from_channel_enabled: :unset, 
  notifications_removed_from_channel_template: :unset, 
  notifications_invited_to_channel_enabled: :unset, 
  notifications_invited_to_channel_template: :unset, 
  pre_webhook_url: :unset, 
  post_webhook_url: :unset, 
  webhook_method: :unset, 
  webhook_filters: :unset, 
  webhooks_on_message_send_url: :unset, 
  webhooks_on_message_send_method: :unset, 
  webhooks_on_message_update_url: :unset, 
  webhooks_on_message_update_method: :unset, 
  webhooks_on_message_remove_url: :unset, 
  webhooks_on_message_remove_method: :unset, 
  webhooks_on_channel_add_url: :unset, 
  webhooks_on_channel_add_method: :unset, 
  webhooks_on_channel_destroy_url: :unset, 
  webhooks_on_channel_destroy_method: :unset, 
  webhooks_on_channel_update_url: :unset, 
  webhooks_on_channel_update_method: :unset, 
  webhooks_on_member_add_url: :unset, 
  webhooks_on_member_add_method: :unset, 
  webhooks_on_member_remove_url: :unset, 
  webhooks_on_member_remove_method: :unset, 
  webhooks_on_message_sent_url: :unset, 
  webhooks_on_message_sent_method: :unset, 
  webhooks_on_message_updated_url: :unset, 
  webhooks_on_message_updated_method: :unset, 
  webhooks_on_message_removed_url: :unset, 
  webhooks_on_message_removed_method: :unset, 
  webhooks_on_channel_added_url: :unset, 
  webhooks_on_channel_added_method: :unset, 
  webhooks_on_channel_destroyed_url: :unset, 
  webhooks_on_channel_destroyed_method: :unset, 
  webhooks_on_channel_updated_url: :unset, 
  webhooks_on_channel_updated_method: :unset, 
  webhooks_on_member_added_url: :unset, 
  webhooks_on_member_added_method: :unset, 
  webhooks_on_member_removed_url: :unset, 
  webhooks_on_member_removed_method: :unset, 
  limits_channel_members: :unset, 
  limits_user_channels: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'DefaultServiceRoleSid' => default_service_role_sid,
        'DefaultChannelRoleSid' => default_channel_role_sid,
        'DefaultChannelCreatorRoleSid' => default_channel_creator_role_sid,
        'ReadStatusEnabled' => read_status_enabled,
        'ReachabilityEnabled' => reachability_enabled,
        'TypingIndicatorTimeout' => typing_indicator_timeout,
        'ConsumptionReportInterval' => consumption_report_interval,
        'Notifications.NewMessage.Enabled' => notifications_new_message_enabled,
        'Notifications.NewMessage.Template' => notifications_new_message_template,
        'Notifications.AddedToChannel.Enabled' => notifications_added_to_channel_enabled,
        'Notifications.AddedToChannel.Template' => notifications_added_to_channel_template,
        'Notifications.RemovedFromChannel.Enabled' => notifications_removed_from_channel_enabled,
        'Notifications.RemovedFromChannel.Template' => notifications_removed_from_channel_template,
        'Notifications.InvitedToChannel.Enabled' => notifications_invited_to_channel_enabled,
        'Notifications.InvitedToChannel.Template' => notifications_invited_to_channel_template,
        'PreWebhookUrl' => pre_webhook_url,
        'PostWebhookUrl' => post_webhook_url,
        'WebhookMethod' => webhook_method,
        'WebhookFilters' => Twilio.serialize_list(webhook_filters) { |e| e },
        'Webhooks.OnMessageSend.Url' => webhooks_on_message_send_url,
        'Webhooks.OnMessageSend.Method' => webhooks_on_message_send_method,
        'Webhooks.OnMessageUpdate.Url' => webhooks_on_message_update_url,
        'Webhooks.OnMessageUpdate.Method' => webhooks_on_message_update_method,
        'Webhooks.OnMessageRemove.Url' => webhooks_on_message_remove_url,
        'Webhooks.OnMessageRemove.Method' => webhooks_on_message_remove_method,
        'Webhooks.OnChannelAdd.Url' => webhooks_on_channel_add_url,
        'Webhooks.OnChannelAdd.Method' => webhooks_on_channel_add_method,
        'Webhooks.OnChannelDestroy.Url' => webhooks_on_channel_destroy_url,
        'Webhooks.OnChannelDestroy.Method' => webhooks_on_channel_destroy_method,
        'Webhooks.OnChannelUpdate.Url' => webhooks_on_channel_update_url,
        'Webhooks.OnChannelUpdate.Method' => webhooks_on_channel_update_method,
        'Webhooks.OnMemberAdd.Url' => webhooks_on_member_add_url,
        'Webhooks.OnMemberAdd.Method' => webhooks_on_member_add_method,
        'Webhooks.OnMemberRemove.Url' => webhooks_on_member_remove_url,
        'Webhooks.OnMemberRemove.Method' => webhooks_on_member_remove_method,
        'Webhooks.OnMessageSent.Url' => webhooks_on_message_sent_url,
        'Webhooks.OnMessageSent.Method' => webhooks_on_message_sent_method,
        'Webhooks.OnMessageUpdated.Url' => webhooks_on_message_updated_url,
        'Webhooks.OnMessageUpdated.Method' => webhooks_on_message_updated_method,
        'Webhooks.OnMessageRemoved.Url' => webhooks_on_message_removed_url,
        'Webhooks.OnMessageRemoved.Method' => webhooks_on_message_removed_method,
        'Webhooks.OnChannelAdded.Url' => webhooks_on_channel_added_url,
        'Webhooks.OnChannelAdded.Method' => webhooks_on_channel_added_method,
        'Webhooks.OnChannelDestroyed.Url' => webhooks_on_channel_destroyed_url,
        'Webhooks.OnChannelDestroyed.Method' => webhooks_on_channel_destroyed_method,
        'Webhooks.OnChannelUpdated.Url' => webhooks_on_channel_updated_url,
        'Webhooks.OnChannelUpdated.Method' => webhooks_on_channel_updated_method,
        'Webhooks.OnMemberAdded.Url' => webhooks_on_member_added_url,
        'Webhooks.OnMemberAdded.Method' => webhooks_on_member_added_method,
        'Webhooks.OnMemberRemoved.Url' => webhooks_on_member_removed_url,
        'Webhooks.OnMemberRemoved.Method' => webhooks_on_member_removed_method,
        'Limits.ChannelMembers' => limits_channel_members,
        'Limits.UserChannels' => limits_user_channels,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ServiceInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#update_with_metadata(friendly_name: :unset, default_service_role_sid: :unset, default_channel_role_sid: :unset, default_channel_creator_role_sid: :unset, read_status_enabled: :unset, reachability_enabled: :unset, typing_indicator_timeout: :unset, consumption_report_interval: :unset, notifications_new_message_enabled: :unset, notifications_new_message_template: :unset, notifications_added_to_channel_enabled: :unset, notifications_added_to_channel_template: :unset, notifications_removed_from_channel_enabled: :unset, notifications_removed_from_channel_template: :unset, notifications_invited_to_channel_enabled: :unset, notifications_invited_to_channel_template: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, webhook_method: :unset, webhook_filters: :unset, webhooks_on_message_send_url: :unset, webhooks_on_message_send_method: :unset, webhooks_on_message_update_url: :unset, webhooks_on_message_update_method: :unset, webhooks_on_message_remove_url: :unset, webhooks_on_message_remove_method: :unset, webhooks_on_channel_add_url: :unset, webhooks_on_channel_add_method: :unset, webhooks_on_channel_destroy_url: :unset, webhooks_on_channel_destroy_method: :unset, webhooks_on_channel_update_url: :unset, webhooks_on_channel_update_method: :unset, webhooks_on_member_add_url: :unset, webhooks_on_member_add_method: :unset, webhooks_on_member_remove_url: :unset, webhooks_on_member_remove_method: :unset, webhooks_on_message_sent_url: :unset, webhooks_on_message_sent_method: :unset, webhooks_on_message_updated_url: :unset, webhooks_on_message_updated_method: :unset, webhooks_on_message_removed_url: :unset, webhooks_on_message_removed_method: :unset, webhooks_on_channel_added_url: :unset, webhooks_on_channel_added_method: :unset, webhooks_on_channel_destroyed_url: :unset, webhooks_on_channel_destroyed_method: :unset, webhooks_on_channel_updated_url: :unset, webhooks_on_channel_updated_method: :unset, webhooks_on_member_added_url: :unset, webhooks_on_member_added_method: :unset, webhooks_on_member_removed_url: :unset, webhooks_on_member_removed_method: :unset, limits_channel_members: :unset, limits_user_channels: :unset) ⇒ ServiceInstance

Update the ServiceInstanceMetadata

Parameters:

  • friendly_name (String) (defaults to: :unset)
  • default_service_role_sid (String) (defaults to: :unset)
  • default_channel_role_sid (String) (defaults to: :unset)
  • default_channel_creator_role_sid (String) (defaults to: :unset)
  • read_status_enabled (Boolean) (defaults to: :unset)
  • reachability_enabled (Boolean) (defaults to: :unset)
  • typing_indicator_timeout (String) (defaults to: :unset)
  • consumption_report_interval (String) (defaults to: :unset)
  • notifications_new_message_enabled (Boolean) (defaults to: :unset)
  • notifications_new_message_template (String) (defaults to: :unset)
  • notifications_added_to_channel_enabled (Boolean) (defaults to: :unset)
  • notifications_added_to_channel_template (String) (defaults to: :unset)
  • notifications_removed_from_channel_enabled (Boolean) (defaults to: :unset)
  • notifications_removed_from_channel_template (String) (defaults to: :unset)
  • notifications_invited_to_channel_enabled (Boolean) (defaults to: :unset)
  • notifications_invited_to_channel_template (String) (defaults to: :unset)
  • pre_webhook_url (String) (defaults to: :unset)
  • post_webhook_url (String) (defaults to: :unset)
  • webhook_method (String) (defaults to: :unset)
  • webhook_filters (Array[String]) (defaults to: :unset)
  • webhooks_on_message_send_url (String) (defaults to: :unset)
  • webhooks_on_message_send_method (String) (defaults to: :unset)
  • webhooks_on_message_update_url (String) (defaults to: :unset)
  • webhooks_on_message_update_method (String) (defaults to: :unset)
  • webhooks_on_message_remove_url (String) (defaults to: :unset)
  • webhooks_on_message_remove_method (String) (defaults to: :unset)
  • webhooks_on_channel_add_url (String) (defaults to: :unset)
  • webhooks_on_channel_add_method (String) (defaults to: :unset)
  • webhooks_on_channel_destroy_url (String) (defaults to: :unset)
  • webhooks_on_channel_destroy_method (String) (defaults to: :unset)
  • webhooks_on_channel_update_url (String) (defaults to: :unset)
  • webhooks_on_channel_update_method (String) (defaults to: :unset)
  • webhooks_on_member_add_url (String) (defaults to: :unset)
  • webhooks_on_member_add_method (String) (defaults to: :unset)
  • webhooks_on_member_remove_url (String) (defaults to: :unset)
  • webhooks_on_member_remove_method (String) (defaults to: :unset)
  • webhooks_on_message_sent_url (String) (defaults to: :unset)
  • webhooks_on_message_sent_method (String) (defaults to: :unset)
  • webhooks_on_message_updated_url (String) (defaults to: :unset)
  • webhooks_on_message_updated_method (String) (defaults to: :unset)
  • webhooks_on_message_removed_url (String) (defaults to: :unset)
  • webhooks_on_message_removed_method (String) (defaults to: :unset)
  • webhooks_on_channel_added_url (String) (defaults to: :unset)
  • webhooks_on_channel_added_method (String) (defaults to: :unset)
  • webhooks_on_channel_destroyed_url (String) (defaults to: :unset)
  • webhooks_on_channel_destroyed_method (String) (defaults to: :unset)
  • webhooks_on_channel_updated_url (String) (defaults to: :unset)
  • webhooks_on_channel_updated_method (String) (defaults to: :unset)
  • webhooks_on_member_added_url (String) (defaults to: :unset)
  • webhooks_on_member_added_method (String) (defaults to: :unset)
  • webhooks_on_member_removed_url (String) (defaults to: :unset)
  • webhooks_on_member_removed_method (String) (defaults to: :unset)
  • limits_channel_members (String) (defaults to: :unset)
  • limits_user_channels (String) (defaults to: :unset)

Returns:



554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 554

def (
  friendly_name: :unset, 
  default_service_role_sid: :unset, 
  default_channel_role_sid: :unset, 
  default_channel_creator_role_sid: :unset, 
  read_status_enabled: :unset, 
  reachability_enabled: :unset, 
  typing_indicator_timeout: :unset, 
  consumption_report_interval: :unset, 
  notifications_new_message_enabled: :unset, 
  notifications_new_message_template: :unset, 
  notifications_added_to_channel_enabled: :unset, 
  notifications_added_to_channel_template: :unset, 
  notifications_removed_from_channel_enabled: :unset, 
  notifications_removed_from_channel_template: :unset, 
  notifications_invited_to_channel_enabled: :unset, 
  notifications_invited_to_channel_template: :unset, 
  pre_webhook_url: :unset, 
  post_webhook_url: :unset, 
  webhook_method: :unset, 
  webhook_filters: :unset, 
  webhooks_on_message_send_url: :unset, 
  webhooks_on_message_send_method: :unset, 
  webhooks_on_message_update_url: :unset, 
  webhooks_on_message_update_method: :unset, 
  webhooks_on_message_remove_url: :unset, 
  webhooks_on_message_remove_method: :unset, 
  webhooks_on_channel_add_url: :unset, 
  webhooks_on_channel_add_method: :unset, 
  webhooks_on_channel_destroy_url: :unset, 
  webhooks_on_channel_destroy_method: :unset, 
  webhooks_on_channel_update_url: :unset, 
  webhooks_on_channel_update_method: :unset, 
  webhooks_on_member_add_url: :unset, 
  webhooks_on_member_add_method: :unset, 
  webhooks_on_member_remove_url: :unset, 
  webhooks_on_member_remove_method: :unset, 
  webhooks_on_message_sent_url: :unset, 
  webhooks_on_message_sent_method: :unset, 
  webhooks_on_message_updated_url: :unset, 
  webhooks_on_message_updated_method: :unset, 
  webhooks_on_message_removed_url: :unset, 
  webhooks_on_message_removed_method: :unset, 
  webhooks_on_channel_added_url: :unset, 
  webhooks_on_channel_added_method: :unset, 
  webhooks_on_channel_destroyed_url: :unset, 
  webhooks_on_channel_destroyed_method: :unset, 
  webhooks_on_channel_updated_url: :unset, 
  webhooks_on_channel_updated_method: :unset, 
  webhooks_on_member_added_url: :unset, 
  webhooks_on_member_added_method: :unset, 
  webhooks_on_member_removed_url: :unset, 
  webhooks_on_member_removed_method: :unset, 
  limits_channel_members: :unset, 
  limits_user_channels: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'DefaultServiceRoleSid' => default_service_role_sid,
        'DefaultChannelRoleSid' => default_channel_role_sid,
        'DefaultChannelCreatorRoleSid' => default_channel_creator_role_sid,
        'ReadStatusEnabled' => read_status_enabled,
        'ReachabilityEnabled' => reachability_enabled,
        'TypingIndicatorTimeout' => typing_indicator_timeout,
        'ConsumptionReportInterval' => consumption_report_interval,
        'Notifications.NewMessage.Enabled' => notifications_new_message_enabled,
        'Notifications.NewMessage.Template' => notifications_new_message_template,
        'Notifications.AddedToChannel.Enabled' => notifications_added_to_channel_enabled,
        'Notifications.AddedToChannel.Template' => notifications_added_to_channel_template,
        'Notifications.RemovedFromChannel.Enabled' => notifications_removed_from_channel_enabled,
        'Notifications.RemovedFromChannel.Template' => notifications_removed_from_channel_template,
        'Notifications.InvitedToChannel.Enabled' => notifications_invited_to_channel_enabled,
        'Notifications.InvitedToChannel.Template' => notifications_invited_to_channel_template,
        'PreWebhookUrl' => pre_webhook_url,
        'PostWebhookUrl' => post_webhook_url,
        'WebhookMethod' => webhook_method,
        'WebhookFilters' => Twilio.serialize_list(webhook_filters) { |e| e },
        'Webhooks.OnMessageSend.Url' => webhooks_on_message_send_url,
        'Webhooks.OnMessageSend.Method' => webhooks_on_message_send_method,
        'Webhooks.OnMessageUpdate.Url' => webhooks_on_message_update_url,
        'Webhooks.OnMessageUpdate.Method' => webhooks_on_message_update_method,
        'Webhooks.OnMessageRemove.Url' => webhooks_on_message_remove_url,
        'Webhooks.OnMessageRemove.Method' => webhooks_on_message_remove_method,
        'Webhooks.OnChannelAdd.Url' => webhooks_on_channel_add_url,
        'Webhooks.OnChannelAdd.Method' => webhooks_on_channel_add_method,
        'Webhooks.OnChannelDestroy.Url' => webhooks_on_channel_destroy_url,
        'Webhooks.OnChannelDestroy.Method' => webhooks_on_channel_destroy_method,
        'Webhooks.OnChannelUpdate.Url' => webhooks_on_channel_update_url,
        'Webhooks.OnChannelUpdate.Method' => webhooks_on_channel_update_method,
        'Webhooks.OnMemberAdd.Url' => webhooks_on_member_add_url,
        'Webhooks.OnMemberAdd.Method' => webhooks_on_member_add_method,
        'Webhooks.OnMemberRemove.Url' => webhooks_on_member_remove_url,
        'Webhooks.OnMemberRemove.Method' => webhooks_on_member_remove_method,
        'Webhooks.OnMessageSent.Url' => webhooks_on_message_sent_url,
        'Webhooks.OnMessageSent.Method' => webhooks_on_message_sent_method,
        'Webhooks.OnMessageUpdated.Url' => webhooks_on_message_updated_url,
        'Webhooks.OnMessageUpdated.Method' => webhooks_on_message_updated_method,
        'Webhooks.OnMessageRemoved.Url' => webhooks_on_message_removed_url,
        'Webhooks.OnMessageRemoved.Method' => webhooks_on_message_removed_method,
        'Webhooks.OnChannelAdded.Url' => webhooks_on_channel_added_url,
        'Webhooks.OnChannelAdded.Method' => webhooks_on_channel_added_method,
        'Webhooks.OnChannelDestroyed.Url' => webhooks_on_channel_destroyed_url,
        'Webhooks.OnChannelDestroyed.Method' => webhooks_on_channel_destroyed_method,
        'Webhooks.OnChannelUpdated.Url' => webhooks_on_channel_updated_url,
        'Webhooks.OnChannelUpdated.Method' => webhooks_on_channel_updated_method,
        'Webhooks.OnMemberAdded.Url' => webhooks_on_member_added_url,
        'Webhooks.OnMemberAdded.Method' => webhooks_on_member_added_method,
        'Webhooks.OnMemberRemoved.Url' => webhooks_on_member_removed_url,
        'Webhooks.OnMemberRemoved.Method' => webhooks_on_member_removed_method,
        'Limits.ChannelMembers' => limits_channel_members,
        'Limits.UserChannels' => limits_user_channels,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    service_instance = ServiceInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    ServiceInstanceMetadata.new(
        @version,
        service_instance,
        response.headers,
        response.status_code
    )
end

#users(sid = :unset) ⇒ UserList, UserContext

Access the users

Returns:

Raises:

  • (ArgumentError)


730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 730

def users(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return UserContext.new(@version, @solution[:sid],sid )
    end

    unless @users
        @users = UserList.new(
            @version, service_sid: @solution[:sid], )
    end

 @users
end