Sha256: 0f0a549de005f043da1c388ac94df97bbe8620a343a9e6151f24a0cc5a8219e3

Contents?: true

Size: 479 Bytes

Versions: 3

Compression:

Stored size: 479 Bytes

Contents

# frozen_string_literal: true
require 'httparty'

module NoradBeacon
  # Class to post results
  class NoradAPI
    include HTTParty
    @norad_root = ENV.fetch('NORAD_ROOT')

    def self.post_results(results)
      auth_header = { 'NORAD-SIGNATURE' => results.compute_signature }
      address = @norad_root + results.url
      post(
        address,
        body: results.payload, headers: { 'Content-Type' => 'application/json' }.merge(auth_header)
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
norad_beacon-0.1.3 lib/norad_beacon/api.rb
norad_beacon-0.1.2 lib/norad_beacon/api.rb
norad_beacon-0.1.1 lib/norad_beacon/api.rb