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.



196
197
198
199
200
201
202
203
204
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 196

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



208
209
210
211
212
213
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 208

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchCommandInstance

Fetch the CommandInstance

Returns:



218
219
220
221
222
223
224
225
226
227
228
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 218

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

#inspectObject

Provide a detailed, user friendly representation



240
241
242
243
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 240

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

#to_sObject

Provide a user friendly representation



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

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