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.


232
233
234
235
236
237
238
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 232

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


252
253
254
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 252

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

#fetchCommandInstance

Fetch the CommandInstance

Returns:


243
244
245
246
247
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 243

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

  CommandInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


265
266
267
268
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 265

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

#to_sObject

Provide a user friendly representation


258
259
260
261
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 258

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