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.
-
#media_url ⇒ Object
Returns the value of attribute media_url.
-
#messaging_service_sid ⇒ Object
Returns the value of attribute messaging_service_sid.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #deliver ⇒ Object
-
#initialize(to:, body:, gateway:, from: nil, messaging_service_sid: nil, media_url: nil) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(to:, body:, gateway:, from: nil, messaging_service_sid: nil, media_url: nil) ⇒ Message
Returns a new instance of Message.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/minitext/message.rb', line 5 def initialize(to:, body:, gateway:, from: nil, messaging_service_sid: nil, media_url: nil) if from.nil? && messaging_service_sid.nil? raise ArgumentError.new("must supply either the 'from' or 'messaging_service_sid' argument") end @gateway = gateway @messaging_service_sid = messaging_service_sid @from = from @to = to @body = body 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 |
#media_url ⇒ Object
Returns the value of attribute media_url.
3 4 5 |
# File 'lib/minitext/message.rb', line 3 def media_url @media_url end |
#messaging_service_sid ⇒ Object
Returns the value of attribute messaging_service_sid.
3 4 5 |
# File 'lib/minitext/message.rb', line 3 def messaging_service_sid @messaging_service_sid 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
17 18 19 |
# File 'lib/minitext/message.rb', line 17 def deliver gateway.deliver(self) end |