class HttpStub::Server::Stub::Triggers

Constants

DEFAULT_ARGS
EMPTY

Attributes

scenario_names[R]
stubs[R]

Public Class Methods

new(args={}) click to toggle source
# File lib/http_stub/server/stub/triggers.rb, line 13
def initialize(args={})
  resolved_args   = DEFAULT_ARGS.merge(args || {})
  @scenario_names = resolved_args[:scenario_names]
  @stubs          = create_stubs(resolved_args[:stubs])
  @description    = resolved_args.to_s
end

Public Instance Methods

to_json(*args) click to toggle source
# File lib/http_stub/server/stub/triggers.rb, line 30
def to_json(*args)
  { scenario_names: @scenario_names, stubs: @stubs }.to_json(*args)
end
to_s() click to toggle source
# File lib/http_stub/server/stub/triggers.rb, line 34
def to_s
  @description
end

Private Instance Methods

create_stubs(stub_hashes) click to toggle source
# File lib/http_stub/server/stub/triggers.rb, line 22
def create_stubs(stub_hashes)
  stub_hashes.map { |hash| HttpStub::Server::Stub.create(hash) }
end