Module: Morpheus::Configuration

Extended by:
Configuration
Included in:
Configuration
Defined in:
lib/morpheus/configuration.rb

Instance Method Summary collapse

Instance Method Details

#allow_net_connect=(allowed) ⇒ Object

Can be set or unset to allow for test suite mocking.



56
57
58
# File 'lib/morpheus/configuration.rb', line 56

def allow_net_connect=(allowed)
  Typhoeus::Hydra.allow_net_connect = allowed
end

#allow_net_connect?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/morpheus/configuration.rb', line 63

def allow_net_connect?
  Typhoeus::Hydra.allow_net_connect?
end

#attributesObject



5
6
7
# File 'lib/morpheus/configuration.rb', line 5

def attributes
  @attributes ||= {}
end

#hostObject



31
32
33
34
# File 'lib/morpheus/configuration.rb', line 31

def host
  attributes[:host] || raise(Morpheus::ConfigurationError,
    'The request HOST has not been set. Please set the host using Morpheus::Configuration.host = "http://www.example.com"')
end

#host=(host) ⇒ Object

Sets and gets the remote host service domain. The domain must be set before any requests can be made.



27
28
29
# File 'lib/morpheus/configuration.rb', line 27

def host=(host)
  attributes[:host] = host
end

#hydraObject

Links to the underlying libcurl request pool. Allows for concurrent requests.



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

def hydra
  attributes[:hydra] ||= Typhoeus::Hydra.hydra
end

#hydra=(hydra) ⇒ Object



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

def hydra=(hydra)
  attributes[:hydra] = Typhoeus::Hydra.hydra = hydra
end

#loggerObject

Handles the default logger that is used by the LogSubscriber



47
48
49
# File 'lib/morpheus/configuration.rb', line 47

def logger
  attributes[:logger] ||= ::Logger.new(STDOUT)
end

#logger=(logger) ⇒ Object



51
52
53
# File 'lib/morpheus/configuration.rb', line 51

def logger=(logger)
  attributes[:logger] = logger
end

#parse_error_handlerObject



67
68
69
# File 'lib/morpheus/configuration.rb', line 67

def parse_error_handler
  attributes[:parse_error_handler]
end

#parse_error_handler=(handler) ⇒ Object



71
72
73
# File 'lib/morpheus/configuration.rb', line 71

def parse_error_handler=(handler)
  attributes[:parse_error_handler] = handler
end

#passwordObject



21
22
23
# File 'lib/morpheus/configuration.rb', line 21

def password
  attributes[:password]
end

#password=(password) ⇒ Object



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

def password=(password)
  attributes[:password] = password
end

#usernameObject



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

def username
  attributes[:username]
end

#username=(username) ⇒ Object



9
10
11
# File 'lib/morpheus/configuration.rb', line 9

def username=(username)
  attributes[:username] = username
end