class Twilio::REST::Api::V2010::AccountContext::ShortCodeInstance
Public Class Methods
Initialize the ShortCodeInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] account_sid
The SID of the
{Account}[https://www.twilio.com/docs/iam/api/account] that created this ShortCode resource.
@param [String] sid The Twilio-provided string that uniquely identifies the
ShortCode resource to fetch
@return [ShortCodeInstance] ShortCodeInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 256 def initialize(version, payload, account_sid: nil, sid: nil) 257 super(version) 258 259 # Marshaled Properties 260 @properties = { 261 'account_sid' => payload['account_sid'], 262 'api_version' => payload['api_version'], 263 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 264 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 265 'friendly_name' => payload['friendly_name'], 266 'short_code' => payload['short_code'], 267 'sid' => payload['sid'], 268 'sms_fallback_method' => payload['sms_fallback_method'], 269 'sms_fallback_url' => payload['sms_fallback_url'], 270 'sms_method' => payload['sms_method'], 271 'sms_url' => payload['sms_url'], 272 'uri' => payload['uri'], 273 } 274 275 # Context 276 @instance_context = nil 277 @params = {'account_sid' => account_sid, 'sid' => sid || @properties['sid'], } 278 end
Public Instance Methods
@return [String] The SID of the Account that created this resource
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 293 def account_sid 294 @properties['account_sid'] 295 end
@return [String] The API version used to start a new TwiML
session
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 299 def api_version 300 @properties['api_version'] 301 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [ShortCodeContext] ShortCodeContext
for this ShortCodeInstance
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 284 def context 285 unless @instance_context 286 @instance_context = ShortCodeContext.new(@version, @params['account_sid'], @params['sid'], ) 287 end 288 @instance_context 289 end
@return [Time] The RFC 2822 date and time in GMT that this resource was created
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 305 def date_created 306 @properties['date_created'] 307 end
@return [Time] The RFC 2822 date and time in GMT that this resource was last updated
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 311 def date_updated 312 @properties['date_updated'] 313 end
Fetch the ShortCodeInstance
@return [ShortCodeInstance] Fetched ShortCodeInstance
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 366 def fetch 367 context.fetch 368 end
@return [String] A string that you assigned to describe this resource
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 317 def friendly_name 318 @properties['friendly_name'] 319 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 406 def inspect 407 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 408 "<Twilio.Api.V2010.ShortCodeInstance #{values}>" 409 end
@return [String] The short code. e.g., 894546.
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 323 def short_code 324 @properties['short_code'] 325 end
@return [String] The unique string that identifies this resource
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 329 def sid 330 @properties['sid'] 331 end
@return [String] HTTP
method we use to call the sms_fallback_url
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 335 def sms_fallback_method 336 @properties['sms_fallback_method'] 337 end
@return [String] HTTP
method to use when requesting the sms url
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 347 def sms_method 348 @properties['sms_method'] 349 end
@return [String] URL we call when receiving an incoming SMS message to this short code
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 353 def sms_url 354 @properties['sms_url'] 355 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 399 def to_s 400 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 401 "<Twilio.Api.V2010.ShortCodeInstance #{values}>" 402 end
Update the ShortCodeInstance
@param [String] friendly_name
A descriptive string that you created to describe
this resource. It can be up to 64 characters long. By default, the `FriendlyName` is the short code.
@param [String] api_version
The API version to use to start a new TwiML
session.
Can be: `2010-04-01` or `2008-08-01`.
@param [String] sms_url
The URL we should call when receiving an incoming SMS
message to this short code.
@param [String] sms_method
The HTTP
method we should use when calling the
`sms_url`. Can be: `GET` or `POST`.
@param [String] sms_fallback_url
The URL that we should call if an error occurs
while retrieving or executing the TwiML from `sms_url`.
@param [String] sms_fallback_method
The HTTP
method that we should use to call
the `sms_fallback_url`. Can be: `GET` or `POST`.
@return [ShortCodeInstance] Updated ShortCodeInstance
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 386 def update(friendly_name: :unset, api_version: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset) 387 context.update( 388 friendly_name: friendly_name, 389 api_version: api_version, 390 sms_url: sms_url, 391 sms_method: sms_method, 392 sms_fallback_url: sms_fallback_url, 393 sms_fallback_method: sms_fallback_method, 394 ) 395 end
@return [String] The URI of this resource, relative to `api.twilio.com`
# File lib/twilio-ruby/rest/api/v2010/account/short_code.rb 359 def uri 360 @properties['uri'] 361 end