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.



171
172
173
174
175
176
177
178
179
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 171

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



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

def delete

    
    @version.delete('DELETE', @uri)
end

#fetchCustomOperatorInstance

Fetch the CustomOperatorInstance

Returns:



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

def fetch

    
    payload = @version.fetch('GET', @uri)
    CustomOperatorInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



240
241
242
243
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 240

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

#to_sObject

Provide a user friendly representation



233
234
235
236
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 233

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:



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb', line 209

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({ 'If-Match' => if_match, })
    payload = @version.update('POST', @uri, data: data, headers: headers)
    CustomOperatorInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end