Class: Twilio::REST::Api::V2010::AccountContext::UsageList::TriggerInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, sid: nil) ⇒ TriggerInstance

Initialize the TriggerInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this resource.

  • sid (String) (defaults to: nil)

    The Twilio-provided string that uniquely identifies the UsageTrigger resource to fetch.



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 326

def initialize(version, payload, account_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'api_version' => payload['api_version'],
      'callback_method' => payload['callback_method'],
      'callback_url' => payload['callback_url'],
      'current_value' => payload['current_value'],
      'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
      'date_fired' => Twilio.deserialize_rfc2822(payload['date_fired']),
      'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
      'friendly_name' => payload['friendly_name'],
      'recurring' => payload['recurring'],
      'sid' => payload['sid'],
      'trigger_by' => payload['trigger_by'],
      'trigger_value' => payload['trigger_value'],
      'uri' => payload['uri'],
      'usage_category' => payload['usage_category'],
      'usage_record_uri' => payload['usage_record_uri'],
  }

  # Context
  @instance_context = nil
  @params = {'account_sid' => , 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that this trigger monitors.

Returns:

  • (String)

    The SID of the Account that this trigger monitors



367
368
369
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 367

def 
  @properties['account_sid']
end

#api_versionString

Returns The API version used to create the resource.

Returns:

  • (String)

    The API version used to create the resource



373
374
375
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 373

def api_version
  @properties['api_version']
end

#callback_methodString

Returns The HTTP method we use to call callback_url.

Returns:

  • (String)

    The HTTP method we use to call callback_url



379
380
381
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 379

def callback_method
  @properties['callback_method']
end

#callback_urlString

Returns he URL we call when the trigger fires.

Returns:

  • (String)

    he URL we call when the trigger fires



385
386
387
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 385

def callback_url
  @properties['callback_url']
end

#contextTriggerContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



358
359
360
361
362
363
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 358

def context
  unless @instance_context
    @instance_context = TriggerContext.new(@version, @params['account_sid'], @params['sid'], )
  end
  @instance_context
end

#current_valueString

Returns The current value of the field the trigger is watching.

Returns:

  • (String)

    The current value of the field the trigger is watching



391
392
393
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 391

def current_value
  @properties['current_value']
end

#date_createdTime

Returns The RFC 2822 date and time in GMT that the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was created



397
398
399
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 397

def date_created
  @properties['date_created']
end

#date_firedTime

Returns The RFC 2822 date and time in GMT that the trigger was last fired.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the trigger was last fired



403
404
405
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 403

def date_fired
  @properties['date_fired']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT that the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was last updated



409
410
411
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 409

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the TriggerInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



488
489
490
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 488

def delete
  context.delete
end

#fetchTriggerInstance

Fetch a TriggerInstance

Returns:



464
465
466
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 464

def fetch
  context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the trigger.

Returns:

  • (String)

    The string that you assigned to describe the trigger



415
416
417
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 415

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



501
502
503
504
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 501

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Api.V2010.TriggerInstance #{values}>"
end

#recurringtrigger.Recurring

Returns The frequency of a recurring UsageTrigger.

Returns:

  • (trigger.Recurring)

    The frequency of a recurring UsageTrigger



421
422
423
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 421

def recurring
  @properties['recurring']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



427
428
429
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 427

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



494
495
496
497
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 494

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Api.V2010.TriggerInstance #{values}>"
end

#trigger_bytrigger.TriggerField

Returns The field in the UsageRecord resource that fires the trigger.

Returns:

  • (trigger.TriggerField)

    The field in the UsageRecord resource that fires the trigger



433
434
435
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 433

def trigger_by
  @properties['trigger_by']
end

#trigger_valueString

Returns The value at which the trigger will fire.

Returns:

  • (String)

    The value at which the trigger will fire



439
440
441
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 439

def trigger_value
  @properties['trigger_value']
end

#update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) ⇒ TriggerInstance

Update the TriggerInstance

Parameters:

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

    The HTTP method we should use to call ‘callback_url`. Can be: `GET` or `POST` and the default is `POST`.

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

    The URL we should call using ‘callback_method` when the trigger fires.

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

    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

Returns:



477
478
479
480
481
482
483
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 477

def update(callback_method: :unset, callback_url: :unset, friendly_name: :unset)
  context.update(
      callback_method: callback_method,
      callback_url: callback_url,
      friendly_name: friendly_name,
  )
end

#uriString

Returns The URI of the resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI of the resource, relative to ‘api.twilio.com`



445
446
447
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 445

def uri
  @properties['uri']
end

#usage_categorytrigger.UsageCategory

Returns The usage category the trigger watches.

Returns:

  • (trigger.UsageCategory)

    The usage category the trigger watches



451
452
453
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 451

def usage_category
  @properties['usage_category']
end

#usage_record_uriString

Returns The URI of the UsageRecord resource this trigger watches.

Returns:

  • (String)

    The URI of the UsageRecord resource this trigger watches



457
458
459
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 457

def usage_record_uri
  @properties['usage_record_uri']
end