Class: NubankSdk::Certificate
- Inherits:
-
Object
- Object
- NubankSdk::Certificate
- Defined in:
- lib/nubank_sdk/certificate.rb
Overview
Controller of certifications
Constant Summary collapse
- FILES_PATH =
'./certificates/'
Instance Method Summary collapse
-
#encoded ⇒ OpenSSL::PKCS12
Load the certificate file.
-
#initialize(cpf) ⇒ Certificate
constructor
Controller of certifications.
-
#process_decoded(key, certificate) ⇒ File
Create a certificate file.
Constructor Details
#initialize(cpf) ⇒ Certificate
Controller of certifications
16 17 18 |
# File 'lib/nubank_sdk/certificate.rb', line 16 def initialize(cpf) @cpf = cpf end |
Instance Method Details
#encoded ⇒ OpenSSL::PKCS12
Load the certificate file
38 39 40 |
# File 'lib/nubank_sdk/certificate.rb', line 38 def encoded @encoded ||= OpenSSL::PKCS12.new(file.read, 'password') end |
#process_decoded(key, certificate) ⇒ File
Create a certificate file
27 28 29 30 31 32 |
# File 'lib/nubank_sdk/certificate.rb', line 27 def process_decoded(key, certificate) encoded = encode certificate p12 = create_pkcs12_from(key, encoded) save p12 end |