class Twilio::REST::Api::V2010::AccountContext::UsageList::TriggerContext
Public Class Methods
Initialize the TriggerContext
@param [Version] version Version
that contains the resource @param [String] account_sid The SID of the
{Account}[https://www.twilio.com/docs/iam/api/account] that created the UsageTrigger resource to fetch.
@param [String] sid The Twilio-provided string that uniquely identifies the
UsageTrigger resource to fetch.
@return [TriggerContext] TriggerContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb 240 def initialize(version, account_sid, sid) 241 super(version) 242 243 # Path Solution 244 @solution = {account_sid: account_sid, sid: sid, } 245 @uri = "/Accounts/#{@solution[:account_sid]}/Usage/Triggers/#{@solution[:sid]}.json" 246 end
Public Instance Methods
Delete the TriggerInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb 281 def delete 282 @version.delete('DELETE', @uri) 283 end
Fetch the TriggerInstance
@return [TriggerInstance] Fetched TriggerInstance
# File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb 251 def fetch 252 payload = @version.fetch('GET', @uri) 253 254 TriggerInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) 255 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb 294 def inspect 295 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 296 "#<Twilio.Api.V2010.TriggerContext #{context}>" 297 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb 287 def to_s 288 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 289 "#<Twilio.Api.V2010.TriggerContext #{context}>" 290 end
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 266 def update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) 267 data = Twilio::Values.of({ 268 'CallbackMethod' => callback_method, 269 'CallbackUrl' => callback_url, 270 'FriendlyName' => friendly_name, 271 }) 272 273 payload = @version.update('POST', @uri, data: data) 274 275 TriggerInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) 276 end