98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/marketingcloudsdk/http_request.rb', line 98
def request(method, url, options={})
uri = generate_uri url, options['params']
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
data = options['data']
_request = method.new uri.request_uri
_request.body = data.to_json if data
_request.content_type = options['content_type'] if options['content_type']
_request.add_field('User-Agent', 'FuelSDK-Ruby-v' + MarketingCloudSDK::VERSION)
if options['access_token']
_request.add_field('Authorization', 'Bearer ' + options['access_token'])
end
response = http.request(_request)
HTTPResponse.new(response, self, :url => url, :options => options)
end
|