Class: UAT::Discovery::MockClient
- Inherits:
-
Interfaces::IClient
- Object
- Interfaces::IClient
- UAT::Discovery::MockClient
- Defined in:
- lib/uat/discovery/mock_client.rb
Overview
A mock discovery client, mainly for use when running tests locally Allows one to locally configure the hosts associated with a service name
Instance Method Summary collapse
-
#initialize(hash_of_service_urls_keyed_by_service_name, api) ⇒ MockClient
constructor
A new instance of MockClient.
- #urls_for_service(service_name) ⇒ Object
Constructor Details
#initialize(hash_of_service_urls_keyed_by_service_name, api) ⇒ MockClient
Returns a new instance of MockClient.
9 10 11 12 |
# 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 |
Instance Method Details
#urls_for_service(service_name) ⇒ Object
15 16 17 18 19 20 21 |
# 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 |