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)

    The SID of the Account that created this Trigger resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 611

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](www.twilio.com/docs/iam/api/account) that the trigger monitors.

Returns:



653
654
655
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 653

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.



659
660
661
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 659

def api_version
    @properties['api_version']
end

#callback_methodString

Returns The HTTP method we use to call ‘callback_url`. Can be: `GET` or `POST`.

Returns:

  • (String)

    The HTTP method we use to call ‘callback_url`. Can be: `GET` or `POST`.



665
666
667
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 665

def callback_method
    @properties['callback_method']
end

#callback_urlString

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

Returns:

  • (String)

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



671
672
673
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 671

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:



644
645
646
647
648
649
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 644

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.



677
678
679
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 677

def current_value
    @properties['current_value']
end

#date_createdTime

Returns The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



683
684
685
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 683

def date_created
    @properties['date_created']
end

#date_firedTime

Returns The date and time in GMT that the trigger was last fired specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



689
690
691
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 689

def date_fired
    @properties['date_fired']
end

#date_updatedTime

Returns The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



695
696
697
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 695

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the TriggerInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



750
751
752
753
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 750

def delete

    context.delete
end

#fetchTriggerInstance

Fetch the TriggerInstance

Returns:



758
759
760
761
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 758

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.



701
702
703
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 701

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



791
792
793
794
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 791

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

#recurringRecurring

Returns:

  • (Recurring)


707
708
709
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 707

def recurring
    @properties['recurring']
end

#sidString

Returns The unique string that that we created to identify the UsageTrigger resource.

Returns:

  • (String)

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



713
714
715
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 713

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



784
785
786
787
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 784

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

#trigger_byTriggerField

Returns:

  • (TriggerField)


719
720
721
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 719

def trigger_by
    @properties['trigger_by']
end

#trigger_valueString

Returns The value at which the trigger will fire. Must be a positive, numeric value.

Returns:

  • (String)

    The value at which the trigger will fire. Must be a positive, numeric value.



725
726
727
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 725

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:



769
770
771
772
773
774
775
776
777
778
779
780
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 769

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`.



731
732
733
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 731

def uri
    @properties['uri']
end

#usage_categoryString

Returns The usage category the trigger watches. Must be one of the supported [usage categories](www.twilio.com/docs/usage/api/usage-record#usage-categories).

Returns:



737
738
739
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 737

def usage_category
    @properties['usage_category']
end

#usage_record_uriString

Returns The URI of the [UsageRecord](www.twilio.com/docs/usage/api/usage-record) resource this trigger watches, relative to ‘api.twilio.com`.

Returns:



743
744
745
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 743

def usage_record_uri
    @properties['usage_record_uri']
end