Sha256: f5d1f9c1836bd134846b02e3199b979e39d926ed91571550b7af035ee8e0605a

Contents?: true

Size: 574 Bytes

Versions: 2

Compression:

Stored size: 574 Bytes

Contents

module Securetrading
  class ConfigurationError < StandardError; end
  class Configuration
    attr_accessor :user, :password
    attr_writer :site_reference

    def site_reference
      return @site_reference if @site_reference.present?
      fail ConfigurationError, 'Site reference is required!'
    end

    def auth
      return @auth if @auth.present?
      if user.present? && password.present?
        @auth ||= Base64.encode64("#{user}:#{password}")
      else
        fail ConfigurationError, 'User and password or auth are required!'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
securetrading-0.2.0 lib/securetrading/configuration.rb
securetrading-0.1.0 lib/securetrading/configuration.rb