Class: SmsSafe::Message
- Inherits:
-
Object
- Object
- SmsSafe::Message
- Defined in:
- lib/sms_safe/message.rb
Overview
Different texter gems will have different classes for their messages. This is a common class that acts as an impedance adapter. Most of our methods use this class
Instance Attribute Summary collapse
-
#from ⇒ String
Name or phone number of the author of the message.
-
#original_message ⇒ String
Original message sent by the texter gem, unmapped.
-
#text ⇒ String
Actual message to send.
-
#to ⇒ String
Phone number of the recipient of the message.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Message
constructor
Set all params as internal values.
Constructor Details
#initialize(attrs) ⇒ Message
Set all params as internal values.
19 20 21 |
# File 'lib/sms_safe/message.rb', line 19 def initialize(attrs) attrs.each { |k, v| self.send "#{k.to_s}=".to_sym, v } end |
Instance Attribute Details
#from ⇒ String
Returns name or phone number of the author of the message.
14 15 16 17 18 19 20 21 22 |
# File 'lib/sms_safe/message.rb', line 14 class Message attr_accessor :from, :to, :text, :original_message # Set all params as internal values. # @param [Hash] attrs accepts :from, :to, :text and :original_message def initialize(attrs) attrs.each { |k, v| self.send "#{k.to_s}=".to_sym, v } end end |
#original_message ⇒ String
Returns original message sent by the texter gem, unmapped.
14 15 16 17 18 19 20 21 22 |
# File 'lib/sms_safe/message.rb', line 14 class Message attr_accessor :from, :to, :text, :original_message # Set all params as internal values. # @param [Hash] attrs accepts :from, :to, :text and :original_message def initialize(attrs) attrs.each { |k, v| self.send "#{k.to_s}=".to_sym, v } end end |
#text ⇒ String
Returns actual message to send.
14 15 16 17 18 19 20 21 22 |
# File 'lib/sms_safe/message.rb', line 14 class Message attr_accessor :from, :to, :text, :original_message # Set all params as internal values. # @param [Hash] attrs accepts :from, :to, :text and :original_message def initialize(attrs) attrs.each { |k, v| self.send "#{k.to_s}=".to_sym, v } end end |
#to ⇒ String
Returns phone number of the recipient of the message.
14 15 16 17 18 19 20 21 22 |
# File 'lib/sms_safe/message.rb', line 14 class Message attr_accessor :from, :to, :text, :original_message # Set all params as internal values. # @param [Hash] attrs accepts :from, :to, :text and :original_message def initialize(attrs) attrs.each { |k, v| self.send "#{k.to_s}=".to_sym, v } end end |