Class: Mantra::Certificate::DigitalCertificate

Inherits:
Object
  • Object
show all
Defined in:
lib/mantra/certificate.rb

Constant Summary collapse

TEMPLATE_MESSAGE =
"Difital Certificate from file:"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ DigitalCertificate

Returns a new instance of DigitalCertificate.



6
7
8
9
10
# File 'lib/mantra/certificate.rb', line 6

def initialize(options)
  self.path  = options[:path]
  self.type  = options[:type].strip
  self.value = options[:value].strip
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/mantra/certificate.rb', line 5

def path
  @path
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/mantra/certificate.rb', line 5

def type
  @type
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/mantra/certificate.rb', line 5

def value
  @value
end

Instance Method Details

#certificate?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/mantra/certificate.rb', line 20

def certificate?
  self.type == "CERTIFICATE"
end

#private_key?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/mantra/certificate.rb', line 12

def private_key?
  self.type.include? "PRIVATE KEY"
end

#public_key?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/mantra/certificate.rb', line 16

def public_key?
  self.type == "PUBLIC KEY"
end

#scopeObject



24
25
26
# File 'lib/mantra/certificate.rb', line 24

def scope
  self.path.to_scope
end