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
#initialize(conf = nil) ⇒ Easy
Returns a new instance of Easy.
364 365 366 |
# File 'lib/aspsms.rb', line 364 def initialize(conf = nil) @cfg = ASPSMS::Config.new(conf) end |
Instance Method Details
#check_originator_authorization(opts = {}) ⇒ Object
404 405 406 407 408 409 410 |
# File 'lib/aspsms.rb', line 404 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
387 388 389 390 391 392 393 |
# File 'lib/aspsms.rb', line 387 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
375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/aspsms.rb', line 375 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
368 369 370 371 372 373 |
# File 'lib/aspsms.rb', line 368 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
395 396 397 398 399 400 401 402 |
# File 'lib/aspsms.rb', line 395 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 |