Class: Twilio::REST::Api::V2010::AccountContext::UsageList::TriggerContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::UsageList::TriggerContext
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the TriggerInstance.
-
#fetch ⇒ TriggerInstance
Fetch the TriggerInstance.
-
#initialize(version, account_sid, sid) ⇒ TriggerContext
constructor
Initialize the TriggerContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) ⇒ TriggerInstance
Update the TriggerInstance.
Constructor Details
#initialize(version, account_sid, sid) ⇒ TriggerContext
Initialize the TriggerContext
202 203 204 205 206 207 208 209 210 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 202 def initialize(version, account_sid, sid) super(version) # Path Solution @solution = { account_sid: account_sid, sid: sid, } @uri = "/Accounts/#{@solution[:account_sid]}/Usage/Triggers/#{@solution[:sid]}.json" end |
Instance Method Details
#delete ⇒ Boolean
Delete the TriggerInstance
214 215 216 217 218 219 220 221 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 214 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ TriggerInstance
Fetch the TriggerInstance
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 226 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) TriggerInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
286 287 288 289 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 286 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.TriggerContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
279 280 281 282 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 279 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.TriggerContext #{context}>" end |
#update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) ⇒ TriggerInstance
Update the TriggerInstance
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 249 def update( callback_method: :unset, callback_url: :unset, friendly_name: :unset ) data = Twilio::Values.of({ 'CallbackMethod' => callback_method, 'CallbackUrl' => callback_url, 'FriendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) TriggerInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |