Module: Clxsms::Configuration

Included in:
Clxsms
Defined in:
lib/clxsms/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
    :username,
    :password,
    :ssl_enabled,
    :user_agent,
    :dlr_url,
    :dlr_mask,
    :from
].freeze
SSL_ENABLED =
false
DEFAULT_USERNAME =
nil
DEFAULT_PASSWORD =
nil
HTTPS_HOST =
"https://sms1.clxnetworks.net:3801"
HTTP_HOST =
"http://sms1.clxnetworks.net:3800"
DEFAULT_USER_AGENT =
"Clxsms Ruby Client/#{Clxsms::VERSION}".freeze
DEFAULT_DLR_URL =
"http://localhost/"
DEFAULT_DLR_MASK =
7
DEFAULT_FROM =
"0"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#http_hostObject (readonly)

Returns the value of attribute http_host.



36
37
38
# File 'lib/clxsms/configuration.rb', line 36

def http_host
  @http_host
end

#https_hostObject (readonly)

Returns the value of attribute https_host.



36
37
38
# File 'lib/clxsms/configuration.rb', line 36

def https_host
  @https_host
end

Class Method Details

.extended(base) ⇒ Object



38
39
40
# File 'lib/clxsms/configuration.rb', line 38

def self.extended(base)
  base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



42
43
44
# File 'lib/clxsms/configuration.rb', line 42

def configure
  yield self
end

#optionsObject



46
47
48
49
50
# File 'lib/clxsms/configuration.rb', line 46

def options
  options = {}
  VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }
  options
end

#resetObject

Reset to defaults



61
62
63
64
65
66
67
68
69
70
# File 'lib/clxsms/configuration.rb', line 61

def reset
  self.username = DEFAULT_USERNAME
  self.password = DEFAULT_PASSWORD
  self.ssl_enabled = SSL_ENABLED
  self.user_agent = DEFAULT_USER_AGENT
  self.dlr_url = DEFAULT_DLR_URL
  self.dlr_mask = DEFAULT_DLR_MASK
  self.from = DEFAULT_FROM
  self
end