Class: Twilio::REST::Messaging::V2::ChannelsSenderInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the ChannelsSenderInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • account_sid (String) —

    The SID of the Account that created this ChannelsSender resource.

  • sid (String) (defaults to: nil) —

    The SID of the Call resource to fetch.



889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 889

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'status' => payload['status'],
        'sender_id' => payload['sender_id'],
        'friendly_name' => payload['friendly_name'],
        'configuration' => payload['configuration'],
        'webhook' => payload['webhook'],
        'profile' => payload['profile'],
        'pending_display_name' => payload['pending_display_name'],
        'pending_display_name_status' => payload['pending_display_name_status'],
        'pending_display_name_status_date' => Twilio.deserialize_iso8601_datetime(payload['pending_display_name_status_date']),
        'properties' => payload['properties'],
        'offline_reasons' => payload['offline_reasons'],
        'compliance' => payload['compliance'],
        'url' => payload['url'],
        'display_name_status' => payload['display_name_status'],
    }

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

Instance Method Details

#compliance ⇒ MessagingV2RcsComplianceResponse

Returns:

  • (MessagingV2RcsComplianceResponse)


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

def compliance
    @properties['compliance']
end

#configuration ⇒ MessagingV2ChannelsSenderConfiguration

Returns:

  • (MessagingV2ChannelsSenderConfiguration)


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

def configuration
    @properties['configuration']
end

#context ⇒ ChannelsSenderContext

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

Returns:



921
922
923
924
925
926
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 921

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

#delete ⇒ Boolean

Delete the ChannelsSenderInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#display_name_status ⇒ String

Returns WhatsApp only. The outcome of the display name operation in this request. Present only when the request included profile.name. updating — accepted; either submitted to Meta for review, or, when Meta had already approved this exact name, routed straight to re-registration. no_change — the name already matches the sender's active display name; nothing was submitted to Meta. pending_review — the same name is already under review at Meta; the existing request continues unchanged. error — the display name could not be processed, while other profile fields in the same request were still applied. Returned with a 202 and carries no error code or message. This covers every failure mode, including the case where Meta accepted the name but tracking could not be started — poll pending_display_name_status to establish the real state rather than assuming the name was rejected. When profile.name is the only field in the request, the failure is returned as an error response with a specific code instead of this status.

Returns:

  • (String) —

    WhatsApp only. The outcome of the display name operation in this request. Present only when the request included profile.name. updating — accepted; either submitted to Meta for review, or, when Meta had already approved this exact name, routed straight to re-registration. no_change — the name already matches the sender's active display name; nothing was submitted to Meta. pending_review — the same name is already under review at Meta; the existing request continues unchanged. error — the display name could not be processed, while other profile fields in the same request were still applied. Returned with a 202 and carries no error code or message. This covers every failure mode, including the case where Meta accepted the name but tracking could not be started — poll pending_display_name_status to establish the real state rather than assuming the name was rejected. When profile.name is the only field in the request, the failure is returned as an error response with a specific code instead of this status.



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

def display_name_status
    @properties['display_name_status']
end

#fetch ⇒ ChannelsSenderInstance

Fetch the ChannelsSenderInstance

Returns:



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

def fetch

    context.fetch
end

#friendly_name ⇒ String

Returns Optional display label for the sender in the Twilio Console.

Returns:

  • (String) —

    Optional display label for the sender in the Twilio Console.



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

def friendly_name
    @properties['friendly_name']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



1055
1056
1057
1058
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 1055

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

#offline_reasons ⇒ Array<MessagingV2ChannelsSenderOfflineReasonsItems>

Returns The reasons why the sender is offline.

Returns:

  • (Array<MessagingV2ChannelsSenderOfflineReasonsItems>) —

    The reasons why the sender is offline.



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

def offline_reasons
    @properties['offline_reasons']
end

#pending_display_name ⇒ String

Returns WhatsApp only. The display name the most recent change applies to — awaiting Meta review, approved by Meta and awaiting re-registration, or, once pending_display_name_status is COMPLETED, the name now in effect (identical to name). Absent when no display name change has been made, and once a completed change stops being reported.

