Sha256: bd181c0ed11de295a15a71d844c164a5e1ca20c571f74a4cf392f445943730dc
Contents?: true
Size: 799 Bytes
Versions: 1
Compression:
Stored size: 799 Bytes
Contents
# frozen_string_literal: true require 'httparty' module NoradBeacon # Class to post http payloads class NoradAPI include HTTParty @norad_root = ENV.fetch('NORAD_ROOT') class << self def post_payload(http_payload) http_req http_payload, :post end def delete_payload(http_payload) http_req http_payload, :delete end alias post_results post_payload private def http_req(http_payload, verb) auth_header = { 'NORAD-SIGNATURE' => http_payload.compute_signature } address = @norad_root + http_payload.url send( verb, address, body: http_payload.payload, headers: { 'Content-Type' => 'application/json' }.merge(auth_header) ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
norad_beacon-0.1.4 | lib/norad_beacon/api.rb |