Class: Twilio::REST::Proxy::V1::ServiceInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/proxy/v1/service.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, sid: nil) ⇒ ServiceInstance

Initialize the ServiceInstance



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 345

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

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'unique_name' => payload['unique_name'],
      'account_sid' => payload['account_sid'],
      'callback_url' => payload['callback_url'],
      'default_ttl' => payload['default_ttl'].to_i,
      'number_selection_behavior' => payload['number_selection_behavior'],
      'geo_match_level' => payload['geo_match_level'],
      'intercept_callback_url' => payload['intercept_callback_url'],
      'out_of_session_callback_url' => payload['out_of_session_callback_url'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'url' => payload['url'],
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString



395
396
397
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 395

def 
  @properties['account_sid']
end

#callback_urlString



401
402
403
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 401

def callback_url
  @properties['callback_url']
end

#contextServiceContext

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



374
375
376
377
378
379
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 374

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

#date_createdTime



437
438
439
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 437

def date_created
  @properties['date_created']
end

#date_updatedTime



443
444
445
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 443

def date_updated
  @properties['date_updated']
end

#default_ttlString



407
408
409
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 407

def default_ttl
  @properties['default_ttl']
end

#deleteBoolean

Deletes the ServiceInstance



469
470
471
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 469

def delete
  context.delete
end

#fetchServiceInstance

Fetch a ServiceInstance



462
463
464
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 462

def fetch
  context.fetch
end

#geo_match_levelservice.GeoMatchLevel



419
420
421
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 419

def geo_match_level
  @properties['geo_match_level']
end

#inspectObject

Provide a detailed, user friendly representation



536
537
538
539
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 536

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

#intercept_callback_urlString



425
426
427
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 425

def intercept_callback_url
  @properties['intercept_callback_url']
end


455
456
457
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 455

def links
  @properties['links']
end

#number_selection_behaviorservice.NumberSelectionBehavior



413
414
415
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 413

def number_selection_behavior
  @properties['number_selection_behavior']
end

#out_of_session_callback_urlString



431
432
433
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 431

def out_of_session_callback_url
  @properties['out_of_session_callback_url']
end

#phone_numbersphone_numbers

Access the phone_numbers



516
517
518
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 516

def phone_numbers
  context.phone_numbers
end

#sessionssessions

Access the sessions



509
510
511
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 509

def sessions
  context.sessions
end

#short_codesshort_codes

Access the short_codes



523
524
525
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 523

def short_codes
  context.short_codes
end

#sidString



383
384
385
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 383

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



529
530
531
532
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 529

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

#unique_nameString



389
390
391
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 389

def unique_name
  @properties['unique_name']
end

#update(unique_name: :unset, default_ttl: :unset, callback_url: :unset, geo_match_level: :unset, number_selection_behavior: :unset, intercept_callback_url: :unset, out_of_session_callback_url: :unset) ⇒ ServiceInstance

Update the ServiceInstance



494
495
496
497
498
499
500
501
502
503
504
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 494

def update(unique_name: :unset, default_ttl: :unset, callback_url: :unset, geo_match_level: :unset, number_selection_behavior: :unset, intercept_callback_url: :unset, out_of_session_callback_url: :unset)
  context.update(
      unique_name: unique_name,
      default_ttl: default_ttl,
      callback_url: callback_url,
      geo_match_level: geo_match_level,
      number_selection_behavior: number_selection_behavior,
      intercept_callback_url: intercept_callback_url,
      out_of_session_callback_url: out_of_session_callback_url,
  )
end

#urlString



449
450
451
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 449

def url
  @properties['url']
end