class SmartId::AuthenticationCertificate::Content

Public Class Methods

new(raw_content) click to toggle source
# File lib/smart_id/authentication_certificate/content.rb, line 4
def initialize(raw_content)
  @raw_content = raw_content
end

Public Instance Methods

all_info() click to toggle source
# File lib/smart_id/authentication_certificate/content.rb, line 20
def all_info
  structured_raw_content["CN"]
end
country() click to toggle source
# File lib/smart_id/authentication_certificate/content.rb, line 16
def country
  structured_raw_content["C"].gsub(",", " ")
end
given_name() click to toggle source
# File lib/smart_id/authentication_certificate/content.rb, line 8
def given_name
  structured_raw_content["GN"].gsub(",", " ")
end
organizational_unit() click to toggle source
# File lib/smart_id/authentication_certificate/content.rb, line 24
def organizational_unit
  structured_raw_content["OU"]
end
serial_number() click to toggle source
# File lib/smart_id/authentication_certificate/content.rb, line 28
def serial_number
  structured_raw_content["serialNumber"]
end
surname() click to toggle source
# File lib/smart_id/authentication_certificate/content.rb, line 12
def surname
  structured_raw_content["SN"].gsub(",", " ")
end

Private Instance Methods

structured_raw_content() click to toggle source
# File lib/smart_id/authentication_certificate/content.rb, line 34
def structured_raw_content
  return @structured_raw_content if @structured_raw_content
  @structured_raw_content = @raw_content.split("/").each_with_object({}) do |c, result|
    if c.include?("=")
      key, val = c.split("=")
      result[key] = val
    end
  end
end