Class: Twilio::REST::Events::V1::SinkContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/events/v1/sink.rb,
lib/twilio-ruby/rest/events/v1/sink/sink_test.rb,
lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Defined Under Namespace

Classes: SinkTestInstance, SinkTestList, SinkTestPage, SinkValidateInstance, SinkValidateList, SinkValidatePage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ SinkContext

Initialize the SinkContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    A 34 character string that uniquely identifies this Sink.



171
172
173
174
175
176
177
178
179
180
181
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 171

def initialize(version, sid)
    super(version)

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/Sinks/#{@solution[:sid]}"

    # Dependents
    @sink_test = nil
    @sink_validate = nil
end

Instance Method Details

#deleteBoolean

Delete the SinkInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



185
186
187
188
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 185

def delete

    @version.delete('DELETE', @uri)
end

#fetchSinkInstance

Fetch the SinkInstance

Returns:



193
194
195
196
197
198
199
200
201
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 193

def fetch

    payload = @version.fetch('GET', @uri)
    SinkInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



255
256
257
258
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 255

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Events.V1.SinkContext #{context}>"
end

#sink_testSinkTestList, SinkTestContext

Access the sink_test

Returns:



227
228
229
230
231
232
233
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 227

def sink_test
  unless @sink_test
    @sink_test = SinkTestList.new(
            @version, sid: @solution[:sid], )
  end
  @sink_test
end

#sink_validateSinkValidateList, SinkValidateContext

Access the sink_validate

Returns:



238
239
240
241
242
243
244
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 238

def sink_validate
  unless @sink_validate
    @sink_validate = SinkValidateList.new(
            @version, sid: @solution[:sid], )
  end
  @sink_validate
end

#to_sObject

Provide a user friendly representation



248
249
250
251
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 248

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Events.V1.SinkContext #{context}>"
end

#update(description: nil) ⇒ SinkInstance

Update the SinkInstance

Parameters:

  • description (String) (defaults to: nil)

    A human readable description for the Sink **This value should not contain PII.**

Returns:



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/twilio-ruby/rest/events/v1/sink.rb', line 207

def update(
    description: nil
)

    data = Twilio::Values.of({
        'Description' => description,
    })

    payload = @version.update('POST', @uri, data: data)
    SinkInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end