Class: Sigstore::Rekor::Entries::Retrieve
- Inherits:
-
Object
- Object
- Sigstore::Rekor::Entries::Retrieve
- Defined in:
- lib/sigstore/rekor/client.rb
Instance Method Summary collapse
-
#initialize(url, session:) ⇒ Retrieve
constructor
A new instance of Retrieve.
- #post(expected_entry) ⇒ Object
Constructor Details
#initialize(url, session:) ⇒ Retrieve
84 85 86 87 |
# File 'lib/sigstore/rekor/client.rb', line 84 def initialize(url, session:) @url = url @session = session end |
Instance Method Details
#post(expected_entry) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/sigstore/rekor/client.rb', line 89 def post(expected_entry) data = { entries: [expected_entry] } resp = @session.post2(@url.path, data.to_json, { "Content-Type" => "application/json", "Accept" => "application/json" }) if resp.code != "200" raise Error::FailedRekorLookup, "#{resp.code} #{resp.message.inspect}\n#{JSON.pretty_generate(data)}\n#{resp.body}" end results = JSON.parse(resp.body) results.map do |result| Entries.decode_transparency_log_entry(result) end.min_by(&:integrated_time) end |