Class: Ingenico::Direct::SDK::Domain::PaymentProductFieldDataRestrictions

Inherits:
Ingenico::Direct::SDK::DataObject show all
Defined in:
lib/ingenico/direct/sdk/domain/payment_product_field_data_restrictions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ingenico::Direct::SDK::DataObject

new_from_hash

Instance Attribute Details

#is_requiredtrue/false

Returns the current value of is_required.

Returns:

  • (true/false)

    the current value of is_required



13
14
15
# File 'lib/ingenico/direct/sdk/domain/payment_product_field_data_restrictions.rb', line 13

def is_required
  @is_required
end

#validatorsIngenico::Direct::SDK::Domain::PaymentProductFieldValidators

Returns the current value of validators.

Returns:



13
14
15
# File 'lib/ingenico/direct/sdk/domain/payment_product_field_data_restrictions.rb', line 13

def validators
  @validators
end

Instance Method Details

#from_hash(hash) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/ingenico/direct/sdk/domain/payment_product_field_data_restrictions.rb', line 25

def from_hash(hash)
  super
  @is_required = hash['isRequired'] if hash.key? 'isRequired'
  if hash.key? 'validators'
    raise TypeError, "value '%s' is not a Hash" % [hash['validators']] unless hash['validators'].is_a? Hash
    @validators = Ingenico::Direct::SDK::Domain::PaymentProductFieldValidators.new_from_hash(hash['validators'])
  end
end

#to_hHash

Returns:

  • (Hash)


18
19
20
21
22
23
# File 'lib/ingenico/direct/sdk/domain/payment_product_field_data_restrictions.rb', line 18

def to_h
  hash = super
  hash['isRequired'] = @is_required unless @is_required.nil?
  hash['validators'] = @validators.to_h if @validators
  hash
end