Class: Avo::Licensing::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/avo/licensing/request.rb

Class Method Summary collapse

Class Method Details

.post(endpoint, body:, timeout:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/avo/licensing/request.rb', line 7

def post(endpoint, body:, timeout:)
  uri = URI.parse(endpoint)
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = (uri.scheme == "https")
  http.read_timeout = timeout
  http.open_timeout = timeout
  request = Net::HTTP::Post.new(uri.request_uri, {"Content-Type" => "application/json"})
  request.body = body
  http.request(request)
end