Class: Twilio::REST::Intelligence::V2::CustomOperatorContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::Intelligence::V2::CustomOperatorContext
- Defined in:
- lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the CustomOperatorInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the CustomOperatorInstanceMetadata.
-
#fetch ⇒ CustomOperatorInstance
Fetch the CustomOperatorInstance.
-
#fetch_with_metadata ⇒ CustomOperatorInstance
Fetch the CustomOperatorInstanceMetadata.
-
#initialize(version, sid) ⇒ CustomOperatorContext
constructor
Initialize the CustomOperatorContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: nil, config: nil, if_match: :unset) ⇒ CustomOperatorInstance
Update the CustomOperatorInstance.
-
#update_with_metadata(friendly_name: nil, config: nil, if_match: :unset) ⇒ CustomOperatorInstance
Update the CustomOperatorInstanceMetadata.
Constructor Details
#initialize(version, sid) ⇒ CustomOperatorContext
Initialize the CustomOperatorContext
251 252 253 254 255 256 257 258 259 260 |
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 251 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Operators/Custom/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the CustomOperatorInstance
264 265 266 267 268 269 270 271 272 |
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 264 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 CustomOperatorInstanceMetadata
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 277 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) customOperator_instance = CustomOperatorInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) CustomOperatorInstanceMetadata.new(@version, customOperator_instance, response.headers, response.status_code) end |
#fetch ⇒ CustomOperatorInstance
Fetch the CustomOperatorInstance
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 296 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) CustomOperatorInstance.new( @version, payload, sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ CustomOperatorInstance
Fetch the CustomOperatorInstanceMetadata
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/intelligence/v2/custom_operator.rb', line 315 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) custom_operator_instance = CustomOperatorInstance.new( @version, response.body, sid: @solution[:sid], ) CustomOperatorInstanceMetadata.new( @version, custom_operator_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
415 416 417 418 |
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 415 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Intelligence.V2.CustomOperatorContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
408 409 410 411 |
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 408 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Intelligence.V2.CustomOperatorContext #{context}>" end |
#update(friendly_name: nil, config: nil, if_match: :unset) ⇒ CustomOperatorInstance
Update the CustomOperatorInstance
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 343 def update( friendly_name: nil, config: nil, if_match: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'Config' => Twilio.serialize_object(config), }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) payload = @version.update('POST', @uri, data: data, headers: headers) CustomOperatorInstance.new( @version, payload, sid: @solution[:sid], ) end |
#update_with_metadata(friendly_name: nil, config: nil, if_match: :unset) ⇒ CustomOperatorInstance
Update the CustomOperatorInstanceMetadata
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 374 def ( friendly_name: nil, config: nil, if_match: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'Config' => Twilio.serialize_object(config), }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) response = @version.('POST', @uri, data: data, headers: headers) custom_operator_instance = CustomOperatorInstance.new( @version, response.body, sid: @solution[:sid], ) CustomOperatorInstanceMetadata.new( @version, custom_operator_instance, response.headers, response.status_code ) end |