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



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

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



1574
1575
1576
# File 'lib/schema.rb', line 1574

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

Instance Method Details

#to_dynamicObject



1578
1579
1580
1581
1582
1583
1584
# File 'lib/schema.rb', line 1578

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

#to_json(options = nil) ⇒ Object



1586
1587
1588
# File 'lib/schema.rb', line 1586

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