Class: Twilio::REST::Api::V2010::AccountContext::RecordingContext::AddOnResultContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb,
lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb

Defined Under Namespace

Classes: PayloadContext, PayloadInstance, PayloadList, PayloadPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, reference_sid, sid) ⇒ AddOnResultContext

Initialize the AddOnResultContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the Account that created the Recording AddOnResult resource to fetch.

  • reference_sid (String)

    The SID of the recording to which the result to fetch belongs.

  • sid (String)

    The Twilio-provided string that uniquely identifies the Recording AddOnResult resource to fetch.


166
167
168
169
170
171
172
173
174
175
# File 'lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb', line 166

def initialize(version, , reference_sid, sid)
  super(version)

  # Path Solution
  @solution = {account_sid: , reference_sid: reference_sid, sid: sid, }
  @uri = "/Accounts/#{@solution[:account_sid]}/Recordings/#{@solution[:reference_sid]}/AddOnResults/#{@solution[:sid]}.json"

  # Dependents
  @payloads = nil
end

Instance Method Details

#deleteBoolean

Delete the AddOnResultInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


195
196
197
# File 'lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb', line 195

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

#fetchAddOnResultInstance

Fetch the AddOnResultInstance

Returns:


180
181
182
183
184
185
186
187
188
189
190
# File 'lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb', line 180

def fetch
  payload = @version.fetch('GET', @uri)

  AddOnResultInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      reference_sid: @solution[:reference_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation


237
238
239
240
# File 'lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb', line 237

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

#payloads(sid = :unset) ⇒ PayloadList, PayloadContext

Access the payloads

Returns:

Raises:

  • (ArgumentError)

203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb', line 203

def payloads(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return PayloadContext.new(
        @version,
        @solution[:account_sid],
        @solution[:reference_sid],
        @solution[:sid],
        sid,
    )
  end

  unless @payloads
    @payloads = PayloadList.new(
        @version,
        account_sid: @solution[:account_sid],
        reference_sid: @solution[:reference_sid],
        add_on_result_sid: @solution[:sid],
    )
  end

  @payloads
end

#to_sObject

Provide a user friendly representation


230
231
232
233
# File 'lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb', line 230

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