module SslLabs::Api

Constants

LOCATION

Base URI for the API.

METHODS

Array of known methods.

Public Class Methods

url(method, args={}) click to toggle source

Return the API URL for the given method and arguments.

# File lib/ssl_labs/api.rb, line 19
def self.url(method, args={})
  raise ArgumentError, "Unknown method #{method.inspect}" unless METHODS.include?(method)
  camelized_method = Util::camelize(method)
  query = if args.empty?
            ''
          else
            '?' << args.map do |k, v|
              "#{Util.camelize(k)}=#{v}"
            end.join('&') # XXX escaping
          end
  "#{LOCATION}/#{camelized_method}#{query}"
end