Module: CDEKApiClient::Entities::Validatable::ClassMethods

Defined in:
lib/cdek_api_client/entities/validatable.rb

Overview

Class methods for the Validatable module.

Instance Method Summary collapse

Instance Method Details

#validates(attribute, options) ⇒ Object

Defines validations for attributes.

Options Hash (options):

  • :type (Symbol)

    the expected type of the attribute.

  • :presence (Boolean)

    whether the attribute is required.

[View source]

21
22
23
24
# File 'lib/cdek_api_client/entities/validatable.rb', line 21

def validates(attribute, options)
  @validations ||= {}
  @validations[attribute] = options
end

#validationsHash

Returns the defined validations.

[View source]

29
30
31
# File 'lib/cdek_api_client/entities/validatable.rb', line 29

def validations
  @validations
end