Class: Twilio::REST::Events::V1::SinkInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/events/v1/sink.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ SinkInstance

Initialize the SinkInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this Sink.



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 249

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'description' => payload['description'],
      'sid' => payload['sid'],
      'sink_configuration' => payload['sink_configuration'],
      'sink_type' => payload['sink_type'],
      'status' => payload['status'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#contextSinkContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



274
275
276
277
278
279
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 274

def context
  unless @instance_context
    @instance_context = SinkContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The date this Sink was created.

Returns:

  • (Time)

    The date this Sink was created



283
284
285
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 283

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Sink was updated.

Returns:

  • (Time)

    The date this Sink was updated



289
290
291
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 289

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the SinkInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



345
346
347
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 345

def delete
  context.delete
end

#descriptionString

Returns Sink Description.

Returns:

  • (String)

    Sink Description



295
296
297
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 295

def description
  @properties['description']
end

#fetchSinkInstance

Fetch the SinkInstance

Returns:



338
339
340
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 338

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



372
373
374
375
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 372

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Events.V1.SinkInstance #{values}>"
end

Returns Nested resource URLs.

Returns:

  • (String)

    Nested resource URLs.



331
332
333
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 331

def links
  @properties['links']
end

#sidString

Returns A string that uniquely identifies this Sink.

Returns:

  • (String)

    A string that uniquely identifies this Sink.



301
302
303
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 301

def sid
  @properties['sid']
end

#sink_configurationHash

Returns JSON Sink configuration.

Returns:

  • (Hash)

    JSON Sink configuration.



307
308
309
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 307

def sink_configuration
  @properties['sink_configuration']
end

#sink_testsink_test

Access the sink_test

Returns:



352
353
354
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 352

def sink_test
  context.sink_test
end

#sink_typesink.SinkType

Returns Sink type.

Returns:

  • (sink.SinkType)

    Sink type.



313
314
315
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 313

def sink_type
  @properties['sink_type']
end

#sink_validatesink_validate

Access the sink_validate

Returns:



359
360
361
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 359

def sink_validate
  context.sink_validate
end

#statussink.Status

Returns The Status of this Sink.

Returns:

  • (sink.Status)

    The Status of this Sink



319
320
321
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 319

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation



365
366
367
368
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 365

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Events.V1.SinkInstance #{values}>"
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



325
326
327
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 325

def url
  @properties['url']
end