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



833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 833

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



888
889
890
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 888

def 
    @properties['account_sid']
end

#alpha_sendersalpha_senders

Access the alpha_senders



1123
1124
1125
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1123

def alpha_senders
    context.alpha_senders
end

#area_code_geomatchBoolean



972
973
974
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 972

def area_code_geomatch
    @properties['area_code_geomatch']
end

#channel_senderschannel_senders

Access the channel_senders



1137
1138
1139
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1137

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



873
874
875
876
877
878
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 873

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

#date_createdTime



900
901
902
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 900

def date_created
    @properties['date_created']
end

#date_updatedTime



906
907
908
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 906

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance



1021
1022
1023
1024
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1021

def delete

    context.delete
end

#destination_alpha_sendersdestination_alpha_senders

Access the destination_alpha_senders



1130
1131
1132
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1130

def destination_alpha_senders
    context.destination_alpha_senders
end

#fallback_methodString



930
931
932
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 930

def fallback_method
    @properties['fallback_method']
end

#fallback_to_long_codeBoolean



966
967
968
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 966

def fallback_to_long_code
    @properties['fallback_to_long_code']
end

#fallback_urlString



924
925
926
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 924

def fallback_url
    @properties['fallback_url']
end

#fetchServiceInstance

Fetch the ServiceInstance



1029
1030
1031
1032
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1029

def fetch

    context.fetch
end

#friendly_nameString



894
895
896
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 894

def friendly_name
    @properties['friendly_name']
end

#inbound_methodString



918
919
920
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 918

def inbound_method
    @properties['inbound_method']
end

#inbound_request_urlString



912
913
914
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 912

def inbound_request_url
    @properties['inbound_request_url']
end

#inspectObject

Provide a detailed, user friendly representation



1150
1151
1152
1153
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1150

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


996
997
998
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 996

def links
    @properties['links']
end

#mms_converterBoolean



948
949
950
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 948

def mms_converter
    @properties['mms_converter']
end

#phone_numbersphone_numbers

Access the phone_numbers



1116
1117
1118
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1116

def phone_numbers
    context.phone_numbers
end

#scan_message_contentScanMessageContent



960
961
962
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 960

def scan_message_content
    @properties['scan_message_content']
end

#short_codesshort_codes

Access the short_codes



1102
1103
1104
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1102

def short_codes
    context.short_codes
end

#sidString



882
883
884
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 882

def sid
    @properties['sid']
end

#smart_encodingBoolean



954
955
956
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 954

def smart_encoding
    @properties['smart_encoding']
end

#status_callbackString



936
937
938
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 936

def status_callback
    @properties['status_callback']
end

#sticky_senderBoolean



942
943
944
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 942

def sticky_sender
    @properties['sticky_sender']
end

#synchronous_validationBoolean



978
979
980
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 978

def synchronous_validation
    @properties['synchronous_validation']
end

#to_sObject

Provide a user friendly representation



1143
1144
1145
1146
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1143

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



1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1053

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



990
991
992
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 990

def url
    @properties['url']
end

#us_app_to_personus_app_to_person

Access the us_app_to_person



1109
1110
1111
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1109

def us_app_to_person
    context.us_app_to_person
end

#us_app_to_person_registeredBoolean



1008
1009
1010
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1008

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



1095
1096
1097
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1095

def us_app_to_person_usecases
    context.us_app_to_person_usecases
end

#use_inbound_webhook_on_numberBoolean



1014
1015
1016
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1014

def use_inbound_webhook_on_number
    @properties['use_inbound_webhook_on_number']
end

#usecaseString



1002
1003
1004
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 1002

def usecase
    @properties['usecase']
end

#validity_periodString



984
985
986
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 984

def validity_period
    @properties['validity_period']
end