Class: CPEE::Instantiation::InstantiateUrl

Inherits:
Riddl::Implementation
  • Object
show all
Includes:
Helpers
Defined in:
lib/cpee-instantiation/instantiation.rb

Overview

}}}

Instance Method Summary collapse

Methods included from Helpers

#add_running_to_testset, #add_to_testset, #add_waiting_to_testset, #augment_testset, #customize_testset, #instantiate_testset

Instance Method Details

#responseObject



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/cpee-instantiation/instantiation.rb', line 193

def response
  cpee     = @h['X_CPEE'] || @a[0]
  selfurl  = @a[1]
  cblist   = @a[2]
  name     = @a[3] ? @p.shift.value : nil
  behavior = @p[0].value

  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
  customization = @p.find{ |e| e.name == 'customization' }&.value

  doc = augment_testset(tdoc,@p,@h)
  customize_testset(customization,doc)
  cbk, condition = add_waiting_to_testset(behavior,@h['CPEE_CALLBACK'],doc,selfurl)
  add_running_to_testset(behavior,doc)

  instantiate_testset(cpee,doc,@p[0].value,cblist,cbk,@h['CPEE_CALLBACK'],condition)
end