Class: Twilio::REST::Numbers::V2::RegulatoryComplianceList::BundleContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb,
lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/evaluation.rb,
lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.rb

Defined Under Namespace

Classes: EvaluationContext, EvaluationInstance, EvaluationList, EvaluationPage, ItemAssignmentContext, ItemAssignmentInstance, ItemAssignmentList, ItemAssignmentPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ BundleContext

Initialize the BundleContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The unique string that we created to identify the Bundle resource.


230
231
232
233
234
235
236
237
238
239
240
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 230

def initialize(version, sid)
  super(version)

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

  # Dependents
  @evaluations = nil
  @item_assignments = nil
end

Instance Method Details

#deleteBoolean

Delete the BundleInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


277
278
279
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 277

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

#evaluations(sid = :unset) ⇒ EvaluationList, EvaluationContext

Access the evaluations

Returns:

Raises:

  • (ArgumentError)

285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 285

def evaluations(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

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

  unless @evaluations
    @evaluations = EvaluationList.new(@version, bundle_sid: @solution[:sid], )
  end

  @evaluations
end

#fetchBundleInstance

Fetch the BundleInstance

Returns:


245
246
247
248
249
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 245

def fetch
  payload = @version.fetch('GET', @uri)

  BundleInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


326
327
328
329
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 326

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

#item_assignments(sid = :unset) ⇒ ItemAssignmentList, ItemAssignmentContext

Access the item_assignments

Returns:

Raises:

  • (ArgumentError)

303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 303

def item_assignments(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

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

  unless @item_assignments
    @item_assignments = ItemAssignmentList.new(@version, bundle_sid: @solution[:sid], )
  end

  @item_assignments
end

#to_sObject

Provide a user friendly representation


319
320
321
322
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 319

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

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

Update the BundleInstance

Parameters:

  • status (bundle.Status) (defaults to: :unset)

    The verification status of the Bundle resource.

  • 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 Bundle resource changes status.

Returns:


261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 261

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,
  })

  payload = @version.update('POST', @uri, data: data)

  BundleInstance.new(@version, payload, sid: @solution[:sid], )
end