Class: ActiveSpy::Configuration

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

Overview

Defines a class to hold the configuration used to send events.

Class Method Summary collapse

Class Method Details

.development_mode(mode = nil, options = nil) ⇒ Boolean

Set if the gem is in development mode or not.

Parameters:

  • development (Boolean)

    moded state to set

Returns:

  • (Boolean)

    development moded state to set



61
62
63
64
65
66
67
# File 'lib/active_spy/configuration.rb', line 61

def development_mode(mode = nil, options = nil)
  unless mode.nil?
    @development_mode = mode
    @skip_validations = options[:skip_validations] if options.present?
  end
  @development_mode
end

.development_mode!Object

Imperative method to set development mode.



77
78
79
# File 'lib/active_spy/configuration.rb', line 77

def development_mode!
  @development_mode = true
end

.event_host(host = nil) ⇒ String

Set the default event-runner host

Parameters:

  • host (String) (defaults to: nil)

    to set

Returns:

  • (String)

    the host set



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

def event_host(host = nil)
  @event_host = host unless host.nil?
  @event_host
end

.event_port(port = nil) ⇒ String

Set the default event-runner port

Parameters:

  • port (String) (defaults to: nil)

    to set

Returns:

  • (String)

    the port set



86
87
88
89
# File 'lib/active_spy/configuration.rb', line 86

def event_port(port = nil)
  @event_port = port unless port.nil?
  @event_port
end

.event_settingsHash

See how are the event settings

Returns:

  • (Hash)

    actual event settings



101
102
103
# File 'lib/active_spy/configuration.rb', line 101

def event_settings
  { host: @event_host, port: @event_port, verify_ssl: @event_verify_ssl }
end

.event_verify_ssl(event_verify_ssl = nil) ⇒ String

Set the default event-tunner verify_ssl mode

Parameters:

  • host (String)

    to set

Returns:

  • (String)

    the host set



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

def event_verify_ssl(event_verify_ssl = nil)
  @event_verify_ssl = event_verify_ssl unless event_verify_ssl.nil?
  @event_verify_ssl
end

.host(host = nil) ⇒ String

Set the application host

Parameters:

  • host (String) (defaults to: nil)

    to set

Returns:

  • (String)

    the host set



11
12
13
14
# File 'lib/active_spy/configuration.rb', line 11

def host(host = nil)
  @host = host unless host.nil?
  @host
end

.name(name = nil) ⇒ String

Set the application name

Parameters:

  • name (String) (defaults to: nil)

    to set

Returns:

  • (String)

    the name set



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

def name(name = nil)
  @name = name unless name.nil?
  @name
end

.port(port = nil) ⇒ String

Set the application port

Parameters:

  • port (String) (defaults to: nil)

    to set

Returns:

  • (String)

    the port set



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

def port(port = nil)
  @port = port unless port.nil?
  @port
end

.settingsHash

See how are the settings

Returns:

  • (Hash)

    actual settings



94
95
96
# File 'lib/active_spy/configuration.rb', line 94

def settings
  { name: @name, hostname: @host, port: @port }
end

.skip_validationsObject

Simple reader for skip_validations attribute.



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

def skip_validations
  @skip_validations
end