Class: IletiMerkezi::Sms
- Inherits:
-
Object
- Object
- IletiMerkezi::Sms
- Includes:
- XmlBuilder
- Defined in:
- lib/ileti_merkezi/actions/sms.rb
Overview
Sms
Constant Summary collapse
- PATH =
'/send-sms'
Constants included from XmlBuilder
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#send_datetime ⇒ Object
readonly
Returns the value of attribute send_datetime.
-
#sender ⇒ Object
readonly
Returns the value of attribute sender.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Sms
constructor
A new instance of Sms.
- #send ⇒ Object
Methods included from XmlBuilder
Constructor Details
#initialize(params = {}) ⇒ Sms
Returns a new instance of Sms.
12 13 14 15 16 |
# File 'lib/ileti_merkezi/actions/sms.rb', line 12 def initialize(params = {}) = (params) @send_datetime = params.fetch(:send_datetime, Time.now.strftime('%d/%m/%Y %H:%M')) @sender = params.fetch(:sender, IletiMerkezi.configuration.sender) end |
Instance Attribute Details
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
8 9 10 |
# File 'lib/ileti_merkezi/actions/sms.rb', line 8 def end |
#send_datetime ⇒ Object (readonly)
Returns the value of attribute send_datetime.
8 9 10 |
# File 'lib/ileti_merkezi/actions/sms.rb', line 8 def send_datetime @send_datetime end |
#sender ⇒ Object (readonly)
Returns the value of attribute sender.
8 9 10 |
# File 'lib/ileti_merkezi/actions/sms.rb', line 8 def sender @sender end |
Instance Method Details
#send ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ileti_merkezi/actions/sms.rb', line 18 def send request = Request.new( path: PATH, payload: hash_to_xml( sender: sender, sendDateTime: send_datetime, message: .map(&:to_h) ) ) request.call end |