Class: Twilio::REST::Supersim::V1::SmsCommandContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ SmsCommandContext

Initialize the SmsCommandContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the SMS Command resource to fetch.



257
258
259
260
261
262
263
264
265
266
# File 'lib/twilio-ruby/rest/supersim/v1/sms_command.rb', line 257

def initialize(version, sid)
    super(version)
    

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

    
end

Instance Method Details

#fetchSmsCommandInstance

Fetch the SmsCommandInstance

Returns:



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/twilio-ruby/rest/supersim/v1/sms_command.rb', line 270

def fetch

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

#fetch_with_metadataSmsCommandInstance

Fetch the SmsCommandInstanceMetadata

Returns:



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/twilio-ruby/rest/supersim/v1/sms_command.rb', line 289

def 

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

#inspectObject

Provide a detailed, user friendly representation



321
322
323
324
# File 'lib/twilio-ruby/rest/supersim/v1/sms_command.rb', line 321

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

#to_sObject

Provide a user friendly representation



314
315
316
317
# File 'lib/twilio-ruby/rest/supersim/v1/sms_command.rb', line 314

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