Class: Twilio::REST::Trusthub::V1::TrustProductsContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/trusthub/v1/trust_products.rb,
lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_evaluations.rb,
lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.rb,
lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.rb

Defined Under Namespace

Classes: TrustProductsChannelEndpointAssignmentContext, TrustProductsChannelEndpointAssignmentInstance, TrustProductsChannelEndpointAssignmentList, TrustProductsChannelEndpointAssignmentPage, TrustProductsEntityAssignmentsContext, TrustProductsEntityAssignmentsInstance, TrustProductsEntityAssignmentsList, TrustProductsEntityAssignmentsPage, TrustProductsEvaluationsContext, TrustProductsEvaluationsInstance, TrustProductsEvaluationsList, TrustProductsEvaluationsPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ TrustProductsContext

Initialize the TrustProductsContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The unique string that we created to identify the Trust Product resource.



188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 188

def initialize(version, sid)
    super(version)

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

    # Dependents
    @trust_products_channel_endpoint_assignment = nil
    @trust_products_entity_assignments = nil
    @trust_products_evaluations = nil
end

Instance Method Details

#deleteBoolean

Delete the TrustProductsInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



203
204
205
206
207
208
209
210
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 203

def delete

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

#fetchTrustProductsInstance

Fetch the TrustProductsInstance

Returns:



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 215

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    TrustProductsInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



333
334
335
336
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 333

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

#to_sObject

Provide a user friendly representation



326
327
328
329
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 326

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

#trust_products_channel_endpoint_assignment(sid = :unset) ⇒ TrustProductsChannelEndpointAssignmentList, TrustProductsChannelEndpointAssignmentContext

Access the trust_products_channel_endpoint_assignment

Returns:

Raises:

  • (ArgumentError)


270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 270

def trust_products_channel_endpoint_assignment(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return TrustProductsChannelEndpointAssignmentContext.new(@version, @solution[:sid],sid )
    end

    unless @trust_products_channel_endpoint_assignment
        @trust_products_channel_endpoint_assignment = TrustProductsChannelEndpointAssignmentList.new(
            @version, trust_product_sid: @solution[:sid], )
    end

 @trust_products_channel_endpoint_assignment
end

#trust_products_entity_assignments(sid = :unset) ⇒ TrustProductsEntityAssignmentsList, TrustProductsEntityAssignmentsContext

Access the trust_products_entity_assignments

Returns:

Raises:

  • (ArgumentError)


289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 289

def trust_products_entity_assignments(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return TrustProductsEntityAssignmentsContext.new(@version, @solution[:sid],sid )
    end

    unless @trust_products_entity_assignments
        @trust_products_entity_assignments = TrustProductsEntityAssignmentsList.new(
            @version, trust_product_sid: @solution[:sid], )
    end

 @trust_products_entity_assignments
end

#trust_products_evaluations(sid = :unset) ⇒ TrustProductsEvaluationsList, TrustProductsEvaluationsContext

Access the trust_products_evaluations

Returns:

Raises:

  • (ArgumentError)


308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 308

def trust_products_evaluations(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return TrustProductsEvaluationsContext.new(@version, @solution[:sid],sid )
    end

    unless @trust_products_evaluations
        @trust_products_evaluations = TrustProductsEvaluationsList.new(
            @version, trust_product_sid: @solution[:sid], )
    end

 @trust_products_evaluations
end

#update(status: :unset, status_callback: :unset, friendly_name: :unset, email: :unset) ⇒ TrustProductsInstance

Update the TrustProductsInstance

Parameters:

  • status (Status) (defaults to: :unset)
  • status_callback (String) (defaults to: :unset)

    The URL we call to inform your application of status changes.

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

    The string that you assigned to describe the resource.

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

    The email address that will receive updates when the Trust Product resource changes status.

Returns:



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/twilio-ruby/rest/trusthub/v1/trust_products.rb', line 238

def update(
    status: :unset, 
    status_callback: :unset, 
    friendly_name: :unset, 
    email: :unset
)

    data = Twilio::Values.of({
        'Status' => status,
        'StatusCallback' => status_callback,
        'FriendlyName' => friendly_name,
        'Email' => email,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    TrustProductsInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end