Class: Twi::Delivery

Inherits:
Resource show all
Defined in:
lib/twi/delivery.rb

Overview

The representation of a direct message delivery notification.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Twi::Resource

Class Method Details

.params_for(id:, status:, code: nil) ⇒ Hash

Returns the shape of the payload send by Twilio to the callback URL.

Returns:

  • (Hash)

    the shape of the payload send by Twilio to the callback URL.



16
17
18
# File 'lib/twi/delivery.rb', line 16

def self.params_for(id:, status:, code: nil)
  { SmsSid: id, MessageStatus: status, ErrorCode: code }
end

Instance Method Details

#codeString?

Returns error code.

Returns:

  • (String, nil)

    error code



13
# File 'lib/twi/delivery.rb', line 13

def code = @params['ErrorCode']

#idString

Returns unique identifier.

Returns:

  • (String)

    unique identifier



6
# File 'lib/twi/delivery.rb', line 6

def id = @params['SmsSid']

#statusString

delivery_unknown, delivered, undelivered, failed # TODO: make an enum

Returns:

  • (String)

    delivery status, one of accepted, scheduled, queued, sending, sent,



10
# File 'lib/twi/delivery.rb', line 10

def status = @params['MessageStatus']