class Varanus::Reports

An connection to the Reports API. This should not be initialized directly. Instead, use Varanus#reports

Constants

SSL_CERT_STATUSES

Public Class Methods

new(varanus) click to toggle source

@note Do not call this directly. Use {Varanus#reports} to initialize

# File lib/varanus/reports.rb, line 17
def initialize varanus
  @varanus = varanus
end

Public Instance Methods

domains() click to toggle source

DEPRECATED: Please use Varanus::Domain#list_with_info instead.

# File lib/varanus/reports.rb, line 22
def domains
  warn 'DEPRECATION WARNING: Varanus::Reports#domains is deprecated.  ' \
       'Use Varanus::Domain#report instead'
  r = soap_call :get_domain_report, {}
  format_results r[:report_row_domains]
end
ssl(opts = {}) click to toggle source

DEPRECATED: Please use Varanus::SSL#report instead.

# File lib/varanus/reports.rb, line 30
def ssl opts = {}
  warn 'DEPRECATION WARNING: Varanus::Reports#ssl is deprecated.  ' \
       'Use Varanus::SSL#report instead'

  msg = { organizationNames: nil, certificateStatus: 0 }

  msg[:organizationNames] = Array(opts[:orgs]).join(',') if opts.include? :orgs
  if opts.include? :status
    msg[:certificateStatus] = SSL_CERT_STATUSES[opts[:status]]
    raise ArgumentError, 'Invalid status' if msg[:certificateStatus].nil?
  end

  r = soap_call :get_SSL_report, msg
  format_results r[:reports]
end

Private Instance Methods

format_results(results) click to toggle source
# File lib/varanus/reports.rb, line 48
def format_results results
  if results.is_a? Hash
    [results]
  else
    results.to_a
  end
end
savon() click to toggle source
# File lib/varanus/reports.rb, line 56
def savon
  @savon ||= Savon.client(
    namespace: 'http://report.ws.epki.comodo.com/',
    endpoint: 'https://cert-manager.com:443/ws/ReportService',
    log: false
  )
end
soap_call(func, opts = {}) click to toggle source
# File lib/varanus/reports.rb, line 64
def soap_call func, opts = {}
  msg = opts.dup
  msg[:authData] = { customerLoginUri: @varanus.customer_uri, login: @varanus.username,
                     password: @varanus.password }

  result = savon.call func, message: msg
  result.body[(func.to_s.downcase + '_response').to_sym][:return]
end