Class: Zenvia::Sms

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/zenvia/sms.rb

Constant Summary

Constants included from Base

Base::SEND_SMS, Base::ZENVIA_URL_BASE

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id_sms, msg, cel_phone, schedule_date = "", aggregateId = "") ⇒ Sms

Returns a new instance of Sms.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/zenvia/sms.rb', line 7

def initialize(id_sms, msg, cel_phone, schedule_date = "", aggregateId = "")
  @id_sms    = id_sms
  @msg       = msg
  @cel_phone = cel_phone
  @aggregateId = aggregateId
  @schedule_date = schedule_date
  #Try to convert datetime to string
  begin
    @schedule_date = schedule_date.strftime("%Y-%m-%dT%H:%M:%S") if !schedule_date.blank?
  rescue
  end
end

Instance Attribute Details

#aggregateIdObject

Returns the value of attribute aggregateId.



5
6
7
# File 'lib/zenvia/sms.rb', line 5

def aggregateId
  @aggregateId
end

#cel_phoneObject

Returns the value of attribute cel_phone.



5
6
7
# File 'lib/zenvia/sms.rb', line 5

def cel_phone
  @cel_phone
end

#id_smsObject

Returns the value of attribute id_sms.



5
6
7
# File 'lib/zenvia/sms.rb', line 5

def id_sms
  @id_sms
end

#msgObject

Returns the value of attribute msg.



5
6
7
# File 'lib/zenvia/sms.rb', line 5

def msg
  @msg
end

#schedule_dateObject

Returns the value of attribute schedule_date.



5
6
7
# File 'lib/zenvia/sms.rb', line 5

def schedule_date
  @schedule_date
end

Instance Method Details

#sendObject



20
21
22
# File 'lib/zenvia/sms.rb', line 20

def send
  send_to_zenvia(@id_sms, @cel_phone, @msg, @schedule_date, @aggregateId)
end