Class: Twilio::REST::Events::V1::SubscriptionContext::SubscribedEventContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Events::V1::SubscriptionContext::SubscribedEventContext
- Defined in:
- lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the SubscribedEventInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the SubscribedEventInstanceMetadata.
-
#fetch ⇒ SubscribedEventInstance
Fetch the SubscribedEventInstance.
-
#fetch_with_metadata ⇒ SubscribedEventInstance
Fetch the SubscribedEventInstanceMetadata.
-
#initialize(version, subscription_sid, type) ⇒ SubscribedEventContext
constructor
Initialize the SubscribedEventContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(schema_version: :unset) ⇒ SubscribedEventInstance
Update the SubscribedEventInstance.
-
#update_with_metadata(schema_version: :unset) ⇒ SubscribedEventInstance
Update the SubscribedEventInstanceMetadata.
Constructor Details
#initialize(version, subscription_sid, type) ⇒ SubscribedEventContext
Initialize the SubscribedEventContext
226 227 228 229 230 231 232 233 234 235 |
# File 'lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb', line 226 def initialize(version, subscription_sid, type) super(version) # Path Solution @solution = { subscription_sid: subscription_sid, type: type, } @uri = "/Subscriptions/#{@solution[:subscription_sid]}/SubscribedEvents/#{@solution[:type]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the SubscribedEventInstance
239 240 241 242 243 244 245 246 247 |
# File 'lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb', line 239 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the SubscribedEventInstanceMetadata
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb', line 252 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) subscribedEvent_instance = SubscribedEventInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) SubscribedEventInstanceMetadata.new(@version, subscribedEvent_instance, response.headers, response.status_code) end |
#fetch ⇒ SubscribedEventInstance
Fetch the SubscribedEventInstance
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb', line 271 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) SubscribedEventInstance.new( @version, payload, subscription_sid: @solution[:subscription_sid], type: @solution[:type], ) end |
#fetch_with_metadata ⇒ SubscribedEventInstance
Fetch the SubscribedEventInstanceMetadata
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb', line 291 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) subscribed_event_instance = SubscribedEventInstance.new( @version, response.body, subscription_sid: @solution[:subscription_sid], type: @solution[:type], ) SubscribedEventInstanceMetadata.new( @version, subscribed_event_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
384 385 386 387 |
# File 'lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb', line 384 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Events.V1.SubscribedEventContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
377 378 379 380 |
# File 'lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb', line 377 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Events.V1.SubscribedEventContext #{context}>" end |
#update(schema_version: :unset) ⇒ SubscribedEventInstance
Update the SubscribedEventInstance
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb', line 318 def update( schema_version: :unset ) data = Twilio::Values.of({ 'SchemaVersion' => schema_version, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) SubscribedEventInstance.new( @version, payload, subscription_sid: @solution[:subscription_sid], type: @solution[:type], ) end |
#update_with_metadata(schema_version: :unset) ⇒ SubscribedEventInstance
Update the SubscribedEventInstanceMetadata
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb', line 345 def ( schema_version: :unset ) data = Twilio::Values.of({ 'SchemaVersion' => schema_version, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) subscribed_event_instance = SubscribedEventInstance.new( @version, response.body, subscription_sid: @solution[:subscription_sid], type: @solution[:type], ) SubscribedEventInstanceMetadata.new( @version, subscribed_event_instance, response.headers, response.status_code ) end |