Class: Safelylaunch::MockConnection

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_token:, toggles: {}, logger: Logger.new(STDOUT), host: 'http://localhost:2300') ⇒ MockConnection

Returns a new instance of MockConnection.



5
6
7
8
9
10
11
# File 'lib/safelylaunch/mock_connection.rb', line 5

def initialize(api_token:, toggles: {}, logger: Logger.new(STDOUT), host: 'http://localhost:2300')
  @api_token = api_token
  @logger = logger
  @host = host
  @connection = nil
  @toggles = toggles
end

Instance Attribute Details

#api_tokenObject (readonly)

Returns the value of attribute api_token.



3
4
5
# File 'lib/safelylaunch/mock_connection.rb', line 3

def api_token
  @api_token
end

#connectionObject (readonly)

Returns the value of attribute connection.



3
4
5
# File 'lib/safelylaunch/mock_connection.rb', line 3

def connection
  @connection
end

#hostObject (readonly)

Returns the value of attribute host.



3
4
5
# File 'lib/safelylaunch/mock_connection.rb', line 3

def host
  @host
end

#loggerObject (readonly)

Returns the value of attribute logger.



3
4
5
# File 'lib/safelylaunch/mock_connection.rb', line 3

def logger
  @logger
end

Instance Method Details

#get(key) ⇒ Object



13
14
15
16
# File 'lib/safelylaunch/mock_connection.rb', line 13

def get(key)
  result = @toggles.fetch(key, false)
  { key: key, enable: result }
end