Module: ActiveMerchant::Validateable

Included in:
Billing::Check, Billing::CreditCard, Billing::OrbitalSoftDescriptors
Defined in:
lib/active_merchant/common/validateable.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Errors

Instance Method Summary collapse

Instance Method Details

#errorsObject



16
17
18
# File 'lib/active_merchant/common/validateable.rb', line 16

def errors
  @errors ||= Errors.new(self)
end

#initialize(attributes = {}) ⇒ Object



12
13
14
# File 'lib/active_merchant/common/validateable.rb', line 12

def initialize(attributes = {})
  self.attributes = attributes
end

#valid?Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
# File 'lib/active_merchant/common/validateable.rb', line 3

def valid?
  errors.clear

  before_validate if respond_to?(:before_validate, true)
  validate if respond_to?(:validate, true)

  errors.empty?
end