Class: Ingenico::Connect::SDK::Domain::Product::PaymentProductFieldValidators

Inherits:
Ingenico::Connect::SDK::DataObject show all
Defined in:
lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ingenico::Connect::SDK::DataObject

new_from_hash

Instance Attribute Details

#email_addressObject



20
21
22
# File 'lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb', line 20

def email_address
  @email_address
end

#expiration_dateObject



23
24
25
# File 'lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb', line 23

def expiration_date
  @expiration_date
end

#fixed_listObject



26
27
28
# File 'lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb', line 26

def fixed_list
  @fixed_list
end

#lengthObject



29
30
31
# File 'lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb', line 29

def length
  @length
end

#luhnObject



32
33
34
# File 'lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb', line 32

def luhn
  @luhn
end

#rangeObject



35
36
37
# File 'lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb', line 35

def range
  @range
end

#regular_expressionObject



38
39
40
# File 'lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb', line 38

def regular_expression
  @regular_expression
end

Instance Method Details

#from_hash(hash) ⇒ Object



52
53
54
55
56
57
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/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb', line 52

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

#to_hObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb', line 40

def to_h
  hash = super
  add_to_hash(hash, 'emailAddress', @email_address)
  add_to_hash(hash, 'expirationDate', @expiration_date)
  add_to_hash(hash, 'fixedList', @fixed_list)
  add_to_hash(hash, 'length', @length)
  add_to_hash(hash, 'luhn', @luhn)
  add_to_hash(hash, 'range', @range)
  add_to_hash(hash, 'regularExpression', @regular_expression)
  hash
end