Class: OnlinePayments::SDK::Domain::LengthValidator

Inherits:
OnlinePayments::SDK::DataObject show all
Defined in:
lib/onlinepayments/sdk/domain/length_validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OnlinePayments::SDK::DataObject

new_from_hash

Instance Attribute Details

#max_lengthInteger

Returns the current value of max_length.

Returns:

  • (Integer)

    the current value of max_length



11
12
13
# File 'lib/onlinepayments/sdk/domain/length_validator.rb', line 11

def max_length
  @max_length
end

#min_lengthInteger

Returns the current value of min_length.

Returns:

  • (Integer)

    the current value of min_length



11
12
13
# File 'lib/onlinepayments/sdk/domain/length_validator.rb', line 11

def min_length
  @min_length
end

Instance Method Details

#from_hash(hash) ⇒ Object



23
24
25
26
27
# File 'lib/onlinepayments/sdk/domain/length_validator.rb', line 23

def from_hash(hash)
  super
  @max_length = hash['maxLength'] if hash.key? 'maxLength'
  @min_length = hash['minLength'] if hash.key? 'minLength'
end

#to_hHash

Returns:

  • (Hash)


16
17
18
19
20
21
# File 'lib/onlinepayments/sdk/domain/length_validator.rb', line 16

def to_h
  hash = super
  hash['maxLength'] = @max_length unless @max_length.nil?
  hash['minLength'] = @min_length unless @min_length.nil?
  hash
end