Class: Minitext::Message
- Inherits:
-
Object
- Object
- Minitext::Message
- Defined in:
- lib/minitext/message.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#from ⇒ Object
Returns the value of attribute from.
-
#gateway ⇒ Object
Returns the value of attribute gateway.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #deliver ⇒ Object
- #deliver! ⇒ Object
-
#initialize(params) ⇒ Message
constructor
A new instance of Message.
- #valid? ⇒ Boolean
Constructor Details
#initialize(params) ⇒ Message
Returns a new instance of Message.
5 6 7 8 9 |
# File 'lib/minitext/message.rb', line 5 def initialize(params) params.each do |attr, value| self.public_send("#{attr}=", value) end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/minitext/message.rb', line 3 def body @body end |
#from ⇒ Object
Returns the value of attribute from.
3 4 5 |
# File 'lib/minitext/message.rb', line 3 def from @from end |
#gateway ⇒ Object
Returns the value of attribute gateway.
3 4 5 |
# File 'lib/minitext/message.rb', line 3 def gateway @gateway end |
#to ⇒ Object
Returns the value of attribute to.
3 4 5 |
# File 'lib/minitext/message.rb', line 3 def to @to end |
Instance Method Details
#deliver ⇒ Object
15 16 17 18 |
# File 'lib/minitext/message.rb', line 15 def deliver return false unless valid? !!gateway.deliver(self) end |
#deliver! ⇒ Object
11 12 13 |
# File 'lib/minitext/message.rb', line 11 def deliver! deliver || raise_errors end |
#valid? ⇒ Boolean
20 21 22 |
# File 'lib/minitext/message.rb', line 20 def valid? valid_param?(from) && valid_param?(to) && valid_param?(body) && !gateway.nil? end |