Class: Gsm::Outgoing
- Inherits:
-
Object
- Object
- Gsm::Outgoing
- Defined in:
- lib/rubygsm/msg/outgoing.rb
Instance Attribute Summary collapse
-
#device ⇒ Object
readonly
Returns the value of attribute device.
-
#recipient ⇒ Object
Returns the value of attribute recipient.
-
#sent ⇒ Object
readonly
Returns the value of attribute sent.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(device, recipient = nil, text = nil) ⇒ Outgoing
constructor
A new instance of Outgoing.
-
#number ⇒ Object
Returns the recipient of this message, so incoming and outgoing messages can be logged in the same way.
- #send! ⇒ Object
Constructor Details
#initialize(device, recipient = nil, text = nil) ⇒ Outgoing
Returns a new instance of Outgoing.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rubygsm/msg/outgoing.rb', line 9 def initialize(device, recipient=nil, text=nil) # check that the device is #raise ArgumentError, "Invalid device"\ # unless device.respond_to?(:send_sms) # init the instance vars @recipient = recipient @device = device @text = text end |
Instance Attribute Details
#device ⇒ Object (readonly)
Returns the value of attribute device.
7 8 9 |
# File 'lib/rubygsm/msg/outgoing.rb', line 7 def device @device end |
#recipient ⇒ Object
Returns the value of attribute recipient.
6 7 8 |
# File 'lib/rubygsm/msg/outgoing.rb', line 6 def recipient @recipient end |
#sent ⇒ Object (readonly)
Returns the value of attribute sent.
7 8 9 |
# File 'lib/rubygsm/msg/outgoing.rb', line 7 def sent @sent end |
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/rubygsm/msg/outgoing.rb', line 6 def text @text end |
Instance Method Details
#number ⇒ Object
Returns the recipient of this message, so incoming and outgoing messages can be logged in the same way.
33 34 35 |
# File 'lib/rubygsm/msg/outgoing.rb', line 33 def number recipient end |
#send! ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/rubygsm/msg/outgoing.rb', line 21 def send! @device.send_sms(self) @sent = Time.now # once sent, allow no # more modifications freeze end |