Returns:

  • (String) —

    WhatsApp only. The display name the most recent change applies to — awaiting Meta review, approved by Meta and awaiting re-registration, or, once pending_display_name_status is COMPLETED, the name now in effect (identical to name). Absent when no display name change has been made, and once a completed change stops being reported.



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

def pending_display_name
    @properties['pending_display_name']
end

#pending_display_name_status ⇒ String

Returns WhatsApp only. The status of the most recent display name change. PENDING_REVIEW, APPROVED and DECLINED are reported by Meta. PIN_MISMATCH and REGISTRATION_FAILED mean Meta approved the name but it could not be applied; EXPIRED means Meta's 14-day window to apply an approved name elapsed. In all three cases, re-submit the same profile.name to retry. COMPLETED means the name was approved and applied — name now returns it. A COMPLETED change is reported for 14 days after it completes and is absent afterwards, so treat its presence as "recently completed" rather than a permanent flag; use pending_display_name_status_date to tell how recent. Absent when no display name change has been made.

Returns:

  • (String) —

    WhatsApp only. The status of the most recent display name change. PENDING_REVIEW, APPROVED and DECLINED are reported by Meta. PIN_MISMATCH and REGISTRATION_FAILED mean Meta approved the name but it could not be applied; EXPIRED means Meta's 14-day window to apply an approved name elapsed. In all three cases, re-submit the same profile.name to retry. COMPLETED means the name was approved and applied — name now returns it. A COMPLETED change is reported for 14 days after it completes and is absent afterwards, so treat its presence as "recently completed" rather than a permanent flag; use pending_display_name_status_date to tell how recent. Absent when no display name change has been made.



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

def pending_display_name_status
    @properties['pending_display_name_status']
end

#pending_display_name_status_date ⇒ Time

Returns WhatsApp only. The date and time in UTC when pending_display_name_status last changed, specified in ISO 8601 format. Absent whenever pending_display_name_status is absent, so the three pending_display_name* fields are always present or absent together.

Returns:

  • (Time) —

    WhatsApp only. The date and time in UTC when pending_display_name_status last changed, specified in ISO 8601 format. Absent whenever pending_display_name_status is absent, so the three pending_display_name* fields are always present or absent together.



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

def pending_display_name_status_date
    @properties['pending_display_name_status_date']
end

#profile ⇒ MessagingV2ChannelsSenderProfileGenericResponse

Returns:

  • (MessagingV2ChannelsSenderProfileGenericResponse)


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

def profile
    @properties['profile']
end

#properties ⇒ MessagingV2ChannelsSenderProperties

Returns:

  • (MessagingV2ChannelsSenderProperties)


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

def properties
    @properties['properties']
end

#sender_id ⇒ String

Returns The ID of the sender in whatsapp:<E.164_PHONE_NUMBER> format.

Returns:

  • (String) —

    The ID of the sender in whatsapp:<E.164_PHONE_NUMBER> format.



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

def sender_id
    @properties['sender_id']
end

#sid ⇒ String

Returns The SID of the sender.

Returns:

  • (String) —

    The SID of the sender.



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

def sid
    @properties['sid']
end

#status ⇒ Status

Returns:

  • (Status)


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

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



1048
1049
1050
1051
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 1048

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

#update(messaging_v2_channels_sender_requests_update: :unset) ⇒ ChannelsSenderInstance

Update the ChannelsSenderInstance

Parameters:

  • messaging_v2_channels_sender_requests_update (MessagingV2ChannelsSenderRequestsUpdate) (defaults to: :unset)

Returns:



1038
1039
1040
1041
1042
1043
1044
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 1038

def update(messaging_v2_channels_sender_requests_update: :unset
)

    context.update(
        messaging_v2_channels_sender_requests_update: messaging_v2_channels_sender_requests_update, 
    )
end

#url ⇒ String

Returns The URL of the resource.

Returns:

  • (String) —

    The URL of the resource.



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

def url
    @properties['url']
end

#webhook ⇒ MessagingV2ChannelsSenderWebhook

Returns:

  • (MessagingV2ChannelsSenderWebhook)


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

def webhook
    @properties['webhook']
end