Class: SmsSafe::Message

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Message

Returns a new instance of Message


17
18
19
# File 'lib/sms_safe/message.rb', line 17

def initialize(attrs)
  attrs.each { |k, v| self.send "#{k.to_s}=".to_sym, v }
end

Instance Attribute Details

#fromString

Returns name or phone number of the author of the message.

Returns:

  • (String)

    name or phone number of the author of the message.


14
15
16
17
18
19
20
# File 'lib/sms_safe/message.rb', line 14

class Message
  attr_accessor :from, :to, :text, :original_message

  def initialize(attrs)
    attrs.each { |k, v| self.send "#{k.to_s}=".to_sym, v }
  end
end

#original_messageString

Returns original message sent by the texter gem, unmapped.

Returns:

  • (String)

    original message sent by the texter gem, unmapped.


14
15
16
17
18
19
20
# File 'lib/sms_safe/message.rb', line 14

class Message
  attr_accessor :from, :to, :text, :original_message

  def initialize(attrs)
    attrs.each { |k, v| self.send "#{k.to_s}=".to_sym, v }
  end
end

#textString

Returns actual message to send.

Returns:

  • (String)

    actual message to send.


14
15
16
17
18
19
20
# File 'lib/sms_safe/message.rb', line 14

class Message
  attr_accessor :from, :to, :text, :original_message

  def initialize(attrs)
    attrs.each { |k, v| self.send "#{k.to_s}=".to_sym, v }
  end
end

#toString

Returns phone number of the recipient of the message.

Returns:

  • (String)

    phone number of the recipient of the message.


14
15
16
17
18
19
20
# File 'lib/sms_safe/message.rb', line 14

class Message
  attr_accessor :from, :to, :text, :original_message

  def initialize(attrs)
    attrs.each { |k, v| self.send "#{k.to_s}=".to_sym, v }
  end
end