Class: Semaphore::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/semaphore.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.



19
20
21
22
23
24
25
# File 'lib/semaphore.rb', line 19

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:



27
28
29
30
31
32
# File 'lib/semaphore.rb', line 27

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.



13
14
15
# File 'lib/semaphore.rb', line 13

def api_version
  @api_version
end

#request_timeoutObject

Returns the value of attribute request_timeout.



13
14
15
# File 'lib/semaphore.rb', line 13

def request_timeout
  @request_timeout
end

#sender_nameObject

Raises:



34
35
36
37
38
39
# File 'lib/semaphore.rb', line 34

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.



13
14
15
# File 'lib/semaphore.rb', line 13

def uri_base
  @uri_base
end