Module: Jerakia::Client::Lookup

Included in:
Jerakia::Client
Defined in:
lib/jerakia/client/lookup.rb

Instance Method Summary collapse

Instance Method Details

#lookup(key, params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/jerakia/client/lookup.rb', line 4

def lookup(key, params)

  ## Convert namespace array to forward slash delimited string
  if params[:namespace].is_a?(Array)
    params[:namespace] = params[:namespace].join('/')
  end

  if params[:scope_opts].is_a?(Hash)
    params[:scope_opts].each do |k,v|
      params["scope_#{k}".to_sym] = v
    end
    params.delete(:scope_opts)
  end
  if params[:metadata].is_a?(Hash)
    params[:metadata].each do |k,v|
      params["metadata_#{k}".to_sym] = v
    end
    params.delete(:metadata)
  end

  return get("/v1/lookup/#{key}", params)
end