Class: SemaphoreSMS::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/semaphore_sms.rb

Constant Summary collapse

DEFAULT_API_VERSION =
'v4'.freeze
DEFAULT_URI_BASE =
'https://api.semaphore.co/api/'.freeze
DEFAULT_REQUEST_TIMEOUT =
120

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



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

def initialize
  @api_key = nil
  @api_version = DEFAULT_API_VERSION
  @sender_name = nil
  @uri_base = DEFAULT_URI_BASE
  @request_timeout = DEFAULT_REQUEST_TIMEOUT
end

Instance Attribute Details

#api_keyObject

Raises:



31
32
33
34
35
36
# File 'lib/semaphore_sms.rb', line 31

def api_key
  return @api_key if @api_key

  error_text = 'Semaphore access token missing! See https://semaphore.co/docs'
  raise ConfigurationError, error_text
end

#api_versionObject

Returns the value of attribute api_version.



17
18
19
# File 'lib/semaphore_sms.rb', line 17

def api_version
  @api_version
end

#request_timeoutObject

Returns the value of attribute request_timeout.



17
18
19
# File 'lib/semaphore_sms.rb', line 17

def request_timeout
  @request_timeout
end

#sender_nameObject

Raises:



38
39
40
41
42
43
# File 'lib/semaphore_sms.rb', line 38

def sender_name
  return @sender_name if @sender_name

  error_text = 'Semaphore sender name missing! See https://semaphore.co/docs'
  raise ConfigurationError, error_text
end

#uri_baseObject

Returns the value of attribute uri_base.



17
18
19
# File 'lib/semaphore_sms.rb', line 17

def uri_base
  @uri_base
end