class HttpStub::Configurator::State

Attributes

port[RW]
scenario_hashes[R]
session_identifier[W]
stub_hashes[R]

Public Class Methods

new() click to toggle source
# File lib/http_stub/configurator/state.rb, line 12
def initialize
  @scenario_hashes           = []
  @stub_hashes               = []
  @cross_origin_support_flag = false
end

Public Instance Methods

add_scenario(scenario) click to toggle source
# File lib/http_stub/configurator/state.rb, line 26
def add_scenario(scenario)
  @scenario_hashes << scenario.to_hash
end
add_stub(stub) click to toggle source
# File lib/http_stub/configurator/state.rb, line 30
def add_stub(stub)
  @stub_hashes << stub.to_hash
end
application_settings() click to toggle source
# File lib/http_stub/configurator/state.rb, line 34
def application_settings
  { port: @port, session_identifier: @session_identifier, cross_origin_support: @cross_origin_support_flag }
end
enable(feature) click to toggle source
# File lib/http_stub/configurator/state.rb, line 22
def enable(feature)
  @cross_origin_support_flag = true if feature == :cross_origin_support
end
external_base_uri() click to toggle source
# File lib/http_stub/configurator/state.rb, line 18
def external_base_uri
  ENV["STUB_EXTERNAL_BASE_URI"] || "http://localhost:#{@port}"
end