Class: LitleOnline::CardToken

Inherits:
Object
  • Object
show all
Includes:
XML::Mapping
Defined in:
lib/XMLFields.rb

Class Method Summary collapse

Class Method Details

.from_hash(hash, name = 'cardToken') ⇒ Object



735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
# File 'lib/XMLFields.rb', line 735

def self.from_hash(hash, name='cardToken')
  base = hash[name]
  if(base)
    this = CardToken.new
    this.litleToken = base['litleToken']
    this.expDate = base['expDate']
    this.cardValidationNum = base['cardValidationNum']
    this.mop = base['type']
    SchemaValidation.validate_length(this.litleToken, true, 13, 25, name, 'litleToken')
    SchemaValidation.validate_length(this.expDate, false, 4, 4, name, 'expDate')
    SchemaValidation.validate_length(this.cardValidationNum, false, 1, 4, name, 'cardValidationNum')
    SchemaValidation.validate_enum(this.mop, false, ['','MC','VI','AX','DC','DI','PP','JC','BL','EC'], name, 'type')
    this
  else
    nil
  end
end