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

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/service.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ ServiceInstance

Initialize the ServiceInstance



503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 503

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'] == nil ? payload['validity_period'] : payload['validity_period'].to_i,
        'url' => payload['url'],
        'links' => payload['links'],
        'usecase' => payload['usecase'],
        'us_app_to_person_registered' => payload['us_app_to_person_registered'],
        '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



557
558
559
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 557

def 
    @properties['account_sid']
end

#alpha_sendersalpha_senders

Access the alpha_senders



792
793
794
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 792

def alpha_senders
    context.alpha_senders
end

#area_code_geomatchBoolean



641
642
643
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 641

def area_code_geomatch
    @properties['area_code_geomatch']
end

#channel_senderschannel_senders

Access the channel_senders



806
807
808
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 806

def channel_senders
    context.channel_senders
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



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

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

#date_createdTime



569
570
571
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 569

def date_created
    @properties['date_created']
end

#date_updatedTime



575
576
577
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 575

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance



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

def delete

    context.delete
end

#destination_alpha_sendersdestination_alpha_senders

Access the destination_alpha_senders



799
800
801
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 799

def destination_alpha_senders
    context.destination_alpha_senders
end

#fallback_methodString



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

def fallback_method
    @properties['fallback_method']
end

#fallback_to_long_codeBoolean



635
636
637
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 635

def fallback_to_long_code
    @properties['fallback_to_long_code']
end

#fallback_urlString



593
594
595
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 593

def fallback_url
    @properties['fallback_url']
end

#fetchServiceInstance

Fetch the ServiceInstance



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

def fetch

    context.fetch
end

#friendly_nameString



563
564
565
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 563

def friendly_name
    @properties['friendly_name']
end

#inbound_methodString



587
588
589
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 587

def inbound_method
    @properties['inbound_method']
end

#inbound_request_urlString



581
582
583
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 581

def inbound_request_url
    @properties['inbound_request_url']
end

#inspectObject

Provide a detailed, user friendly representation



819
820
821
822
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 819

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


665
666
667
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 665

def links
    @properties['links']
end

#mms_converterBoolean



617
618
619
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 617

def mms_converter
    @properties['mms_converter']
end

#phone_numbersphone_numbers

Access the phone_numbers



785
786
787
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 785

def phone_numbers
    context.phone_numbers
end

#scan_message_contentScanMessageContent



629
630
631
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 629

def scan_message_content
    @properties['scan_message_content']
end

#short_codesshort_codes

Access the short_codes



771
772
773
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 771

def short_codes
    context.short_codes
end

#sidString



551
552
553
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 551

def sid
    @properties['sid']
end

#smart_encodingBoolean



623
624
625
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 623

def smart_encoding
    @properties['smart_encoding']
end

#status_callbackString



605
606
607
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 605

def status_callback
    @properties['status_callback']
end

#sticky_senderBoolean



611
612
613
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 611

def sticky_sender
    @properties['sticky_sender']
end

#synchronous_validationBoolean



647
648
649
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 647

def synchronous_validation
    @properties['synchronous_validation']
end

#to_sObject

Provide a user friendly representation



812
813
814
815
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 812

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

Update the ServiceInstance



722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 722

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

#urlString



659
660
661
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 659

def url
    @properties['url']
end

#us_app_to_personus_app_to_person

Access the us_app_to_person



778
779
780
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 778

def us_app_to_person
    context.us_app_to_person
end

#us_app_to_person_registeredBoolean



677
678
679
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 677

def us_app_to_person_registered
    @properties['us_app_to_person_registered']
end

#us_app_to_person_usecasesus_app_to_person_usecases

Access the us_app_to_person_usecases



764
765
766
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 764

def us_app_to_person_usecases
    context.us_app_to_person_usecases
end

#use_inbound_webhook_on_numberBoolean



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

def use_inbound_webhook_on_number
    @properties['use_inbound_webhook_on_number']
end

#usecaseString



671
672
673
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 671

def usecase
    @properties['usecase']
end

#validity_periodString



653
654
655
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 653

def validity_period
    @properties['validity_period']
end