class Twilio::REST::IpMessaging::V2::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/v2/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 @bindings = nil 172 end
Public Instance Methods
Access the bindings @return [BindingList] @return [BindingContext] if sid was passed.
# File lib/twilio-ruby/rest/ip_messaging/v2/service.rb 336 def bindings(sid=:unset) 337 raise ArgumentError, 'sid cannot be nil' if sid.nil? 338 339 if sid != :unset 340 return BindingContext.new(@version, @solution[:sid], sid, ) 341 end 342 343 unless @bindings 344 @bindings = BindingList.new(@version, service_sid: @solution[:sid], ) 345 end 346 347 @bindings 348 end
Access the channels @return [ChannelList] @return [ChannelContext] if sid was passed.
# File lib/twilio-ruby/rest/ip_messaging/v2/service.rb 282 def channels(sid=:unset) 283 raise ArgumentError, 'sid cannot be nil' if sid.nil? 284 285 if sid != :unset 286 return ChannelContext.new(@version, @solution[:sid], sid, ) 287 end 288 289 unless @channels 290 @channels = ChannelList.new(@version, service_sid: @solution[:sid], ) 291 end 292 293 @channels 294 end
Delete the ServiceInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/ip_messaging/v2/service.rb 186 def delete 187 @version.delete('DELETE', @uri) 188 end
Fetch the ServiceInstance
@return [ServiceInstance] Fetched ServiceInstance
# File lib/twilio-ruby/rest/ip_messaging/v2/service.rb 177 def fetch 178 payload = @version.fetch('GET', @uri) 179 180 ServiceInstance.new(@version, payload, sid: @solution[:sid], ) 181 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/ip_messaging/v2/service.rb 359 def inspect 360 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 361 "#<Twilio.IpMessaging.V2.ServiceContext #{context}>" 362 end
Access the roles @return [RoleList] @return [RoleContext] if sid was passed.
# File lib/twilio-ruby/rest/ip_messaging/v2/service.rb 300 def roles(sid=:unset) 301 raise ArgumentError, 'sid cannot be nil' if sid.nil? 302 303 if sid != :unset 304 return RoleContext.new(@version, @solution[:sid], sid, ) 305 end 306 307 unless @roles 308 @roles = RoleList.new(@version, service_sid: @solution[:sid], ) 309 end 310 311 @roles 312 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/ip_messaging/v2/service.rb 352 def to_s 353 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 354 "#<Twilio.IpMessaging.V2.ServiceContext #{context}>" 355 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 [String] notifications_new_message_sound The
notifications.new_message.sound
@param [Boolean] notifications_new_message_badge_count_enabled The
notifications.new_message.badge_count_enabled
@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 [String] notifications_added_to_channel_sound The
notifications.added_to_channel.sound
@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 [String] notifications_removed_from_channel_sound The
notifications.removed_from_channel.sound
@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] notifications_invited_to_channel_sound The
notifications.invited_to_channel.sound
@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] limits_channel_members The limits.channel_members @param [String] limits_user_channels The limits.user_channels @param [String] media_compatibility_message The media.compatibility_message @param [String] pre_webhook_retry_count The pre_webhook_retry_count @param [String] post_webhook_retry_count The post_webhook_retry_count @param [Boolean] notifications_log_enabled The notifications.log_enabled @return [ServiceInstance] Updated ServiceInstance
# File lib/twilio-ruby/rest/ip_messaging/v2/service.rb 238 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_new_message_sound: :unset, notifications_new_message_badge_count_enabled: :unset, notifications_added_to_channel_enabled: :unset, notifications_added_to_channel_template: :unset, notifications_added_to_channel_sound: :unset, notifications_removed_from_channel_enabled: :unset, notifications_removed_from_channel_template: :unset, notifications_removed_from_channel_sound: :unset, notifications_invited_to_channel_enabled: :unset, notifications_invited_to_channel_template: :unset, notifications_invited_to_channel_sound: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, webhook_method: :unset, webhook_filters: :unset, limits_channel_members: :unset, limits_user_channels: :unset, media_compatibility_message: :unset, pre_webhook_retry_count: :unset, post_webhook_retry_count: :unset, notifications_log_enabled: :unset) 239 data = Twilio::Values.of({ 240 'FriendlyName' => friendly_name, 241 'DefaultServiceRoleSid' => default_service_role_sid, 242 'DefaultChannelRoleSid' => default_channel_role_sid, 243 'DefaultChannelCreatorRoleSid' => default_channel_creator_role_sid, 244 'ReadStatusEnabled' => read_status_enabled, 245 'ReachabilityEnabled' => reachability_enabled, 246 'TypingIndicatorTimeout' => typing_indicator_timeout, 247 'ConsumptionReportInterval' => consumption_report_interval, 248 'Notifications.NewMessage.Enabled' => notifications_new_message_enabled, 249 'Notifications.NewMessage.Template' => notifications_new_message_template, 250 'Notifications.NewMessage.Sound' => notifications_new_message_sound, 251 'Notifications.NewMessage.BadgeCountEnabled' => notifications_new_message_badge_count_enabled, 252 'Notifications.AddedToChannel.Enabled' => notifications_added_to_channel_enabled, 253 'Notifications.AddedToChannel.Template' => notifications_added_to_channel_template, 254 'Notifications.AddedToChannel.Sound' => notifications_added_to_channel_sound, 255 'Notifications.RemovedFromChannel.Enabled' => notifications_removed_from_channel_enabled, 256 'Notifications.RemovedFromChannel.Template' => notifications_removed_from_channel_template, 257 'Notifications.RemovedFromChannel.Sound' => notifications_removed_from_channel_sound, 258 'Notifications.InvitedToChannel.Enabled' => notifications_invited_to_channel_enabled, 259 'Notifications.InvitedToChannel.Template' => notifications_invited_to_channel_template, 260 'Notifications.InvitedToChannel.Sound' => notifications_invited_to_channel_sound, 261 'PreWebhookUrl' => pre_webhook_url, 262 'PostWebhookUrl' => post_webhook_url, 263 'WebhookMethod' => webhook_method, 264 'WebhookFilters' => Twilio.serialize_list(webhook_filters) { |e| e }, 265 'Limits.ChannelMembers' => limits_channel_members, 266 'Limits.UserChannels' => limits_user_channels, 267 'Media.CompatibilityMessage' => media_compatibility_message, 268 'PreWebhookRetryCount' => pre_webhook_retry_count, 269 'PostWebhookRetryCount' => post_webhook_retry_count, 270 'Notifications.LogEnabled' => notifications_log_enabled, 271 }) 272 273 payload = @version.update('POST', @uri, data: data) 274 275 ServiceInstance.new(@version, payload, sid: @solution[:sid], ) 276 end
Access the users @return [UserList] @return [UserContext] if sid was passed.
# File lib/twilio-ruby/rest/ip_messaging/v2/service.rb 318 def users(sid=:unset) 319 raise ArgumentError, 'sid cannot be nil' if sid.nil? 320 321 if sid != :unset 322 return UserContext.new(@version, @solution[:sid], sid, ) 323 end 324 325 unless @users 326 @users = UserList.new(@version, service_sid: @solution[:sid], ) 327 end 328 329 @users 330 end