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.



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 361

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'status' => payload['status'],
        'sender_id' => payload['sender_id'],
        'configuration' => payload['configuration'],
        'webhook' => payload['webhook'],
        'profile' => payload['profile'],
        'properties' => payload['properties'],
        'offline_reasons' => payload['offline_reasons'],
        'url' => payload['url'],
    }

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

Instance Method Details

#configurationMessagingV2ChannelsSenderConfiguration

Returns:

  • (MessagingV2ChannelsSenderConfiguration)


413
414
415
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 413

def configuration
    @properties['configuration']
end

#contextChannelsSenderContext

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

Returns:



386
387
388
389
390
391
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 386

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

#deleteBoolean

Delete the ChannelsSenderInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



450
451
452
453
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 450

def delete

    context.delete
end

#fetchChannelsSenderInstance

Fetch the ChannelsSenderInstance

Returns:



458
459
460
461
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 458

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



483
484
485
486
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 483

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

#offline_reasonsArray<MessagingV2ChannelsSenderOfflineReasonsItems>

Returns Reasons why the sender is offline., e.g., ["21211400", "message": "Whatsapp business account is banned by provider {provider_name | Credit line is assigned to another BSP", "more_info": "www.twilio.com/docs/errors/21211400"}].

Returns:

  • (Array<MessagingV2ChannelsSenderOfflineReasonsItems>)

    Reasons why the sender is offline., e.g., ["21211400", "message": "Whatsapp business account is banned by provider {provider_name | Credit line is assigned to another BSP", "more_info": "www.twilio.com/docs/errors/21211400"}]



437
438
439
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 437

def offline_reasons
    @properties['offline_reasons']
end

#profileMessagingV2ChannelsSenderProfile

Returns:

  • (MessagingV2ChannelsSenderProfile)


425
426
427
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 425

def profile
    @properties['profile']
end

#propertiesMessagingV2ChannelsSenderProperties

Returns:

  • (MessagingV2ChannelsSenderProperties)


431
432
433
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 431

def properties
    @properties['properties']
end

#sender_idString

Returns The ID of this Sender prefixed with the channel, e.g., ‘whatsapp:E.164`.

Returns:

  • (String)

    The ID of this Sender prefixed with the channel, e.g., ‘whatsapp:E.164`



407
408
409
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 407

def sender_id
    @properties['sender_id']
end

#sidString

Returns A 34 character string that uniquely identifies this Sender.

Returns:

  • (String)

    A 34 character string that uniquely identifies this Sender.



395
396
397
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 395

def sid
    @properties['sid']
end

#statusStatus

Returns:

  • (Status)


401
402
403
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 401

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



476
477
478
479
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 476

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:



467
468
469
470
471
472
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 467

def update(messaging_v2_channels_sender_requests_update: :unset
)

    context.update(
    )
end

#urlString

Returns The URL of this resource, relative to ‘messaging.twilio.com`.

Returns:



443
444
445
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 443

def url
    @properties['url']
end

#webhookMessagingV2ChannelsSenderWebhook

Returns:

  • (MessagingV2ChannelsSenderWebhook)


419
420
421
# File 'lib/twilio-ruby/rest/messaging/v2/channels_sender.rb', line 419

def webhook
    @properties['webhook']
end