class Twilio::REST::Api::V2010::AccountContext::ShortCodeContext

Public Class Methods

new(version, account_sid, sid) click to toggle source

Initialize the ShortCodeContext @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
ShortCode resource(s) to fetch.

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

ShortCode resource to fetch

@return [ShortCodeContext] ShortCodeContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/api/v2010/account/short_code.rb
182 def initialize(version, account_sid, sid)
183   super(version)
184 
185   # Path Solution
186   @solution = {account_sid: account_sid, sid: sid, }
187   @uri = "/Accounts/#{@solution[:account_sid]}/SMS/ShortCodes/#{@solution[:sid]}.json"
188 end

Public Instance Methods

fetch() click to toggle source

Fetch the ShortCodeInstance @return [ShortCodeInstance] Fetched ShortCodeInstance

    # File lib/twilio-ruby/rest/api/v2010/account/short_code.rb
193 def fetch
194   payload = @version.fetch('GET', @uri)
195 
196   ShortCodeInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], )
197 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/short_code.rb
239 def inspect
240   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
241   "#<Twilio.Api.V2010.ShortCodeContext #{context}>"
242 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/short_code.rb
232 def to_s
233   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
234   "#<Twilio.Api.V2010.ShortCodeContext #{context}>"
235 end
update(friendly_name: :unset, api_version: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset) click to toggle source

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
215 def update(friendly_name: :unset, api_version: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset)
216   data = Twilio::Values.of({
217       'FriendlyName' => friendly_name,
218       'ApiVersion' => api_version,
219       'SmsUrl' => sms_url,
220       'SmsMethod' => sms_method,
221       'SmsFallbackUrl' => sms_fallback_url,
222       'SmsFallbackMethod' => sms_fallback_method,
223   })
224 
225   payload = @version.update('POST', @uri, data: data)
226 
227   ShortCodeInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], )
228 end