Class: Signature

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schema.rb

Overview

The signature of the command step, generally injected by agents at pipeline upload

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



1567
1568
1569
1570
1571
1572
1573
1574
# File 'lib/schema.rb', line 1567

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    algorithm: d["algorithm"],
    signed_fields: d["signed_fields"],
    value: d["value"]
  )
end

.from_json!(json) ⇒ Object



1576
1577
1578
# File 'lib/schema.rb', line 1576

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



1580
1581
1582
1583
1584
1585
1586
# File 'lib/schema.rb', line 1580

def to_dynamic
  {
    "algorithm" => algorithm,
    "signed_fields" => signed_fields,
    "value" => value
  }
end

#to_json(options = nil) ⇒ Object



1588
1589
1590
# File 'lib/schema.rb', line 1588

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end