Class: Rots::Mocks::RotsServer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/rots/mocks/rots_server.rb

Constant Summary collapse

SERVER_URL =
"http://localhost:9292"
DEFAULT_CONFIG =
{
  "identity" => "john.doe",
  "sreg" => {
    "nickname" => "jdoe",
    "fullname" => "John Doe",
    "email" => "[email protected]",
    "dob" => Date.parse("1985-09-21"),
    "gender" => "M",
  }.freeze,
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ RotsServer

Returns a new instance of RotsServer.

Parameters:

  • config (Hash, nil) (defaults to: nil)
    • the configuration of the app’s authorizable identity

Raises:

  • (ArgumentError)


22
23
24
25
26
27
# File 'lib/rots/mocks/rots_server.rb', line 22

def initialize(config = nil)
  @config ||= DEFAULT_CONFIG
  raise ArgumentError, "config must be a Hash" unless self.config.is_a?(Hash)

  @app = rack_app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



17
18
19
# File 'lib/rots/mocks/rots_server.rb', line 17

def app
  @app
end

#configObject (readonly)

Returns the value of attribute config.



17
18
19
# File 'lib/rots/mocks/rots_server.rb', line 17

def config
  @config
end