class Twilio::REST::IpMessaging::V1::ServiceContext
Public Class Methods
Initialize the ServiceContext
@param [Version] version Version
that contains the resource @param [String] sid The sid @return [ServiceContext] ServiceContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/ip_messaging/v1/service.rb 160 def initialize(version, sid) 161 super(version) 162 163 # Path Solution 164 @solution = {sid: sid, } 165 @uri = "/Services/#{@solution[:sid]}" 166 167 # Dependents 168 @channels = nil 169 @roles = nil 170 @users = nil 171 end
Public Instance Methods
Access the channels @return [ChannelList] @return [ChannelContext] if sid was passed.
# File lib/twilio-ruby/rest/ip_messaging/v1/service.rb 346 def channels(sid=:unset) 347 raise ArgumentError, 'sid cannot be nil' if sid.nil? 348 349 if sid != :unset 350 return ChannelContext.new(@version, @solution[:sid], sid, ) 351 end 352 353 unless @channels 354 @channels = ChannelList.new(@version, service_sid: @solution[:sid], ) 355 end 356 357 @channels 358 end
Delete the ServiceInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/ip_messaging/v1/service.rb 185 def delete 186 @version.delete('DELETE', @uri) 187 end
Fetch the ServiceInstance
@return [ServiceInstance] Fetched ServiceInstance
# File lib/twilio-ruby/rest/ip_messaging/v1/service.rb 176 def fetch 177 payload = @version.fetch('GET', @uri) 178 179 ServiceInstance.new(@version, payload, sid: @solution[:sid], ) 180 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/ip_messaging/v1/service.rb 405 def inspect 406 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 407 "#<Twilio.IpMessaging.V1.ServiceContext #{context}>" 408 end
Access the roles @return [RoleList] @return [RoleContext] if sid was passed.
# File lib/twilio-ruby/rest/ip_messaging/v1/service.rb 364 def roles(sid=:unset) 365 raise ArgumentError, 'sid cannot be nil' if sid.nil? 366 367 if sid != :unset 368 return RoleContext.new(@version, @solution[:sid], sid, ) 369 end 370 371 unless @roles 372 @roles = RoleList.new(@version, service_sid: @solution[:sid], ) 373 end 374 375 @roles 376 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/ip_messaging/v1/service.rb 398 def to_s 399 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 400 "#<Twilio.IpMessaging.V1.ServiceContext #{context}>" 401 end
Update the ServiceInstance
@param [String] friendly_name The friendly_name @param [String] default_service_role_sid The default_service_role_sid @param [String] default_channel_role_sid The default_channel_role_sid @param [String] default_channel_creator_role_sid The
default_channel_creator_role_sid
@param [Boolean] read_status_enabled The read_status_enabled @param [Boolean] reachability_enabled The reachability_enabled @param [String] typing_indicator_timeout The typing_indicator_timeout @param [String] consumption_report_interval The consumption_report_interval @param [Boolean] notifications_new_message_enabled The
notifications.new_message.enabled
@param [String] notifications_new_message_template The
notifications.new_message.template
@param [Boolean] notifications_added_to_channel_enabled The
notifications.added_to_channel.enabled
@param [String] notifications_added_to_channel_template The
notifications.added_to_channel.template
@param [Boolean] notifications_removed_from_channel_enabled The
notifications.removed_from_channel.enabled
@param [String] notifications_removed_from_channel_template The
notifications.removed_from_channel.template
@param [Boolean] notifications_invited_to_channel_enabled The
notifications.invited_to_channel.enabled
@param [String] notifications_invited_to_channel_template The
notifications.invited_to_channel.template
@param [String] pre_webhook_url The pre_webhook_url @param [String] post_webhook_url The post_webhook_url @param [String] webhook_method The webhook_method @param [Array] webhook_filters The webhook_filters @param [String] webhooks_on_message_send_url The webhooks.on_message_send.url @param [String] webhooks_on_message_send_method The
webhooks.on_message_send.method
@param [String] webhooks_on_message_update_url The
webhooks.on_message_update.url
@param [String] webhooks_on_message_update_method The
webhooks.on_message_update.method
@param [String] webhooks_on_message_remove_url The
webhooks.on_message_remove.url
@param [String] webhooks_on_message_remove_method The
webhooks.on_message_remove.method
@param [String] webhooks_on_channel_add_url The webhooks.on_channel_add.url @param [String] webhooks_on_channel_add_method The
webhooks.on_channel_add.method
@param [String] webhooks_on_channel_destroy_url The
webhooks.on_channel_destroy.url
@param [String] webhooks_on_channel_destroy_method The
webhooks.on_channel_destroy.method
@param [String] webhooks_on_channel_update_url The
webhooks.on_channel_update.url
@param [String] webhooks_on_channel_update_method The
webhooks.on_channel_update.method
@param [String] webhooks_on_member_add_url The webhooks.on_member_add.url @param [String] webhooks_on_member_add_method The webhooks.on_member_add.method @param [String] webhooks_on_member_remove_url The webhooks.on_member_remove.url @param [String] webhooks_on_member_remove_method The
webhooks.on_member_remove.method
@param [String] webhooks_on_message_sent_url The webhooks.on_message_sent.url @param [String] webhooks_on_message_sent_method The
webhooks.on_message_sent.method
@param [String] webhooks_on_message_updated_url The
webhooks.on_message_updated.url
@param [String] webhooks_on_message_updated_method The
webhooks.on_message_updated.method
@param [String] webhooks_on_message_removed_url The
webhooks.on_message_removed.url
@param [String] webhooks_on_message_removed_method The
webhooks.on_message_removed.method
@param [String] webhooks_on_channel_added_url The webhooks.on_channel_added.url @param [String] webhooks_on_channel_added_method The
webhooks.on_channel_added.method
@param [String] webhooks_on_channel_destroyed_url The
webhooks.on_channel_destroyed.url
@param [String] webhooks_on_channel_destroyed_method The
webhooks.on_channel_destroyed.method
@param [String] webhooks_on_channel_updated_url The
webhooks.on_channel_updated.url
@param [String] webhooks_on_channel_updated_method The
webhooks.on_channel_updated.method
@param [String] webhooks_on_member_added_url The webhooks.on_member_added.url @param [String] webhooks_on_member_added_method The
webhooks.on_member_added.method
@param [String] webhooks_on_member_removed_url The
webhooks.on_member_removed.url
@param [String] webhooks_on_member_removed_method The
webhooks.on_member_removed.method
@param [String] limits_channel_members The limits.channel_members @param [String] limits_user_channels The limits.user_channels @return [ServiceInstance] Updated ServiceInstance
# File lib/twilio-ruby/rest/ip_messaging/v1/service.rb 279 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) 280 data = Twilio::Values.of({ 281 'FriendlyName' => friendly_name, 282 'DefaultServiceRoleSid' => default_service_role_sid, 283 'DefaultChannelRoleSid' => default_channel_role_sid, 284 'DefaultChannelCreatorRoleSid' => default_channel_creator_role_sid, 285 'ReadStatusEnabled' => read_status_enabled, 286 'ReachabilityEnabled' => reachability_enabled, 287 'TypingIndicatorTimeout' => typing_indicator_timeout, 288 'ConsumptionReportInterval' => consumption_report_interval, 289 'Notifications.NewMessage.Enabled' => notifications_new_message_enabled, 290 'Notifications.NewMessage.Template' => notifications_new_message_template, 291 'Notifications.AddedToChannel.Enabled' => notifications_added_to_channel_enabled, 292 'Notifications.AddedToChannel.Template' => notifications_added_to_channel_template, 293 'Notifications.RemovedFromChannel.Enabled' => notifications_removed_from_channel_enabled, 294 'Notifications.RemovedFromChannel.Template' => notifications_removed_from_channel_template, 295 'Notifications.InvitedToChannel.Enabled' => notifications_invited_to_channel_enabled, 296 'Notifications.InvitedToChannel.Template' => notifications_invited_to_channel_template, 297 'PreWebhookUrl' => pre_webhook_url, 298 'PostWebhookUrl' => post_webhook_url, 299 'WebhookMethod' => webhook_method, 300 'WebhookFilters' => Twilio.serialize_list(webhook_filters) { |e| e }, 301 'Webhooks.OnMessageSend.Url' => webhooks_on_message_send_url, 302 'Webhooks.OnMessageSend.Method' => webhooks_on_message_send_method, 303 'Webhooks.OnMessageUpdate.Url' => webhooks_on_message_update_url, 304 'Webhooks.OnMessageUpdate.Method' => webhooks_on_message_update_method, 305 'Webhooks.OnMessageRemove.Url' => webhooks_on_message_remove_url, 306 'Webhooks.OnMessageRemove.Method' => webhooks_on_message_remove_method, 307 'Webhooks.OnChannelAdd.Url' => webhooks_on_channel_add_url, 308 'Webhooks.OnChannelAdd.Method' => webhooks_on_channel_add_method, 309 'Webhooks.OnChannelDestroy.Url' => webhooks_on_channel_destroy_url, 310 'Webhooks.OnChannelDestroy.Method' => webhooks_on_channel_destroy_method, 311 'Webhooks.OnChannelUpdate.Url' => webhooks_on_channel_update_url, 312 'Webhooks.OnChannelUpdate.Method' => webhooks_on_channel_update_method, 313 'Webhooks.OnMemberAdd.Url' => webhooks_on_member_add_url, 314 'Webhooks.OnMemberAdd.Method' => webhooks_on_member_add_method, 315 'Webhooks.OnMemberRemove.Url' => webhooks_on_member_remove_url, 316 'Webhooks.OnMemberRemove.Method' => webhooks_on_member_remove_method, 317 'Webhooks.OnMessageSent.Url' => webhooks_on_message_sent_url, 318 'Webhooks.OnMessageSent.Method' => webhooks_on_message_sent_method, 319 'Webhooks.OnMessageUpdated.Url' => webhooks_on_message_updated_url, 320 'Webhooks.OnMessageUpdated.Method' => webhooks_on_message_updated_method, 321 'Webhooks.OnMessageRemoved.Url' => webhooks_on_message_removed_url, 322 'Webhooks.OnMessageRemoved.Method' => webhooks_on_message_removed_method, 323 'Webhooks.OnChannelAdded.Url' => webhooks_on_channel_added_url, 324 'Webhooks.OnChannelAdded.Method' => webhooks_on_channel_added_method, 325 'Webhooks.OnChannelDestroyed.Url' => webhooks_on_channel_destroyed_url, 326 'Webhooks.OnChannelDestroyed.Method' => webhooks_on_channel_destroyed_method, 327 'Webhooks.OnChannelUpdated.Url' => webhooks_on_channel_updated_url, 328 'Webhooks.OnChannelUpdated.Method' => webhooks_on_channel_updated_method, 329 'Webhooks.OnMemberAdded.Url' => webhooks_on_member_added_url, 330 'Webhooks.OnMemberAdded.Method' => webhooks_on_member_added_method, 331 'Webhooks.OnMemberRemoved.Url' => webhooks_on_member_removed_url, 332 'Webhooks.OnMemberRemoved.Method' => webhooks_on_member_removed_method, 333 'Limits.ChannelMembers' => limits_channel_members, 334 'Limits.UserChannels' => limits_user_channels, 335 }) 336 337 payload = @version.update('POST', @uri, data: data) 338 339 ServiceInstance.new(@version, payload, sid: @solution[:sid], ) 340 end
Access the users @return [UserList] @return [UserContext] if sid was passed.
# File lib/twilio-ruby/rest/ip_messaging/v1/service.rb 382 def users(sid=:unset) 383 raise ArgumentError, 'sid cannot be nil' if sid.nil? 384 385 if sid != :unset 386 return UserContext.new(@version, @solution[:sid], sid, ) 387 end 388 389 unless @users 390 @users = UserList.new(@version, service_sid: @solution[:sid], ) 391 end 392 393 @users 394 end