Module: ISMS::Configuration

Included in:
ISMS
Defined in:
lib/isms/configuration.rb

Constant Summary collapse

DEFAULT_PROTOCOL =
'http'
DEFAULT_ENDPOINT =
'www.isms.com.my'
DEFAULT_USERNAME =
nil
DEFAULT_PASSWORD =
nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#endpointObject

Returns the value of attribute endpoint.



10
11
12
# File 'lib/isms/configuration.rb', line 10

def endpoint
  @endpoint
end

#passwordObject

Returns the value of attribute password.



10
11
12
# File 'lib/isms/configuration.rb', line 10

def password
  @password
end

#protocolObject

Returns the value of attribute protocol.



10
11
12
# File 'lib/isms/configuration.rb', line 10

def protocol
  @protocol
end

#usernameObject

Returns the value of attribute username.



10
11
12
# File 'lib/isms/configuration.rb', line 10

def username
  @username
end

Class Method Details

.extended(mod) ⇒ Object

When extended, call reset to set variable values to defaults



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

def self.extended(mod)
  mod.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



28
29
30
# File 'lib/isms/configuration.rb', line 28

def configure
  yield self
end

#endpoint_url_with_protocolObject



24
25
26
# File 'lib/isms/configuration.rb', line 24

def endpoint_url_with_protocol
  "#{protocol}://#{endpoint}"
end

#resetObject



17
18
19
20
21
22
# File 'lib/isms/configuration.rb', line 17

def reset
  self.username = DEFAULT_USERNAME
  self.password = DEFAULT_PASSWORD
  self.protocol = DEFAULT_PROTOCOL
  self.endpoint = DEFAULT_ENDPOINT
end