class Twilio::REST::Proxy::V1::ServiceContext::ShortCodeInstance
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
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] service_sid
The SID of the ShortCode resource's parent
{Service}[https://www.twilio.com/docs/proxy/api/service] 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/proxy/v1/service/short_code.rb 241 def initialize(version, payload, service_sid: nil, sid: nil) 242 super(version) 243 244 # Marshaled Properties 245 @properties = { 246 'sid' => payload['sid'], 247 'account_sid' => payload['account_sid'], 248 'service_sid' => payload['service_sid'], 249 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 250 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 251 'short_code' => payload['short_code'], 252 'iso_country' => payload['iso_country'], 253 'capabilities' => payload['capabilities'], 254 'url' => payload['url'], 255 'is_reserved' => payload['is_reserved'], 256 } 257 258 # Context 259 @instance_context = nil 260 @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], } 261 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 282 def account_sid 283 @properties['account_sid'] 284 end
@return [String] The capabilities of the short code
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 318 def capabilities 319 @properties['capabilities'] 320 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/proxy/v1/service/short_code.rb 267 def context 268 unless @instance_context 269 @instance_context = ShortCodeContext.new(@version, @params['service_sid'], @params['sid'], ) 270 end 271 @instance_context 272 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 294 def date_created 295 @properties['date_created'] 296 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 300 def date_updated 301 @properties['date_updated'] 302 end
Delete the ShortCodeInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 337 def delete 338 context.delete 339 end
Fetch the ShortCodeInstance
@return [ShortCodeInstance] Fetched ShortCodeInstance
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 344 def fetch 345 context.fetch 346 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 368 def inspect 369 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 370 "<Twilio.Proxy.V1.ShortCodeInstance #{values}>" 371 end
@return [Boolean] Whether the short code should be reserved for manual assignment to participants only
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 330 def is_reserved 331 @properties['is_reserved'] 332 end
@return [String] The ISO Country Code
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 312 def iso_country 313 @properties['iso_country'] 314 end
@return [String] The SID of the resource's parent Service
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 288 def service_sid 289 @properties['service_sid'] 290 end
@return [String] The short code's number
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 306 def short_code 307 @properties['short_code'] 308 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 276 def sid 277 @properties['sid'] 278 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 361 def to_s 362 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 363 "<Twilio.Proxy.V1.ShortCodeInstance #{values}>" 364 end
Update the ShortCodeInstance
@param [Boolean] is_reserved
Whether the short code should be reserved and not
be assigned to a participant using proxy pool logic. See {Reserved Phone Numbers}[https://www.twilio.com/docs/proxy/reserved-phone-numbers] for more information.
@return [ShortCodeInstance] Updated ShortCodeInstance
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 355 def update(is_reserved: :unset) 356 context.update(is_reserved: is_reserved, ) 357 end
@return [String] The absolute URL of the ShortCode resource
# File lib/twilio-ruby/rest/proxy/v1/service/short_code.rb 324 def url 325 @properties['url'] 326 end