Class: FuelSDK::ET_PatchRest

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, payload) ⇒ ET_PatchRest

Returns a new instance of ET_PatchRest.



874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
# File 'lib/new.rb', line 874

def initialize(authStub, endpoint, payload)
  authStub.refreshToken

  qs = {"access_token" => authStub.authToken}
  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::Patch.new(uri.request_uri)
  request.body =  payload.to_json
  request.add_field "Content-Type", "application/json"
  requestResponse = http.request(request)
  super(requestResponse, true)

end