Class: CPEE::Instantiation::InstantiateUrl
- Inherits:
-
Riddl::Implementation
- Object
- Riddl::Implementation
- CPEE::Instantiation::InstantiateUrl
- 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
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/cpee/instantiation.rb', line 206 def response cpee = @h['X_CPEE'] || @a[0] selfurl = @a[1] cblist = @a[2] name = @a[3] ? @p.shift.value : nil status, res = Riddl::Client.new(@p[1].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,name,stream)).first == -1 @status = 500 else handle_data cpee, instance, @p[2]&.value if @p[2]&.name == 'init' handle_endpoints cpee, instance, @p[2]&.value if @p[2]&.name == 'endpoints' handle_endpoints cpee, instance, @p[3]&.value if @p[3]&.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 |