Class: Diplomat::Service
- Inherits:
-
RestClient
- Object
- RestClient
- Diplomat::Service
- Defined in:
- lib/diplomat/service.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#get(key, scope = :first) ⇒ OpenStruct
Get a service by it’s key.
Methods inherited from RestClient
Constructor Details
This class inherits a constructor from Diplomat::RestClient
Class Method Details
.get(*args) ⇒ Object
Note:
This is sugar, see (#get)
21 22 23 |
# File 'lib/diplomat/service.rb', line 21 def self.get *args Diplomat::Service.new.get *args end |
Instance Method Details
#get(key, scope = :first) ⇒ OpenStruct
Get a service by it’s key
11 12 13 14 15 16 17 18 |
# File 'lib/diplomat/service.rb', line 11 def get key, scope=:first ret = @conn.get "/v1/catalog/service/#{key}" if scope == :all return JSON.parse(ret.body).map { |service| OpenStruct.new service } end return OpenStruct.new JSON.parse(ret.body).first end |