class Twilio::REST::Messaging::V1::ServiceContext::ShortCodeInstance

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Public Class Methods

new(version, payload, service_sid: nil, sid: nil) click to toggle source

Initialize the ShortCodeInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] service_sid The SID of the

{Service}[https://www.twilio.com/docs/chat/rest/service-resource] the resource
is associated with.

@param [String] sid The SID of the ShortCode resource to fetch. @return [ShortCodeInstance] ShortCodeInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
225 def initialize(version, payload, service_sid: nil, sid: nil)
226   super(version)
227 
228   # Marshaled Properties
229   @properties = {
230       'sid' => payload['sid'],
231       'account_sid' => payload['account_sid'],
232       'service_sid' => payload['service_sid'],
233       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
234       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
235       'short_code' => payload['short_code'],
236       'country_code' => payload['country_code'],
237       'capabilities' => payload['capabilities'],
238       'url' => payload['url'],
239   }
240 
241   # Context
242   @instance_context = nil
243   @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
244 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
265 def account_sid
266   @properties['account_sid']
267 end
capabilities() click to toggle source

@return [Array] An array of values that describe whether the number can receive calls or messages

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
301 def capabilities
302   @properties['capabilities']
303 end
context() click to toggle source

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/messaging/v1/service/short_code.rb
250 def context
251   unless @instance_context
252     @instance_context = ShortCodeContext.new(@version, @params['service_sid'], @params['sid'], )
253   end
254   @instance_context
255 end
country_code() click to toggle source

@return [String] The 2-character ISO Country Code of the number

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
295 def country_code
296   @properties['country_code']
297 end
date_created() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
277 def date_created
278   @properties['date_created']
279 end
date_updated() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
283 def date_updated
284   @properties['date_updated']
285 end
delete() click to toggle source

Delete the ShortCodeInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
314 def delete
315   context.delete
316 end
fetch() click to toggle source

Fetch the ShortCodeInstance @return [ShortCodeInstance] Fetched ShortCodeInstance

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
321 def fetch
322   context.fetch
323 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
334 def inspect
335   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
336   "<Twilio.Messaging.V1.ShortCodeInstance #{values}>"
337 end
service_sid() click to toggle source

@return [String] The SID of the Service that the resource is associated with

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
271 def service_sid
272   @properties['service_sid']
273 end
short_code() click to toggle source

@return [String] The E.164 format of the short code

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
289 def short_code
290   @properties['short_code']
291 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
259 def sid
260   @properties['sid']
261 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
327 def to_s
328   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
329   "<Twilio.Messaging.V1.ShortCodeInstance #{values}>"
330 end
url() click to toggle source

@return [String] The absolute URL of the ShortCode resource

    # File lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
307 def url
308   @properties['url']
309 end