Class: MandateClaw::SignedContract

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/mandate_claw/signed_contract.rb

Overview

Immutable record of a fully-signed, anchored task contract. Once created, only status and revoked_at may change.

Instance Method Summary collapse

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/models/mandate_claw/signed_contract.rb', line 39

def expired?
  expires_at < Time.current || status == "expired"
end

#partiesObject



31
32
33
# File 'app/models/mandate_claw/signed_contract.rb', line 31

def parties
  JSON.parse(parties_json)
end

#revoke!(reason: nil) ⇒ Object



43
44
45
# File 'app/models/mandate_claw/signed_contract.rb', line 43

def revoke!(reason: nil)
  update!(status: :revoked, revoked_at: Time.current, revocation_reason: reason)
end

#signaturesObject



35
36
37
# File 'app/models/mandate_claw/signed_contract.rb', line 35

def signatures
  JSON.parse(signatures_json)
end