Class: Saml::Kit::Cli::SignatureReport

Inherits:
Object
  • Object
show all
Defined in:
lib/saml/kit/cli/signature_report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, format:) ⇒ SignatureReport

Returns a new instance of SignatureReport.



9
10
11
12
13
14
15
16
17
18
# File 'lib/saml/kit/cli/signature_report.rb', line 9

def initialize(path, format:)
  @format = format
  @path = path
  if File.exist?(File.expand_path(path))
    @content = IO.read(File.expand_path(path))
  else
    uri = URI.parse(path)
    @content = Net::HTTP.get_response(uri).body.chomp
  end
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



7
8
9
# File 'lib/saml/kit/cli/signature_report.rb', line 7

def content
  @content
end

#formatObject (readonly)

Returns the value of attribute format.



7
8
9
# File 'lib/saml/kit/cli/signature_report.rb', line 7

def format
  @format
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/saml/kit/cli/signature_report.rb', line 7

def path
  @path
end

Instance Method Details



20
21
22
23
24
25
26
# File 'lib/saml/kit/cli/signature_report.rb', line 20

def print(shell)
  shell.say to_xml
  return shell.say_status :success, "#{path} is valid", :green if valid?
  errors.each { |error| shell.say_status(:error, error, :red) }
  return unless full?
  invalid_signatures.each { |x| shell.say(x.to_xml(indent: 2), :red) }
end