Class: Twilio::REST::Proxy::V1::ServiceContext::ShortCodeInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/proxy/v1/service/short_code.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, sid: nil) ⇒ ShortCodeInstance

Initialize the ShortCodeInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • service_sid (String) (defaults to: nil)

    The unique SID identifier of the Service.

  • sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this Short Code.



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 244

def initialize(version, payload, service_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'service_sid' => payload['service_sid'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'short_code' => payload['short_code'],
      'iso_country' => payload['iso_country'],
      'capabilities' => payload['capabilities'],
      'url' => payload['url'],
      'is_reserved' => payload['is_reserved'],
  }

  # Context
  @instance_context = nil
  @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns Account Sid.

Returns:

  • (String)

    Account Sid.



285
286
287
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 285

def 
  @properties['account_sid']
end

#capabilitiesString

Returns A list of capabilities.

Returns:

  • (String)

    A list of capabilities.



321
322
323
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 321

def capabilities
  @properties['capabilities']
end

#contextShortCodeContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



270
271
272
273
274
275
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 270

def context
  unless @instance_context
    @instance_context = ShortCodeContext.new(@version, @params['service_sid'], @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The date this Short Code was added to the service.

Returns:

  • (Time)

    The date this Short Code was added to the service



297
298
299
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 297

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Short Code was updated.

Returns:

  • (Time)

    The date this Short Code was updated



303
304
305
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 303

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ShortCodeInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



340
341
342
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 340

def delete
  context.delete
end

#fetchShortCodeInstance

Fetch a ShortCodeInstance

Returns:



347
348
349
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 347

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



369
370
371
372
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 369

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Proxy.V1.ShortCodeInstance #{values}>"
end

#is_reservedBoolean

Returns Reserve for manual assignment to participants only.

Returns:

  • (Boolean)

    Reserve for manual assignment to participants only.



333
334
335
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 333

def is_reserved
  @properties['is_reserved']
end

#iso_countryString

Returns ISO Country Code,.

Returns:

  • (String)

    ISO Country Code,



315
316
317
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 315

def iso_country
  @properties['iso_country']
end

#service_sidString

Returns Service Sid.

Returns:

  • (String)

    Service Sid.



291
292
293
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 291

def service_sid
  @properties['service_sid']
end

#short_codeString

Returns Shortcode.

Returns:

  • (String)

    Shortcode.



309
310
311
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 309

def short_code
  @properties['short_code']
end

#sidString

Returns A string that uniquely identifies this Short Code.

Returns:

  • (String)

    A string that uniquely identifies this Short Code.



279
280
281
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 279

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



362
363
364
365
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 362

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Proxy.V1.ShortCodeInstance #{values}>"
end

#update(is_reserved: :unset) ⇒ ShortCodeInstance

Update the ShortCodeInstance

Parameters:

  • is_reserved (Boolean) (defaults to: :unset)

    Whether or not the short code should be excluded from being assigned to a participant using proxy pool logic

Returns:



356
357
358
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 356

def update(is_reserved: :unset)
  context.update(is_reserved: is_reserved, )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



327
328
329
# File 'lib/twilio-ruby/rest/proxy/v1/service/short_code.rb', line 327

def url
  @properties['url']
end