Class: SmsAero2::Client
- Inherits:
-
Object
- Object
- SmsAero2::Client
- Defined in:
- lib/sms_aero2.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#login ⇒ Object
Returns the value of attribute login.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #hlr(phone:) ⇒ Object
- #hlr_status(id:) ⇒ Object
-
#initialize(login:, token:, logger: nil) ⇒ Client
constructor
A new instance of Client.
-
#send_sms(to:, from:, text:, channel:, **options) ⇒ Object
channel values: ‘info’ Info signature for all operators ‘digital’ Digital channel sending (only permitted transaction flow) ‘international’ International delivery (Operators of Russia, Kazakhstan, Ukraine and Belarus) ‘direct’ Advertising channel send message free letter signature.
Constructor Details
#initialize(login:, token:, logger: nil) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 |
# File 'lib/sms_aero2.rb', line 14 def initialize(login:, token:, logger: nil) @login = login @token = token @logger = logger end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
12 13 14 |
# File 'lib/sms_aero2.rb', line 12 def logger @logger end |
#login ⇒ Object
Returns the value of attribute login.
12 13 14 |
# File 'lib/sms_aero2.rb', line 12 def login @login end |
#token ⇒ Object
Returns the value of attribute token.
12 13 14 |
# File 'lib/sms_aero2.rb', line 12 def token @token end |
Instance Method Details
#hlr(phone:) ⇒ Object
43 44 45 |
# File 'lib/sms_aero2.rb', line 43 def hlr(phone:) SmsAero2::HlrOperation.new(request, 'hlr/check', number: phone).call end |
#hlr_status(id:) ⇒ Object
39 40 41 |
# File 'lib/sms_aero2.rb', line 39 def hlr_status(id:) SmsAero2::HlrOperation.new(request, 'hlr/status', id: id).call end |
#send_sms(to:, from:, text:, channel:, **options) ⇒ Object
channel values: ‘info’ Info signature for all operators ‘digital’ Digital channel sending (only permitted transaction flow) ‘international’ International delivery (Operators of Russia, Kazakhstan, Ukraine and Belarus) ‘direct’ Advertising channel send message free letter signature. ‘service’ Service channel for sending service SMS according to the approved template with a paid signature of the sender.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/sms_aero2.rb', line 27 def send_sms(to:, from:, text:, channel:, **) path = [:testsend] ? 'sms/testsend' : 'sms/send' if %w[info digital international direct service].include?(channel.to_s) SmsAero2::Operation.new( request, path, number: to, sign: from, text: text, channel: channel.upcase, ** ).call else raise ArgumentError, "invalid channel value, see documentation" end end |