Class: SmsGateway::Sms

Inherits:
Struct
  • Object
show all
Defined in:
lib/sms_gateway/sms.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Sms

Returns a new instance of Sms.



5
6
7
8
9
10
# File 'lib/sms_gateway/sms.rb', line 5

def initialize(params)
  self.from = params[:from]||SmsGateway::Base.from
  self.to = params[:to]
  self.text = params[:text]
  self.route = params[:route]
end

Instance Attribute Details

#fromObject

Returns the value of attribute from

Returns:

  • (Object)

    the current value of from



3
4
5
# File 'lib/sms_gateway/sms.rb', line 3

def from
  @from
end

#routeObject

Returns the value of attribute route

Returns:

  • (Object)

    the current value of route



3
4
5
# File 'lib/sms_gateway/sms.rb', line 3

def route
  @route
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



3
4
5
# File 'lib/sms_gateway/sms.rb', line 3

def text
  @text
end

#toObject

Returns the value of attribute to

Returns:

  • (Object)

    the current value of to



3
4
5
# File 'lib/sms_gateway/sms.rb', line 3

def to
  @to
end

Instance Method Details

#deliverObject



12
13
14
# File 'lib/sms_gateway/sms.rb', line 12

def deliver
  SmsGateway::Base.deliver(self)
end

#to_sObject



16
17
18
# File 'lib/sms_gateway/sms.rb', line 16

def to_s
  "SMS: from:#{self.from}, to:#{self.to}, text:#{self.text}"
end