Class: Cnvrg::Hyper

Inherits:
Object
  • Object
show all
Defined in:
lib/cnvrg/hyper.rb

Instance Method Summary collapse

Constructor Details

#initialize(project_path, path) ⇒ Hyper

Returns a new instance of Hyper.



3
4
5
6
7
8
# File 'lib/cnvrg/hyper.rb', line 3

def initialize(project_path, path)
  @project = Cnvrg::Project.new(project_path)
  @content = YAML.load_file(path)
  @base_resource = "users/#{@project.owner}"
  @params = []
end

Instance Method Details

#resolve_paramsObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/cnvrg/hyper.rb', line 10

def resolve_params
  resp = Cnvrg::API.request(@base_resource + "/resolve_grid", "POST", {hyper_search: @content})
  unless Cnvrg::CLI.is_response_success(resp, false)
    return nil
  end
  resp['result']['params'].each do |param|
    @params << {key: param.first.keys.first, value: param.map{|p| p.values}.flatten.join(',')}
  end
  @params
end