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

Public Class Methods

new(version, payload, account_sid: nil, sid: nil) click to toggle source

Initialize the TriggerInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] account_sid A 34 character string that uniquely identifies this

resource.

@param [String] sid The Twilio-provided string that uniquely identifies the

UsageTrigger resource to fetch.

@return [TriggerInstance] TriggerInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
310 def initialize(version, payload, account_sid: nil, sid: nil)
311   super(version)
312 
313   # Marshaled Properties
314   @properties = {
315       'account_sid' => payload['account_sid'],
316       'api_version' => payload['api_version'],
317       'callback_method' => payload['callback_method'],
318       'callback_url' => payload['callback_url'],
319       'current_value' => payload['current_value'],
320       'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
321       'date_fired' => Twilio.deserialize_rfc2822(payload['date_fired']),
322       'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
323       'friendly_name' => payload['friendly_name'],
324       'recurring' => payload['recurring'],
325       'sid' => payload['sid'],
326       'trigger_by' => payload['trigger_by'],
327       'trigger_value' => payload['trigger_value'],
328       'uri' => payload['uri'],
329       'usage_category' => payload['usage_category'],
330       'usage_record_uri' => payload['usage_record_uri'],
331   }
332 
333   # Context
334   @instance_context = nil
335   @params = {'account_sid' => account_sid, 'sid' => sid || @properties['sid'], }
336 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that this trigger monitors

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
351 def account_sid
352   @properties['account_sid']
353 end
api_version() click to toggle source

@return [String] The API version used to create the resource

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
357 def api_version
358   @properties['api_version']
359 end
callback_method() click to toggle source

@return [String] The HTTP method we use to call callback_url

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
363 def callback_method
364   @properties['callback_method']
365 end
callback_url() click to toggle source

@return [String] he URL we call when the trigger fires

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
369 def callback_url
370   @properties['callback_url']
371 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [TriggerContext] TriggerContext for this TriggerInstance

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
342 def context
343   unless @instance_context
344     @instance_context = TriggerContext.new(@version, @params['account_sid'], @params['sid'], )
345   end
346   @instance_context
347 end
current_value() click to toggle source

@return [String] The current value of the field the trigger is watching

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
375 def current_value
376   @properties['current_value']
377 end
date_created() click to toggle source

@return [Time] The RFC 2822 date and time in GMT that the resource was created

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
381 def date_created
382   @properties['date_created']
383 end
date_fired() click to toggle source

@return [Time] The RFC 2822 date and time in GMT that the trigger was last fired

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
387 def date_fired
388   @properties['date_fired']
389 end
date_updated() click to toggle source

@return [Time] The RFC 2822 date and time in GMT that the resource was last updated

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
393 def date_updated
394   @properties['date_updated']
395 end
delete() click to toggle source

Delete the TriggerInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
472 def delete
473   context.delete
474 end
fetch() click to toggle source

Fetch the TriggerInstance @return [TriggerInstance] Fetched TriggerInstance

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
448 def fetch
449   context.fetch
450 end
friendly_name() click to toggle source

@return [String] The string that you assigned to describe the trigger

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
399 def friendly_name
400   @properties['friendly_name']
401 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
485 def inspect
486   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
487   "<Twilio.Api.V2010.TriggerInstance #{values}>"
488 end
recurring() click to toggle source

@return [trigger.Recurring] The frequency of a recurring UsageTrigger

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
405 def recurring
406   @properties['recurring']
407 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
411 def sid
412   @properties['sid']
413 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
478 def to_s
479   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
480   "<Twilio.Api.V2010.TriggerInstance #{values}>"
481 end
trigger_by() click to toggle source

@return [trigger.TriggerField] The field in the UsageRecord resource that fires the trigger

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
417 def trigger_by
418   @properties['trigger_by']
419 end
trigger_value() click to toggle source

@return [String] The value at which the trigger will fire

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
423 def trigger_value
424   @properties['trigger_value']
425 end
update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) click to toggle source

Update the TriggerInstance @param [String] callback_method The HTTP method we should use to call

`callback_url`. Can be: `GET` or `POST` and the default is `POST`.

@param [String] callback_url The URL we should call using `callback_method` when

the trigger fires.

@param [String] friendly_name A descriptive string that you create to describe

the resource. It can be up to 64 characters long.

@return [TriggerInstance] Updated TriggerInstance

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
461 def update(callback_method: :unset, callback_url: :unset, friendly_name: :unset)
462   context.update(
463       callback_method: callback_method,
464       callback_url: callback_url,
465       friendly_name: friendly_name,
466   )
467 end
uri() click to toggle source

@return [String] The URI of the resource, relative to `api.twilio.com`

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
429 def uri
430   @properties['uri']
431 end
usage_category() click to toggle source

@return [trigger.UsageCategory] The usage category the trigger watches

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
435 def usage_category
436   @properties['usage_category']
437 end
usage_record_uri() click to toggle source

@return [String] The URI of the UsageRecord resource this trigger watches

    # File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
441 def usage_record_uri
442   @properties['usage_record_uri']
443 end