Class: Twilio::REST::IpMessaging::V1::ServiceContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::IpMessaging::V1::ServiceContext
- 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, ChannelList, ChannelPage, RoleContext, RoleInstance, RoleList, RolePage, UserContext, UserInstance, UserList, UserPage
Instance Method Summary collapse
-
#channels(sid = :unset) ⇒ ChannelList, ChannelContext
Access the channels.
-
#delete ⇒ Boolean
Deletes the ServiceInstance.
-
#fetch ⇒ ServiceInstance
Fetch a ServiceInstance.
-
#initialize(version, sid) ⇒ ServiceContext
constructor
Initialize the ServiceContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#roles(sid = :unset) ⇒ RoleList, RoleContext
Access the roles.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#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.
-
#users(sid = :unset) ⇒ UserList, UserContext
Access the users.
Constructor Details
#initialize(version, sid) ⇒ ServiceContext
Initialize the ServiceContext
169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 169 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
421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 421 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 |
#delete ⇒ Boolean
Deletes the ServiceInstance
200 201 202 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 200 def delete @version.delete('delete', @uri) end |
#fetch ⇒ ServiceInstance
Fetch a ServiceInstance
185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 185 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) ServiceInstance.new(@version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
480 481 482 483 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 480 def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.ServiceContext #{context}>" end |
#roles(sid = :unset) ⇒ RoleList, RoleContext
Access the roles
439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 439 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_s ⇒ Object
Provide a user friendly representation
473 474 475 476 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 473 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
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 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 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 350 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.NewMessage.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.OnMessageSend.Method' => , 'Webhooks.OnMessageUpdate.Url' => , 'Webhooks.OnMessageUpdate.Method' => , 'Webhooks.OnMessageRemove.Url' => , 'Webhooks.OnMessageRemove.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.OnMessageSent.Method' => , 'Webhooks.OnMessageUpdated.Url' => , 'Webhooks.OnMessageUpdated.Method' => , 'Webhooks.OnMessageRemoved.Url' => , 'Webhooks.OnMessageRemoved.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, }) payload = @version.update( 'POST', @uri, data: data, ) ServiceInstance.new(@version, payload, sid: @solution[:sid], ) end |
#users(sid = :unset) ⇒ UserList, UserContext
Access the users
457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service.rb', line 457 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 |