Class: CPEE::Instantiation::InstantiateGit
- Inherits:
-
Riddl::Implementation
- Object
- Riddl::Implementation
- CPEE::Instantiation::InstantiateGit
- Includes:
- Helpers
- Defined in:
- lib/cpee/instantiation.rb
Overview
}}}
Instance Method Summary collapse
Methods included from Helpers
#handle_data, #handle_endpoints
Instance Method Details
#response ⇒ Object
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/cpee/instantiation.rb', line 169 def response cpee = @h['X_CPEE'] || @a[0] selfurl = @a[1] cblist = @a[2] status, res = Riddl::Client.new(File.join(@p[1].value,'raw',@p[2].value,@p[3].value).gsub(/ /,'%20')).get tdoc = if status >= 200 && status < 300 res[0].value.read else (@status = 500) && return end stream = @p.find{ |e| e.name == 'stream' }&.value if (instance, uuid = load_testset(tdoc,cpee,nil,stream)).first == -1 @status = 500 else handle_data cpee, instance, @p[4]&.value if @p[4]&.name == 'init' handle_endpoints cpee, instance, @p[4]&.value if @p[4]&.name == 'endpoints' handle_endpoints cpee, instance, @p[5]&.value if @p[5]&.name == 'endpoints' handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist handle_starting cpee, instance, @p[0].value send = { 'CPEE-INSTANCE' => instance, 'CPEE-INSTANCE-URL' => File.join(cpee,instance), 'CPEE-INSTANCE-UUID' => uuid, 'CPEE-BEHAVIOR' => @p[0].value } @headers << Riddl::Header.new('CPEE-INSTANTIATION',JSON::generate(send)) Riddl::Parameter::Complex.new('instance','application/json',JSON::generate(send)) end end |