Class: HttpHelper
- Inherits:
-
Object
- Object
- HttpHelper
- Defined in:
- lib/Helpers/http_helper.rb
Class Method Summary collapse
Class Method Details
.SendRequest(request, uri) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/Helpers/http_helper.rb', line 7 def self.SendRequest(request, uri) uri = URI.parse(KaznacheyConfigurations.ServerUrl + uri) begin header = {'Content-Type' => 'text/json'} http = Net::HTTP.new(uri.host, uri.port) httpRequest = Net::HTTP::Post.new(uri.request_uri, header) body = ActiveSupport::JSON.encode(request) httpRequest.body = body response = http.request(httpRequest) response.body rescue ensure nil end end |