Class: MarketingCloudSDK::ET_GetRest

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, endpoint, qs = nil) ⇒ ET_GetRest

Returns a new instance of ET_GetRest.



806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
# File 'lib/new.rb', line 806

def initialize(authStub, endpoint, qs = nil)
  authStub.refreshToken

  if qs then
    qs['access_token'] = authStub.authToken
  else
    qs = {"access_token" => authStub.authToken}
  end

  uri = URI.parse(endpoint)
  uri.query = URI.encode_www_form(qs)
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true
  request = Net::HTTP::Get.new(uri.request_uri)
  requestResponse = http.request(request)

  @moreResults = false

  obj = super(requestResponse, true)
  return obj
end