Class: SmsKit::Provider

Inherits:
Object
  • Object
show all
Includes:
Config, HTTP
Defined in:
lib/sms_kit/provider.rb

Direct Known Subclasses

CentralICT, MobiWeb, Mobimex, SmsTrade

Constant Summary

Constants included from HTTP

HTTP::USER_AGENT

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HTTP

#connection, #get, #post, #uri

Methods included from Config

included

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Provider

Returns a new instance of Provider.

Yields:

  • (_self)

Yield Parameters:



16
17
18
19
# File 'lib/sms_kit/provider.rb', line 16

def initialize options = {}, &block
  @data = options
  yield self if block_given?
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



9
10
11
# File 'lib/sms_kit/provider.rb', line 9

def data
  @data
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



9
10
11
# File 'lib/sms_kit/provider.rb', line 9

def error_code
  @error_code
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



9
10
11
# File 'lib/sms_kit/provider.rb', line 9

def error_message
  @error_message
end

Class Method Details

.deliver(options = {}, &block) ⇒ Object



11
12
13
14
# File 'lib/sms_kit/provider.rb', line 11

def self.deliver options = {}, &block
  options = options.to_sms if options.respond_to? :to_sms
  new(options, &block).deliver
end

Instance Method Details

#deliver(options = {}) ⇒ Object



21
22
23
# File 'lib/sms_kit/provider.rb', line 21

def deliver options = {}
  raise "#{self.class.name} needs to implement #deliver"
end