Class: ForemanX509::Builder
- Inherits:
-
Object
- Object
- ForemanX509::Builder
- Defined in:
- app/services/foreman_x509/builder.rb
Instance Attribute Summary collapse
-
#activate ⇒ Object
Returns the value of attribute activate.
-
#generation ⇒ Object
readonly
Returns the value of attribute generation.
-
#issuer ⇒ Object
readonly
Returns the value of attribute issuer.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(subject, **options) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(subject, **options) ⇒ Builder
Returns a new instance of Builder.
10 11 12 13 14 15 16 |
# File 'app/services/foreman_x509/builder.rb', line 10 def initialize(subject, **) @subject = subject @issuer = subject.issuer @issuer ||= Issuer.new(certificate: subject) if subject.can_self_sign? @activate = .fetch(:activate, true) end |
Instance Attribute Details
#activate ⇒ Object
Returns the value of attribute activate.
8 9 10 |
# File 'app/services/foreman_x509/builder.rb', line 8 def activate @activate end |
#generation ⇒ Object (readonly)
Returns the value of attribute generation.
7 8 9 |
# File 'app/services/foreman_x509/builder.rb', line 7 def generation @generation end |
#issuer ⇒ Object (readonly)
Returns the value of attribute issuer.
7 8 9 |
# File 'app/services/foreman_x509/builder.rb', line 7 def issuer @issuer end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
7 8 9 |
# File 'app/services/foreman_x509/builder.rb', line 7 def request @request end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
7 8 9 |
# File 'app/services/foreman_x509/builder.rb', line 7 def subject @subject end |
Class Method Details
.create(subject) ⇒ Object
3 4 5 |
# File 'app/services/foreman_x509/builder.rb', line 3 def self.create(subject) new(subject).create end |
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/services/foreman_x509/builder.rb', line 18 def create @generation = subject.generations.create(key: key) if issuer build_certificate generation.update(certificate: certificate, active: activate) else @request = Request.create(certificate: @subject, generation: @generation) end generation end |