Class: Twilio::REST::Intelligence::V2::CustomOperatorContext

Inherits:
Twilio::REST::InstanceContext show all
Defined in:
lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ CustomOperatorContext

Initialize the CustomOperatorContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    A 34 character string that uniquely identifies this Custom Operator.



179
180
181
182
183
184
185
186
187
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 179

def initialize(version, sid)
    super(version)

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/Operators/Custom/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the CustomOperatorInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



191
192
193
194
195
196
197
198
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 191

def delete

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

#fetchCustomOperatorInstance

Fetch the CustomOperatorInstance

Returns:



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 203

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

#inspectObject

Provide a detailed, user friendly representation



260
261
262
263
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 260

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

#to_sObject

Provide a user friendly representation



253
254
255
256
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 253

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

Parameters:

  • friendly_name (String) (defaults to: nil)

    A human-readable name of this resource, up to 64 characters.

  • config (Object) (defaults to: nil)

    Operator configuration, following the schema defined by the Operator Type.

  • if_match (String) (defaults to: :unset)

    The If-Match HTTP request header

Returns:



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 225

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