Class: MarketingCloudSDK::ET_Continue

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, request_id) ⇒ ET_Continue

Returns a new instance of ET_Continue.



483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/new.rb', line 483

def initialize(authStub, request_id)
  @results = []
  authStub.refreshToken
  obj = {'ContinueRequest' => request_id}
  response = authStub.auth.call(:retrieve, :message => {'RetrieveRequest' => obj})

  super(response)

  if @status then
    if @@body[:retrieve_response_msg][:overall_status] != "OK" && @@body[:retrieve_response_msg][:overall_status] != "MoreDataAvailable" then
      @status = false
      @message = @@body[:retrieve_response_msg][:overall_status]
    end

    @moreResults = false
    if @@body[:retrieve_response_msg][:overall_status] == "MoreDataAvailable" then
      @moreResults = true
    end

    if (!@@body[:retrieve_response_msg][:results].is_a? Hash) && (!@@body[:retrieve_response_msg][:results].nil?) then
      @results = @results + @@body[:retrieve_response_msg][:results]
    elsif  (!@@body[:retrieve_response_msg][:results].nil?)
      @results.push(@@body[:retrieve_response_msg][:results])
    end

    # Store the Last Request ID for use with continue
    @request_id = @@body[:retrieve_response_msg][:request_id]
  end
end