Class: OnlinePayments::SDK::Domain::PaymentProductFieldValidators

Inherits:
DataObject
  • Object
show all
Defined in:
lib/onlinepayments/sdk/domain/payment_product_field_validators.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#email_addressOnlinePayments::SDK::Domain::EmptyValidator



23
24
25
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 23

def email_address
  @email_address
end

#expiration_dateOnlinePayments::SDK::Domain::EmptyValidator



23
24
25
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 23

def expiration_date
  @expiration_date
end

#fixed_listOnlinePayments::SDK::Domain::FixedListValidator



23
24
25
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 23

def fixed_list
  @fixed_list
end

#ibanOnlinePayments::SDK::Domain::EmptyValidator



23
24
25
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 23

def iban
  @iban
end

#lengthOnlinePayments::SDK::Domain::LengthValidator



23
24
25
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 23

def length
  @length
end

#luhnOnlinePayments::SDK::Domain::EmptyValidator



23
24
25
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 23

def luhn
  @luhn
end

#rangeOnlinePayments::SDK::Domain::RangeValidator



23
24
25
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 23

def range
  @range
end

#regular_expressionOnlinePayments::SDK::Domain::RegularExpressionValidator



23
24
25
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 23

def regular_expression
  @regular_expression
end

#terms_and_conditionsOnlinePayments::SDK::Domain::EmptyValidator



23
24
25
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 23

def terms_and_conditions
  @terms_and_conditions
end

Instance Method Details

#from_hash(hash) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 58

def from_hash(hash)
  super
  if hash.has_key? 'emailAddress'
    raise TypeError, "value '%s' is not a Hash" % [hash['emailAddress']] unless hash['emailAddress'].is_a? Hash
    @email_address = OnlinePayments::SDK::Domain::EmptyValidator.new_from_hash(hash['emailAddress'])
  end
  if hash.has_key? 'expirationDate'
    raise TypeError, "value '%s' is not a Hash" % [hash['expirationDate']] unless hash['expirationDate'].is_a? Hash
    @expiration_date = OnlinePayments::SDK::Domain::EmptyValidator.new_from_hash(hash['expirationDate'])
  end
  if hash.has_key? 'fixedList'
    raise TypeError, "value '%s' is not a Hash" % [hash['fixedList']] unless hash['fixedList'].is_a? Hash
    @fixed_list = OnlinePayments::SDK::Domain::FixedListValidator.new_from_hash(hash['fixedList'])
  end
  if hash.has_key? 'iban'
    raise TypeError, "value '%s' is not a Hash" % [hash['iban']] unless hash['iban'].is_a? Hash
    @iban = OnlinePayments::SDK::Domain::EmptyValidator.new_from_hash(hash['iban'])
  end
  if hash.has_key? 'length'
    raise TypeError, "value '%s' is not a Hash" % [hash['length']] unless hash['length'].is_a? Hash
    @length = OnlinePayments::SDK::Domain::LengthValidator.new_from_hash(hash['length'])
  end
  if hash.has_key? 'luhn'
    raise TypeError, "value '%s' is not a Hash" % [hash['luhn']] unless hash['luhn'].is_a? Hash
    @luhn = OnlinePayments::SDK::Domain::EmptyValidator.new_from_hash(hash['luhn'])
  end
  if hash.has_key? 'range'
    raise TypeError, "value '%s' is not a Hash" % [hash['range']] unless hash['range'].is_a? Hash
    @range = OnlinePayments::SDK::Domain::RangeValidator.new_from_hash(hash['range'])
  end
  if hash.has_key? 'regularExpression'
    raise TypeError, "value '%s' is not a Hash" % [hash['regularExpression']] unless hash['regularExpression'].is_a? Hash
    @regular_expression = OnlinePayments::SDK::Domain::RegularExpressionValidator.new_from_hash(hash['regularExpression'])
  end
  if hash.has_key? 'termsAndConditions'
    raise TypeError, "value '%s' is not a Hash" % [hash['termsAndConditions']] unless hash['termsAndConditions'].is_a? Hash
    @terms_and_conditions = OnlinePayments::SDK::Domain::EmptyValidator.new_from_hash(hash['termsAndConditions'])
  end
end

#to_hHash



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/onlinepayments/sdk/domain/payment_product_field_validators.rb', line 44

def to_h
  hash = super
  hash['emailAddress'] = @email_address.to_h unless @email_address.nil?
  hash['expirationDate'] = @expiration_date.to_h unless @expiration_date.nil?
  hash['fixedList'] = @fixed_list.to_h unless @fixed_list.nil?
  hash['iban'] = @iban.to_h unless @iban.nil?
  hash['length'] = @length.to_h unless @length.nil?
  hash['luhn'] = @luhn.to_h unless @luhn.nil?
  hash['range'] = @range.to_h unless @range.nil?
  hash['regularExpression'] = @regular_expression.to_h unless @regular_expression.nil?
  hash['termsAndConditions'] = @terms_and_conditions.to_h unless @terms_and_conditions.nil?
  hash
end