Class: FuelSDK::ET_Delete

Inherits:
ET_Constructor show all
Defined in:
lib/new.rb

Instance Attribute Summary

Attributes inherited from ET_Constructor

#code, #message, #moreResults, #request_id, #results, #status

Instance Method Summary collapse

Constructor Details

#initialize(authStub, objType, props = nil) ⇒ ET_Delete

Returns a new instance of ET_Delete.



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/new.rb', line 408

def initialize(authStub, objType, props = nil)
  @results = []
  begin
    authStub.refreshToken
    if props.is_a? Array then
      obj = {
        'Objects' => [],
        :attributes! => { 'Objects' => { 'xsi:type' => ('tns:' + objType) } }
      }
      props.each{ |p|
        obj['Objects'] << p
      }
    else
      obj = {
        'Objects' => props,
        :attributes! => { 'Objects' => { 'xsi:type' => ('tns:' + objType) } }
      }
    end

    response = authStub.auth.call(:delete, :message => obj)
  ensure
    super(response)
    if @status then
      if @@body[:delete_response][:overall_status] != "OK"
        @status = false
      end
      if !@@body[:delete_response][:results].is_a? Hash then
        @results = @results + @@body[:delete_response][:results]
      else
        @results.push(@@body[:delete_response][:results])
      end
    end
  end
end