Sha256: d3cf073f487ae65b31f1674f7abfbbf1c4cd6d5933eba289c903c6f7f819255c

Contents?: true

Size: 781 Bytes

Versions: 2

Compression:

Stored size: 781 Bytes

Contents

module XFTP
  module Validator
    # Connection settings validator
    # @api private
    class Settings
      include Errors

      # Validates the given connection settings
      # @param [URI] uri the remote uri
      # @param [Hash] settings the session connection settings
      # @raise [XFTP::MissingArgument] if some of the required settings are missing
      def call!(uri, settings)
        validate_credentials!(settings[:credentials]) if uri.scheme == 'ftps'
      end

      private

      def validate_credentials!(credentials)
        missing_setting!(:credentials) unless credentials.present?
        missing_setting!(:login) unless credentials[:login].present?
        missing_setting!(:password) unless credentials[:password].present?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xftp-0.2.0.pre.alpha lib/xftp/validator/settings.rb
xftp-0.1.0.pre.alpha lib/xftp/validator/settings.rb