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
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
#delete ⇒ Boolean
Delete the CommandInstance
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_metadata ⇒ Boolean
Delete the CommandInstanceMetadata
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], ) CommandInstanceMetadata.new(@version, command_instance, response.headers, response.status_code) end |
#fetch ⇒ CommandInstance
Fetch the CommandInstance
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_metadata ⇒ CommandInstance
Fetch the CommandInstanceMetadata
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], ) CommandInstanceMetadata.new( @version, command_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
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_s ⇒ Object
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 |