Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #50 from amagar088/master
Browse files Browse the repository at this point in the history
added user-agent to track calls made from this SDK
  • Loading branch information
amagar088 authored Aug 10, 2016
2 parents fa186f7 + c7757b7 commit b7f1e9f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/fuelsdk/http_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
module FuelSDK

class HTTPResponse < FuelSDK::Response

def initialize raw, client, request
super raw, client
@request = request
Expand Down Expand Up @@ -80,7 +79,6 @@ def method_missing method, *args, &block
end

module HTTPRequest

request_methods = ['get', 'post', 'patch', 'delete']
request_methods.each do |method|
class_eval <<-EOT, __FILE__, __LINE__ + 1
Expand All @@ -100,16 +98,15 @@ def generate_uri(url, params=nil)

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')
response = http.request(_request)

HTTPResponse.new(response, self, :url => url, :options => options)
end
end
Expand Down

0 comments on commit b7f1e9f

Please sign in to comment.