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



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 379

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

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'unique_name' => payload['unique_name'],
      'account_sid' => payload['account_sid'],
      'chat_instance_sid' => payload['chat_instance_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



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

def 
  @properties['account_sid']
end

#callback_urlString



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

def callback_url
  @properties['callback_url']
end

#chat_instance_sidString



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

def chat_instance_sid
  @properties['chat_instance_sid']
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



409
410
411
412
413
414
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 409

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

#date_createdTime



478
479
480
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 478

def date_created
  @properties['date_created']
end

#date_updatedTime



484
485
486
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 484

def date_updated
  @properties['date_updated']
end

#default_ttlString



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

def default_ttl
  @properties['default_ttl']
end

#deleteBoolean

Delete the ServiceInstance



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

def delete
  context.delete
end

#fetchServiceInstance

Fetch the ServiceInstance



503
504
505
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 503

def fetch
  context.fetch
end

#geo_match_levelservice.GeoMatchLevel



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

def geo_match_level
  @properties['geo_match_level']
end

#inspectObject

Provide a detailed, user friendly representation



598
599
600
601
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 598

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

#intercept_callback_urlString



466
467
468
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 466

def intercept_callback_url
  @properties['intercept_callback_url']
end


496
497
498
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 496

def links
  @properties['links']
end

#number_selection_behaviorservice.NumberSelectionBehavior



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

def number_selection_behavior
  @properties['number_selection_behavior']
end

#out_of_session_callback_urlString



472
473
474
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 472

def out_of_session_callback_url
  @properties['out_of_session_callback_url']
end

#phone_numbersphone_numbers

Access the phone_numbers



578
579
580
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 578

def phone_numbers
  context.phone_numbers
end

#sessionssessions

Access the sessions



571
572
573
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 571

def sessions
  context.sessions
end

#short_codesshort_codes

Access the short_codes



585
586
587
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 585

def short_codes
  context.short_codes
end

#sidString



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

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



591
592
593
594
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 591

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

#unique_nameString



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

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, chat_instance_sid: :unset) ⇒ ServiceInstance

Update the ServiceInstance



555
556
557
558
559
560
561
562
563
564
565
566
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 555

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, chat_instance_sid: :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,
      chat_instance_sid: chat_instance_sid,
  )
end

#urlString



490
491
492
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 490

def url
  @properties['url']
end