Sha256: 603b862226e12d30093551bda26da809f40f6da8631d6863cacfd81bf76e2f2e
Contents?: true
Size: 528 Bytes
Versions: 4
Compression:
Stored size: 528 Bytes
Contents
# frozen_string_literal: true require 'json' require 'openssl' module NoradBeacon class HttpPayload attr_accessor :url def initialize(url = nil) @data = {} @url = url || url_from_env end def add(obj) @data.merge!(obj.to_h) end def payload @payload ||= @data.merge(timestamp: Time.now.to_i).to_json end def compute_signature OpenSSL::HMAC.hexdigest('sha256', ENV['NORAD_SECRET'], payload) end private def url_from_env '' end end end
Version data entries
4 entries across 4 versions & 1 rubygems