Sha256: dd9d6edbd948ffa62739714d48dbcf3f2d3fb69dd1e0d1c47c9ec91af873063e
Contents?: true
Size: 701 Bytes
Versions: 3
Compression:
Stored size: 701 Bytes
Contents
# frozen_string_literal: true require "net/http" module HubSpot module HTTP DEFAULT_HEADERS = { accept: "application/json", content_type: "application/x-www-form-urlencoded;charset=utf-8", }.freeze # Authentication credentials for HTTP authentication. AUTHORIZATION = "Authorization" module_function def post(url:, post_body: nil, headers: DEFAULT_HEADERS) uri = URI(url) Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| request = Net::HTTP::Post.new(uri.request_uri, headers) request.body = post_body.to_json unless post_body.nil? # Send the request http.request(request) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hub_spot-0.3.0 | lib/hub_spot/http.rb |
hub_spot-0.2.1 | lib/hub_spot/http.rb |
hub_spot-0.2.0 | lib/hub_spot/http.rb |