Class: EventMachine::Kannel::Configuration

Inherits:
Object
  • Object
show all
Includes:
Validations
Defined in:
lib/em-kannel/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validations

#friendly_name, included, #validate!

Constructor Details

#initialize(attributes = {}) ⇒ Configuration

Returns a new instance of Configuration.



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/em-kannel/configuration.rb', line 18

def initialize(attributes={})
  attributes = attributes.with_indifferent_access

  self.username         = attributes[:username]
  self.password         = attributes[:password]
  self.url              = attributes[:url]
  self.dlr_callback_url = attributes[:dlr_callback_url]
  self.dlr_mask         = attributes[:dlr_mask]
  self.verify_ssl_peer  = attributes[:verify_ssl_peer]
  self.smsc             = attributes[:smsc]
end

Instance Attribute Details

#dlr_callback_urlObject

Returns the value of attribute dlr_callback_url.



6
7
8
# File 'lib/em-kannel/configuration.rb', line 6

def dlr_callback_url
  @dlr_callback_url
end

#dlr_maskObject

Returns the value of attribute dlr_mask.



6
7
8
# File 'lib/em-kannel/configuration.rb', line 6

def dlr_mask
  @dlr_mask
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/em-kannel/configuration.rb', line 6

def password
  @password
end

#smscObject

Returns the value of attribute smsc.



6
7
8
# File 'lib/em-kannel/configuration.rb', line 6

def smsc
  @smsc
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/em-kannel/configuration.rb', line 6

def url
  @url
end

#usernameObject

Returns the value of attribute username.



6
7
8
# File 'lib/em-kannel/configuration.rb', line 6

def username
  @username
end

#verify_ssl_peerObject

Returns the value of attribute verify_ssl_peer.



6
7
8
# File 'lib/em-kannel/configuration.rb', line 6

def verify_ssl_peer
  @verify_ssl_peer
end

Instance Method Details

#as_queryObject



30
31
32
33
34
35
36
# File 'lib/em-kannel/configuration.rb', line 30

def as_query
  query = { username: username, password: password }
  query[:"dlr-mask"] = dlr_mask if dlr_mask
  query[:"dlr-url"]  = dlr_callback_url if dlr_callback_url
  query[:smsc]       = smsc if smsc
  query
end