require "uri" require "json" require "net/http" url = URI("https://api.swep.net/calculateSinglePhase") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-KEY"] = "YOUR_API_KEY" request["Content-Type"] = "application/json" request.body = JSON.dump({ "inputs": { "calculationMethod": "Design", "selectedFluidSide1": { "fluidId": 53, "isGas": false, "inputValue": "__RUBY\#%0NULL__" }, "selectedFluidSide2": { "fluidId": 53, "isGas": false, "inputValue": "__RUBY\#%0NULL__" }, "coCurrent": false, "selectedHeatExchangers": [ { "heatExchangerInputType": "Parent", "id": 1 } ], "heatLoad": { "amount": 1500, "unit": "HeatLoadUnit.Kilowatt" }, "inletTemperatureSide1": { "amount": 80, "unit": "TemperatureUnit.DegreeCelsius" }, "inletTemperatureSide2": { "amount": 20, "unit": "TemperatureUnit.DegreeCelsius" }, "outletTemperatureSide1": { "amount": 40, "unit": "TemperatureUnit.DegreeCelsius" }, "outletTemperatureSide2": { "amount": 50, "unit": "TemperatureUnit.DegreeCelsius" }, "flowSide1": "__RUBY\#%0NULL__", "flowSide2": "__RUBY\#%0NULL__", "maxPressureDropSide1": { "amount": 20000, "unit": "PressureUnit.Pascal" }, "maxPressureDropSide2": { "amount": 20000, "unit": "PressureUnit.Pascal" }, "numberOfPasses": "__RUBY\#%0NULL__", "numberOfPlates": "__RUBY\#%0NULL__", "numberOfPlatesStack1": "__RUBY\#%0NULL__", "numberOfPlatesStack2": "__RUBY\#%0NULL__", "oversurface": "__RUBY\#%0NULL__", "portSwitch": true, "autoperformance": false } }) response = https.request(request) puts response.read_body