Class: Nis::ApostilleAudit
- Inherits:
-
Object
- Object
- Nis::ApostilleAudit
- Defined in:
- lib/nis/apostille_audit.rb
Constant Summary collapse
- CHECKSUM =
'fe4e5459'.freeze
Instance Method Summary collapse
-
#initialize(file, apostille_hash) ⇒ ApostilleAudit
constructor
A new instance of ApostilleAudit.
- #private? ⇒ Boolean
- #split_apostille_hash ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(file, apostille_hash) ⇒ ApostilleAudit
Returns a new instance of ApostilleAudit.
11 12 13 14 15 |
# File 'lib/nis/apostille_audit.rb', line 11 def initialize(file, apostille_hash) @file = file @apostille_hash = apostille_hash @checksum, @version, @algo, @hash = split_apostille_hash end |
Instance Method Details
#private? ⇒ Boolean
23 24 25 |
# File 'lib/nis/apostille_audit.rb', line 23 def private? @version == 0x80 end |
#split_apostille_hash ⇒ Object
27 28 29 30 31 32 |
# File 'lib/nis/apostille_audit.rb', line 27 def split_apostille_hash [ @apostille_hash[0, 8], @apostille_hash[8, 1].to_i, @apostille_hash[9, 1].to_i, @apostille_hash[10, @apostille_hash.size] ] end |
#valid? ⇒ Boolean
17 18 19 20 21 |
# File 'lib/nis/apostille_audit.rb', line 17 def valid? raise 'Not implemented private apostille' if private? raise "Invalid checksum: #{@checksum}" unless @checksum == CHECKSUM @hash == calc_hash end |