class RestPki::DigestAlgorithmAndValue

Attributes

algorithm[R]
value[R]

Public Class Methods

new(model) click to toggle source
# File lib/rest_pki/digest_algorithm_and_value.rb, line 7
def initialize(model)
    if model['algorithm'].to_s.blank?
        raise 'The algorithm was not set'
    end
    if model['value'].to_s.blank?
        raise 'The value was not set'
    end
    @algorithm = DigestAlgorithm.get_instance_by_api_model(model['algorithm'])
    @value = Base64.decode64(model['value'])
end

Public Instance Methods

hex_value() click to toggle source
# File lib/rest_pki/digest_algorithm_and_value.rb, line 18
def hex_value
    @value.each_byte.map { |b| b.to_s(16) }.join
end
to_model() click to toggle source
# File lib/rest_pki/digest_algorithm_and_value.rb, line 22
def to_model
    {
       algorithm: @algorithm.api_model,
       value: @value
    }
end