Class: MessagePub::Recipient
- Inherits:
-
Object
- Object
- MessagePub::Recipient
- Defined in:
- lib/messagepub/recipient.rb
Overview
Represents a MessagePub recipient. For more info, visit messagepub.com/documentation
Instance Attribute Summary collapse
-
#address ⇒ Object
The address for recipient.
-
#channel ⇒ Object
The communication channel for the recipient.
-
#id ⇒ Object
The unique id for this recipient for that particular notification.
-
#position ⇒ Object
The position of this recipient in the list of recipients for the notification.
-
#status ⇒ Object
The status of this recipient.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Recipient
constructor
A new instance of Recipient.
-
#to_xml ⇒ Object
Returns an XML representation of the recipient.
Constructor Details
#initialize(options = {}) ⇒ Recipient
Returns a new instance of Recipient.
24 25 26 27 28 29 30 |
# File 'lib/messagepub/recipient.rb', line 24 def initialize(={}) @position = [:position] @channel = [:channel] @address = [:address] @id = [:id] @status = [:status] end |
Instance Attribute Details
#address ⇒ Object
The address for recipient. Depending on the channel, this can be a phone number, an email, a username, etc…
16 17 18 |
# File 'lib/messagepub/recipient.rb', line 16 def address @address end |
#channel ⇒ Object
The communication channel for the recipient. It can be one of: sms, phone, email, twitter, aim, gchat
12 13 14 |
# File 'lib/messagepub/recipient.rb', line 12 def channel @channel end |
#id ⇒ Object
The unique id for this recipient for that particular notification.
19 20 21 |
# File 'lib/messagepub/recipient.rb', line 19 def id @id end |
#position ⇒ Object
The position of this recipient in the list of recipients for the notification.
8 9 10 |
# File 'lib/messagepub/recipient.rb', line 8 def position @position end |
#status ⇒ Object
The status of this recipient. Can be one of: sending, scheduled, sent, received, or failed
22 23 24 |
# File 'lib/messagepub/recipient.rb', line 22 def status @status end |
Instance Method Details
#to_xml ⇒ Object
Returns an XML representation of the recipient.
33 34 35 36 37 38 39 40 |
# File 'lib/messagepub/recipient.rb', line 33 def to_xml value = '<recipient>' value += '<position>' + self.position.to_s + '</position>' value += '<channel>' + self.channel + '</channel>' value += '<address>' + self.address + '</address>' value += '</recipient>' value end |