Class: ASPSMS::Easy
- Inherits:
-
Object
- Object
- ASPSMS::Easy
- Defined in:
- lib/aspsms.rb
Overview
Easy straightforward API class; for most use cases, this should be all that is needed.
Instance Method Summary collapse
- #check_originator_authorization(opts = {}) ⇒ Object
-
#initialize(conf = nil) ⇒ Easy
constructor
A new instance of Easy.
- #send_originator_unlock_code(opts = {}) ⇒ Object
- #send_text_sms(text, recipients, opts = {}) ⇒ Object
- #show_credits ⇒ Object
- #unlock_originator(code, opts = {}) ⇒ Object
Constructor Details
Instance Method Details
#check_originator_authorization(opts = {}) ⇒ Object
401 402 403 404 405 406 407 |
# File 'lib/aspsms.rb', line 401 def (opts = {}) request = ASPSMS::Request::CheckOriginatorAuthorization.new(@cfg) request.originator = opts[:originator] if opts.has_key?(:originator) response = ASPSMS::Gateway.send(@cfg, request) raise 'Error status from server!' unless response.success? response. end |
#send_originator_unlock_code(opts = {}) ⇒ Object
384 385 386 387 388 389 390 |
# File 'lib/aspsms.rb', line 384 def send_originator_unlock_code(opts = {}) request = ASPSMS::Request::SendOriginatorUnlockCode.new(@cfg) request.originator = opts[:originator] if opts.has_key?(:originator) response = ASPSMS::Gateway.send(@cfg, request) raise 'Error status from server!' unless response.success? response end |
#send_text_sms(text, recipients, opts = {}) ⇒ Object
372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/aspsms.rb', line 372 def send_text_sms(text, recipients, opts = {}) request = ASPSMS::Request::SendTextSMS.new(@cfg) request.text = text request.recipients = recipients request.originator = opts[:originator] if opts.has_key?(:originator) request.flashing = opts[:flashing] if opts.has_key?(:flashing) request.blinking = opts[:blinking] if opts.has_key?(:blinking) response = ASPSMS::Gateway.send(@cfg, request) raise 'Error status from server!' unless response.success? response.credits_used end |
#show_credits ⇒ Object
365 366 367 368 369 370 |
# File 'lib/aspsms.rb', line 365 def show_credits request = ASPSMS::Request::ShowCredits.new(@cfg) response = ASPSMS::Gateway.send(@cfg, request) raise 'Error status from server!' unless response.success? response.credits end |
#unlock_originator(code, opts = {}) ⇒ Object
392 393 394 395 396 397 398 399 |
# File 'lib/aspsms.rb', line 392 def unlock_originator(code, opts = {}) request = ASPSMS::Request::UnlockOriginator.new(@cfg) request.code = code request.originator = opts[:originator] if opts.has_key?(:originator) response = ASPSMS::Gateway.send(@cfg, request) raise 'Error status from server!' unless response.success? response end |