Class: Twilio::REST::Notify::V1::ServiceContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Notify::V1::ServiceContext
- Defined in:
- lib/twilio-ruby/rest/notify/v1/service.rb,
lib/twilio-ruby/rest/notify/v1/service/binding.rb,
lib/twilio-ruby/rest/notify/v1/service/notification.rb
Defined Under Namespace
Classes: BindingContext, BindingInstance, BindingList, BindingPage, NotificationInstance, NotificationList, NotificationPage
Instance Method Summary collapse
-
#bindings(sid = :unset) ⇒ BindingList, BindingContext
Access the bindings.
-
#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.
-
#notifications ⇒ NotificationList, NotificationContext
Access the notifications.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, apn_credential_sid: :unset, gcm_credential_sid: :unset, messaging_service_sid: :unset, facebook_messenger_page_id: :unset, default_apn_notification_protocol_version: :unset, default_gcm_notification_protocol_version: :unset, fcm_credential_sid: :unset, default_fcm_notification_protocol_version: :unset, log_enabled: :unset, alexa_skill_id: :unset, default_alexa_notification_protocol_version: :unset, delivery_callback_url: :unset, delivery_callback_enabled: :unset) ⇒ ServiceInstance
Update the ServiceInstance.
Constructor Details
#initialize(version, sid) ⇒ ServiceContext
Initialize the ServiceContext
206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/twilio-ruby/rest/notify/v1/service.rb', line 206 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Services/#{@solution[:sid]}" # Dependents @notifications = nil @bindings = nil end |
Instance Method Details
#bindings(sid = :unset) ⇒ BindingList, BindingContext
Access the bindings
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/twilio-ruby/rest/notify/v1/service.rb', line 328 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 |
#delete ⇒ Boolean
Delete the ServiceInstance
220 221 222 223 224 225 226 227 |
# File 'lib/twilio-ruby/rest/notify/v1/service.rb', line 220 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/twilio-ruby/rest/notify/v1/service.rb', line 232 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 |
#inspect ⇒ Object
Provide a detailed, user friendly representation
353 354 355 356 |
# File 'lib/twilio-ruby/rest/notify/v1/service.rb', line 353 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Notify.V1.ServiceContext #{context}>" end |
#notifications ⇒ NotificationList, NotificationContext
Access the notifications
317 318 319 320 321 322 323 |
# File 'lib/twilio-ruby/rest/notify/v1/service.rb', line 317 def notifications unless @notifications @notifications = NotificationList.new( @version, service_sid: @solution[:sid], ) end @notifications end |
#to_s ⇒ Object
Provide a user friendly representation
346 347 348 349 |
# File 'lib/twilio-ruby/rest/notify/v1/service.rb', line 346 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Notify.V1.ServiceContext #{context}>" end |
#update(friendly_name: :unset, apn_credential_sid: :unset, gcm_credential_sid: :unset, messaging_service_sid: :unset, facebook_messenger_page_id: :unset, default_apn_notification_protocol_version: :unset, default_gcm_notification_protocol_version: :unset, fcm_credential_sid: :unset, default_fcm_notification_protocol_version: :unset, log_enabled: :unset, alexa_skill_id: :unset, default_alexa_notification_protocol_version: :unset, delivery_callback_url: :unset, delivery_callback_enabled: :unset) ⇒ ServiceInstance
Update the ServiceInstance
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 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/twilio-ruby/rest/notify/v1/service.rb', line 265 def update( friendly_name: :unset, apn_credential_sid: :unset, gcm_credential_sid: :unset, messaging_service_sid: :unset, facebook_messenger_page_id: :unset, default_apn_notification_protocol_version: :unset, default_gcm_notification_protocol_version: :unset, fcm_credential_sid: :unset, default_fcm_notification_protocol_version: :unset, log_enabled: :unset, alexa_skill_id: :unset, default_alexa_notification_protocol_version: :unset, delivery_callback_url: :unset, delivery_callback_enabled: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'ApnCredentialSid' => apn_credential_sid, 'GcmCredentialSid' => gcm_credential_sid, 'MessagingServiceSid' => messaging_service_sid, 'FacebookMessengerPageId' => facebook_messenger_page_id, 'DefaultApnNotificationProtocolVersion' => default_apn_notification_protocol_version, 'DefaultGcmNotificationProtocolVersion' => default_gcm_notification_protocol_version, 'FcmCredentialSid' => fcm_credential_sid, 'DefaultFcmNotificationProtocolVersion' => default_fcm_notification_protocol_version, 'LogEnabled' => log_enabled, 'AlexaSkillId' => alexa_skill_id, 'DefaultAlexaNotificationProtocolVersion' => default_alexa_notification_protocol_version, 'DeliveryCallbackUrl' => delivery_callback_url, 'DeliveryCallbackEnabled' => delivery_callback_enabled, }) 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 |