Sha256: 2704459772b805ba4cf9a1f57c298d9500aaf9e4a55fcc9f144824500a843228
Contents?: true
Size: 808 Bytes
Versions: 5
Compression:
Stored size: 808 Bytes
Contents
# frozen_string_literal: true require 'httpclient' class SecureNativeHttpClient AUTHORIZATION_HEADER = 'Authorization' VERSION_HEADER = 'SN-Version' USER_AGENT_HEADER = 'User-Agent' USER_AGENT_HEADER_VALUE = 'SecureNative-python' CONTENT_TYPE_HEADER = 'Content-Type' CONTENT_TYPE_HEADER_VALUE = 'application/json' def initialize(securenative_options) @options = securenative_options @client = HTTPClient.new end def _headers { CONTENT_TYPE_HEADER => CONTENT_TYPE_HEADER_VALUE, USER_AGENT_HEADER => USER_AGENT_HEADER_VALUE, VERSION_HEADER => VersionUtils.version, AUTHORIZATION_HEADER => @options.api_key } end def post(path, body) url = "#{@options.api_url}/#{path}" headers = _headers @client.post(url, body, headers) end end
Version data entries
5 entries across 4 versions & 1 rubygems