Class: Twilio::REST::Chat::V2::ServiceContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Chat::V2::ServiceContext
- Defined in:
- lib/twilio-ruby/rest/chat/v2/service.rb,
lib/twilio-ruby/rest/chat/v2/service/role.rb,
lib/twilio-ruby/rest/chat/v2/service/user.rb,
lib/twilio-ruby/rest/chat/v2/service/binding.rb,
lib/twilio-ruby/rest/chat/v2/service/channel.rb,
lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb,
lib/twilio-ruby/rest/chat/v2/service/channel/member.rb,
lib/twilio-ruby/rest/chat/v2/service/channel/message.rb,
lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb,
lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb,
lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb
Defined Under Namespace
Classes: BindingContext, BindingInstance, BindingList, BindingPage, ChannelContext, ChannelInstance, ChannelList, ChannelPage, RoleContext, RoleInstance, RoleList, RolePage, UserContext, UserInstance, UserList, UserPage
Instance Method Summary collapse
-
#bindings(sid = :unset) ⇒ BindingList, BindingContext
Access the bindings.
-
#channels(sid = :unset) ⇒ ChannelList, ChannelContext
Access the channels.
-
#delete ⇒ Boolean
Delete the ServiceInstance.
-
#fetch ⇒ ServiceInstance
Fetch the 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_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) ⇒ ServiceInstance
Update the ServiceInstance.
-
#users(sid = :unset) ⇒ UserList, UserContext
Access the users.
Constructor Details
#initialize(version, sid) ⇒ ServiceContext
Initialize the ServiceContext
151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/twilio-ruby/rest/chat/v2/service.rb', line 151 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Services/#{@solution[:sid]}" # Dependents @bindings = nil @channels = nil @roles = nil @users = nil end |
Instance Method Details
#bindings(sid = :unset) ⇒ BindingList, BindingContext
Access the bindings
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/twilio-ruby/rest/chat/v2/service.rb', line 299 def bindings(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return BindingContext.new(@version, @solution[:sid],sid ) end unless @bindings @bindings = BindingList.new( @version, service_sid: @solution[:sid], ) end @bindings end |
#channels(sid = :unset) ⇒ ChannelList, ChannelContext
Access the channels
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/twilio-ruby/rest/chat/v2/service.rb', line 318 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
Delete the ServiceInstance
167 168 169 170 |
# File 'lib/twilio-ruby/rest/chat/v2/service.rb', line 167 def delete @version.delete('DELETE', @uri) end |
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance
175 176 177 178 179 180 181 182 183 |
# File 'lib/twilio-ruby/rest/chat/v2/service.rb', line 175 def fetch payload = @version.fetch('GET', @uri) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
381 382 383 384 |
# File 'lib/twilio-ruby/rest/chat/v2/service.rb', line 381 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Chat.V2.ServiceContext #{context}>" end |
#roles(sid = :unset) ⇒ RoleList, RoleContext
Access the roles
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'lib/twilio-ruby/rest/chat/v2/service.rb', line 337 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
374 375 376 377 |
# File 'lib/twilio-ruby/rest/chat/v2/service.rb', line 374 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Chat.V2.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_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) ⇒ ServiceInstance
Update the ServiceInstance
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/twilio-ruby/rest/chat/v2/service.rb', line 219 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 ) 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.NewMessage.Sound' => , 'Notifications.NewMessage.BadgeCountEnabled' => , 'Notifications.AddedToChannel.Enabled' => notifications_added_to_channel_enabled, 'Notifications.AddedToChannel.Template' => notifications_added_to_channel_template, 'Notifications.AddedToChannel.Sound' => notifications_added_to_channel_sound, 'Notifications.RemovedFromChannel.Enabled' => notifications_removed_from_channel_enabled, 'Notifications.RemovedFromChannel.Template' => notifications_removed_from_channel_template, 'Notifications.RemovedFromChannel.Sound' => notifications_removed_from_channel_sound, 'Notifications.InvitedToChannel.Enabled' => notifications_invited_to_channel_enabled, 'Notifications.InvitedToChannel.Template' => notifications_invited_to_channel_template, 'Notifications.InvitedToChannel.Sound' => notifications_invited_to_channel_sound, 'PreWebhookUrl' => pre_webhook_url, 'PostWebhookUrl' => post_webhook_url, 'WebhookMethod' => webhook_method, 'WebhookFilters' => Twilio.serialize_list(webhook_filters) { |e| e }, 'Limits.ChannelMembers' => limits_channel_members, 'Limits.UserChannels' => limits_user_channels, 'Media.CompatibilityMessage' => , 'PreWebhookRetryCount' => pre_webhook_retry_count, 'PostWebhookRetryCount' => post_webhook_retry_count, 'Notifications.LogEnabled' => notifications_log_enabled, }) payload = @version.update('POST', @uri, data: data) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#users(sid = :unset) ⇒ UserList, UserContext
Access the users
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/twilio-ruby/rest/chat/v2/service.rb', line 356 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 |