Module: Mobitex

Defined in:
lib/mobitex.rb,
lib/mobitex/status.rb,
lib/mobitex/message.rb,
lib/mobitex/version.rb,
lib/mobitex/response.rb,
lib/mobitex/connection.rb,
lib/mobitex/configuration.rb,
lib/mobitex/delivery_errors.rb,
lib/mobitex/message/patterns.rb,
lib/mobitex/connection_errors.rb,
lib/mobitex/message/configuration.rb,
lib/mobitex/delivery/file_delivery.rb,
lib/mobitex/delivery/http_delivery.rb,
lib/mobitex/delivery/test_delivery.rb

Defined Under Namespace

Classes: AccountInactive, BadMessageId, BadNumber, BadType, BlankText, ClientError, Configuration, Connection, ConnectionError, DeliveryCallbackError, DeliveryError, DestinationNetworkUnavailable, EmptyAccount, FileDelivery, HTTPDelivery, Message, NoSender, Redirection, Response, SenderUnauthorized, ServerError, Status, System, TestDelivery, TextTooLong, TimeoutError, TypeNotSupported, UnauthorizedAccess

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.configure(&block) ⇒ Object

Public: Configure global options.

Examples

Mobitex.configure do
  delivery_method :http, {
    :user => 'connectmed',
    :pass => '56asd4Fgi'
  }
end


23
24
25
26
27
28
29
30
31
# File 'lib/mobitex.rb', line 23

def self.configure(&block)
  return unless block_given?

  if block.arity == 1
    yield Configuration.instance
  else
    Configuration.instance.instance_eval &block
  end
end

.deliver(*args, &block) ⇒ Object



37
38
39
40
41
# File 'lib/mobitex.rb', line 37

def self.deliver(*args, &block)
  message = self.new(*args, &block)
  message.deliver
  message
end

.delivery_methodObject



33
34
35
# File 'lib/mobitex.rb', line 33

def self.delivery_method
  Configuration.instance.delivery_method
end

.new(*args, &block) ⇒ Object



8
9
10
# File 'lib/mobitex.rb', line 8

def self.new(*args, &block)
  Mobitex::Message.new(*args, &block)
end

.register_observer(observer) ⇒ Object



43
44
45
46
47
# File 'lib/mobitex.rb', line 43

def self.register_observer(observer)
  unless @@delivery_notification_observers.include?(observer)
    @@delivery_notification_observers << observer
  end
end