class IletiMerkezi::Message

Message

Attributes

phones[R]
text[R]

Public Class Methods

new(phones, text) click to toggle source
# File lib/ileti_merkezi/message.rb, line 8
def initialize(phones, text)
  @phones = Array(phones)
  @text   = text.to_s
end

Public Instance Methods

to_h()
Alias for: to_hash
to_hash() click to toggle source
# File lib/ileti_merkezi/message.rb, line 13
def to_hash
  raise InvalidMessageError, inspect unless valid?

  {
    text: text,
    receipents: { number: phones }
  }
end
Also aliased as: to_h
valid?() click to toggle source
# File lib/ileti_merkezi/message.rb, line 24
def valid?
  phones.any? && !text.empty?
end