Sha256: 35177d70fbba01109cc970926550bab28a748309c2ec757a44c8da2c28f4800e

Contents?: true

Size: 1.91 KB

Versions: 2

Compression:

Stored size: 1.91 KB

Contents

require 'isaca/helpers'

require 'isaca/requests/request'
require 'isaca/requests/authenticate_user'
require 'isaca/requests/get_user_by_id'
require 'isaca/requests/get_user_details_by_token'
require 'isaca/requests/submit_cpe'
require 'isaca/requests/log_out'

require 'isaca/models/authenticate_user'
require 'isaca/models/get_user_by_id'
require 'isaca/models/get_user_details_by_token'
require 'isaca/models/submit_cpe'

require 'isaca/version'
require 'openssl'

module ISACA
  class << self
    attr_accessor :configuration

    def configuration
      @configuration ||= Configuration.new
    end
  end

  def self.configure
    self.configuration ||= Configuration.new
    yield(configuration)
    self.configuration
  end

  class Configuration
    attr_accessor :url
    attr_accessor :secret_pass
    attr_accessor :user_agent
    attr_accessor :verify_ssl

    def initialize
      @verify_ssl = true
    end

    def secret_pass
      if @secret_pass
        @secret_pass
      else
        msg = 'Missing SecretPass configuration. The ISACA Partners API requires an assigned SecretPass.'
        msg << ' Example: ISACA.configure {|config| config.secret_pass = "MyPass"}'

        raise ConfigurationError.new(msg)
      end
    end

    def url
      if @url
        @url
      else
        msg = 'Missing URL configuration. The ISACA Partners API requires an endpoint URL.'
        msg << ' Example: ISACA.configure {|config| config.url = "https://partnerapi.isaca.org:8443/ISACAServices/Service1.svc"}'

        raise ConfigurationError.new(msg)
      end
    end
  end

  def user_agent
    if @user_agent
      @user_agent
    else
      msg = 'Missing User-Agent configuration. The ISACA Partners API requires a predefined User-Agent.'
      msg << ' Example: ISACA.configure {|config| config.user_agent = "MyApplication"}'

      raise ConfigurationError.new(msg)
    end
  end

  class ConfigurationError < StandardError; end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
isaca-0.1.6 lib/isaca.rb
isaca-0.1.5 lib/isaca.rb