lib/immoscout/api/request.rb in immoscout-1.3.1 vs lib/immoscout/api/request.rb in immoscout-1.3.2
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Immoscout
module Api
module Request
def get(path, payload = nil, multipart = nil)
request(:get, path, payload, multipart)
@@ -15,21 +17,23 @@
def delete(path, payload = nil, multipart = nil)
request(:delete, path, payload, multipart)
end
+ # rubocop:disable Metrics/MethodLength because of the header handling
def request(method, path, payload = nil, multipart = nil)
connection.send(method, path, multipart) do |request|
if multipart
- request.headers['Content-Type'] = "multipart/form-data"
+ request.headers['Content-Type'] = 'multipart/form-data'
else
request.body = payload if payload
- request.headers['Content-Type'] = "application/json;charset=UTF-8"
+ request.headers['Content-Type'] = 'application/json;charset=UTF-8'
end
- request.headers['Accept'] = "application/json"
+ request.headers['Accept'] = 'application/json'
request.headers['User-Agent'] = \
"HausgoldImmoscout/#{Immoscout::VERSION}"
end
end
+ # rubocop:enable Metrics/MethodLength
end
end
end