Class: IletiMerkezi::Sms
- Inherits:
-
Object
- Object
- IletiMerkezi::Sms
- Defined in:
- lib/ileti_merkezi/sms.rb
Overview
Sms
Constant Summary collapse
- PATH =
'/send-sms'.freeze
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#sender ⇒ Object
readonly
Returns the value of attribute sender.
Instance Method Summary collapse
-
#initialize(args) ⇒ Sms
constructor
A new instance of Sms.
- #messages ⇒ Object
- #send ⇒ Object
- #send_datetime ⇒ Object
Constructor Details
#initialize(args) ⇒ Sms
10 11 12 13 |
# File 'lib/ileti_merkezi/sms.rb', line 10 def initialize(args) @args = args @sender = args[:sender] || IletiMerkezi.configuration.sender end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
6 7 8 |
# File 'lib/ileti_merkezi/sms.rb', line 6 def args @args end |
#sender ⇒ Object (readonly)
Returns the value of attribute sender.
6 7 8 |
# File 'lib/ileti_merkezi/sms.rb', line 6 def sender @sender end |
Instance Method Details
#messages ⇒ Object
15 16 17 18 |
# File 'lib/ileti_merkezi/sms.rb', line 15 def = args.fetch(:messages, [args]) .map { |msg| Message.new(msg[:phones], msg[:text]) } end |
#send ⇒ Object
24 25 26 27 |
# File 'lib/ileti_merkezi/sms.rb', line 24 def send request = Request.new(content: content, path: PATH) request.call end |
#send_datetime ⇒ Object
20 21 22 |
# File 'lib/ileti_merkezi/sms.rb', line 20 def send_datetime args.fetch(:send_datetime, Time.now.strftime('%d/%m/%Y %H:%M')) end |