module HubSpot::HTTP

Constants

AUTHORIZATION

Authentication credentials for HTTP authentication.

DEFAULT_HEADERS

Public Instance Methods

post(url:, post_body: nil, headers: DEFAULT_HEADERS) click to toggle source
# File lib/hub_spot/http.rb, line 17
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