Class: Twilio::REST::Wireless::V1::CommandContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/wireless/v1/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ CommandContext

Initialize the CommandContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Command resource to fetch.



283
284
285
286
287
288
289
290
291
292
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 283

def initialize(version, sid)
    super(version)
    

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

    
end

Instance Method Details

#deleteBoolean

Delete the CommandInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



296
297
298
299
300
301
302
303
304
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 296

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

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

#delete_with_metadataBoolean

Delete the CommandInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 309

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      command_instance = CommandInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      .new(@version, command_instance, response.headers, response.status_code)
end

#fetchCommandInstance

Fetch the CommandInstance

Returns:



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 328

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    CommandInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#fetch_with_metadataCommandInstance

Fetch the CommandInstanceMetadata

Returns:



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 347

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    command_instance = CommandInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    .new(
        @version,
        command_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



379
380
381
382
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 379

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

#to_sObject

Provide a user friendly representation



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

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