Class: UAT::Discovery::Client
- Inherits:
-
Interfaces::IClient
- Object
- Interfaces::IClient
- UAT::Discovery::Client
- Defined in:
- lib/uat/discovery/client.rb
Overview
A discovery client that uses Diplomat to get urls for a named service
Instance Method Summary collapse
-
#initialize(diplomat_service, protocol, api, path_provider) ⇒ Client
constructor
A new instance of Client.
- #urls_for_service(service_name) ⇒ Object
Constructor Details
#initialize(diplomat_service, protocol, api, path_provider) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 |
# File 'lib/uat/discovery/client.rb', line 10 def initialize(diplomat_service, protocol, api, path_provider) @diplomat_service = diplomat_service @protocol = protocol @api = api @path_provider = path_provider end |
Instance Method Details
#urls_for_service(service_name) ⇒ Object
18 19 20 21 22 |
# File 'lib/uat/discovery/client.rb', line 18 def urls_for_service(service_name) diplomat_services = @diplomat_service.get(service_name, :all) path = @path_provider.path_to_append_for(service_name) diplomat_services.map {|diplomat_service| @api.new_uri(uri_string(diplomat_service, path)) }.uniq end |