Class: Twilio::REST::Messaging::V1::ServiceInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/messaging/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



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 442

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

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'friendly_name' => payload['friendly_name'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'inbound_request_url' => payload['inbound_request_url'],
      'inbound_method' => payload['inbound_method'],
      'fallback_url' => payload['fallback_url'],
      'fallback_method' => payload['fallback_method'],
      'status_callback' => payload['status_callback'],
      'sticky_sender' => payload['sticky_sender'],
      'mms_converter' => payload['mms_converter'],
      'smart_encoding' => payload['smart_encoding'],
      'scan_message_content' => payload['scan_message_content'],
      'fallback_to_long_code' => payload['fallback_to_long_code'],
      'area_code_geomatch' => payload['area_code_geomatch'],
      'synchronous_validation' => payload['synchronous_validation'],
      'validity_period' => payload['validity_period'].to_i,
      'url' => payload['url'],
      'links' => payload['links'],
      'use_inbound_webhook_on_number' => payload['use_inbound_webhook_on_number'],
  }

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

Instance Method Details

#account_sidString



494
495
496
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 494

def 
  @properties['account_sid']
end

#alpha_sendersalpha_senders

Access the alpha_senders



712
713
714
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 712

def alpha_senders
  context.alpha_senders
end

#area_code_geomatchBoolean



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

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



479
480
481
482
483
484
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 479

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

#date_createdTime



506
507
508
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 506

def date_created
  @properties['date_created']
end

#date_updatedTime



512
513
514
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 512

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance



691
692
693
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 691

def delete
  context.delete
end

#fallback_methodString



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

def fallback_method
  @properties['fallback_method']
end

#fallback_to_long_codeBoolean



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

def fallback_to_long_code
  @properties['fallback_to_long_code']
end

#fallback_urlString



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

def fallback_url
  @properties['fallback_url']
end

#fetchServiceInstance

Fetch the ServiceInstance



684
685
686
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 684

def fetch
  context.fetch
end

#friendly_nameString



500
501
502
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 500

def friendly_name
  @properties['friendly_name']
end

#inbound_methodString



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

def inbound_method
  @properties['inbound_method']
end

#inbound_request_urlString



518
519
520
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 518

def inbound_request_url
  @properties['inbound_request_url']
end

#inspectObject

Provide a detailed, user friendly representation



739
740
741
742
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 739

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


602
603
604
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 602

def links
  @properties['links']
end

#mms_converterBoolean



554
555
556
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 554

def mms_converter
  @properties['mms_converter']
end

#phone_numbersphone_numbers

Access the phone_numbers



698
699
700
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 698

def phone_numbers
  context.phone_numbers
end

#scan_message_contentservice.ScanMessageContent



566
567
568
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 566

def scan_message_content
  @properties['scan_message_content']
end

#short_codesshort_codes

Access the short_codes



705
706
707
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 705

def short_codes
  context.short_codes
end

#sidString



488
489
490
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 488

def sid
  @properties['sid']
end

#smart_encodingBoolean



560
561
562
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 560

def smart_encoding
  @properties['smart_encoding']
end

#status_callbackString



542
543
544
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 542

def status_callback
  @properties['status_callback']
end

#sticky_senderBoolean



548
549
550
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 548

def sticky_sender
  @properties['sticky_sender']
end

#synchronous_validationBoolean



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

def synchronous_validation
  @properties['synchronous_validation']
end

#to_sObject

Provide a user friendly representation



732
733
734
735
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 732

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

#update(friendly_name: :unset, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset, use_inbound_webhook_on_number: :unset) ⇒ ServiceInstance

Update the ServiceInstance



661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 661

def update(friendly_name: :unset, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset, use_inbound_webhook_on_number: :unset)
  context.update(
      friendly_name: friendly_name,
      inbound_request_url: inbound_request_url,
      inbound_method: inbound_method,
      fallback_url: fallback_url,
      fallback_method: fallback_method,
      status_callback: status_callback,
      sticky_sender: sticky_sender,
      mms_converter: mms_converter,
      smart_encoding: smart_encoding,
      scan_message_content: scan_message_content,
      fallback_to_long_code: fallback_to_long_code,
      area_code_geomatch: area_code_geomatch,
      validity_period: validity_period,
      synchronous_validation: synchronous_validation,
      use_inbound_webhook_on_number: use_inbound_webhook_on_number,
  )
end

#urlString



596
597
598
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 596

def url
  @properties['url']
end

#us_app_to_personus_app_to_person

Access the us_app_to_person



719
720
721
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 719

def us_app_to_person
  context.us_app_to_person
end

#us_app_to_person_usecasesus_app_to_person_usecases

Access the us_app_to_person_usecases



726
727
728
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 726

def us_app_to_person_usecases
  context.us_app_to_person_usecases
end

#use_inbound_webhook_on_numberBoolean



608
609
610
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 608

def use_inbound_webhook_on_number
  @properties['use_inbound_webhook_on_number']
end

#validity_periodString



590
591
592
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 590

def validity_period
  @properties['validity_period']
end