Class: Twilio::REST::Wireless::V1::CommandContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Wireless::V1::CommandContext
- Defined in:
- lib/twilio-ruby/rest/wireless/v1/command.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the CommandInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the CommandInstanceMetadata.
-
#fetch ⇒ CommandInstance
Fetch the CommandInstance.
-
#fetch_with_metadata ⇒ CommandInstance
Fetch the CommandInstanceMetadata.
-
#initialize(version, sid) ⇒ CommandContext
constructor
Initialize the CommandContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, sid) ⇒ CommandContext
Initialize the CommandContext
291 292 293 294 295 296 297 298 299 300 |
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 291 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Commands/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the CommandInstance
304 305 306 307 308 309 310 311 312 |
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 304 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the CommandInstanceMetadata
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 317 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], ) CommandInstanceMetadata.new(@version, command_instance, response.headers, response.status_code) end |
#fetch ⇒ CommandInstance
Fetch the CommandInstance
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 336 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_metadata ⇒ CommandInstance
Fetch the CommandInstanceMetadata
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 355 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], ) CommandInstanceMetadata.new( @version, command_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
387 388 389 390 |
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 387 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Wireless.V1.CommandContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
380 381 382 383 |
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 380 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Wireless.V1.CommandContext #{context}>" end |