class UAT::Discovery::MockClient

A mock discovery client, mainly for use when running tests locally Allows one to locally configure the hosts associated with a service name @see [UAT::Discovery::IClient]

Public Class Methods

new(hash_of_service_urls_keyed_by_service_name, api) click to toggle source

@param hash_of_service_urls_keyed_by_service_name [Hash] @param api [UAT::Discovery::API]

# File lib/uat/discovery/mock_client.rb, line 9
def initialize(hash_of_service_urls_keyed_by_service_name, api)
  @hash_of_service_urls = hash_of_service_urls_keyed_by_service_name
  @api = api
end

Public Instance Methods

urls_for_service(service_name) click to toggle source

@see [UAT::Discovery::IClient#urls_for_service]

# File lib/uat/discovery/mock_client.rb, line 15
def urls_for_service(service_name)
  if @hash_of_service_urls.has_key? service_name
    @hash_of_service_urls[service_name].map {|service_url| @api.new_uri(service_url)}
  else
    raise "URL for service #{service_name} could not be found"
  end
end