Class: Twilio::REST::Preview::Wireless::CommandContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Preview::Wireless::CommandContext
- Defined in:
- lib/twilio-ruby/rest/preview/wireless/command.rb
Instance Method Summary collapse
-
#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/preview/wireless/command.rb', line 283 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Commands/#{@solution[:sid]}" end |
Instance Method Details
#fetch ⇒ CommandInstance
Fetch the CommandInstance
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/twilio-ruby/rest/preview/wireless/command.rb', line 296 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
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/twilio-ruby/rest/preview/wireless/command.rb', line 315 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
347 348 349 350 |
# File 'lib/twilio-ruby/rest/preview/wireless/command.rb', line 347 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Wireless.CommandContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
340 341 342 343 |
# File 'lib/twilio-ruby/rest/preview/wireless/command.rb', line 340 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Wireless.CommandContext #{context}>" end |