Sha256: 62116b4c50a95ee9ce17928c4d4d9b93ade804c939d22e712169a6a76ac1aa9f

Contents?: true

Size: 414 Bytes

Versions: 1

Compression:

Stored size: 414 Bytes

Contents

module Delhivery
  class Configuration
    attr_accessor :api_key, :production
    
    def initialize(opts = {})
      @api_key = opts[:api_key]
      @production = opts[:production] || false
    end

    def validate
      errors = []
      errors << "Invalid API Key" if @api_key.nil? || @api_key.empty? 
      unless errors.empty?
        raise ArgumentError, "#{errors.join(', ')}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
delhivery-0.1.1 lib/delhivery/configuration.rb