Class: LitleOnline::UpdateDiscount

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

Class Method Summary collapse

Class Method Details

.from_hash(hash, index = 0, name = "updateDiscount") ⇒ Object



1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
# File 'lib/XMLFields.rb', line 1116

def self.from_hash(hash,index=0, name="updateDiscount")
  base = hash[name][index]
  if(base)
    this = UpdateDiscount.new
    this.discountCode = base['discountCode']
    this.name = base['name']
    this.amount = base['amount']
    this.startDate = base['startDate']
    this.endDate = base['endDate']
    SchemaValidation.validate_length(this.discountCode, true, 1, 25, name, 'discountCode')
    SchemaValidation.validate_length(this.name, false, 1, 100, name, "name")
    SchemaValidation.validate_size(this.amount,false,0,999999999999,name,'amount')
    SchemaValidation.validate_date(this.startDate, false, name, 'startDate')
    SchemaValidation.validate_date(this.endDate, false, name, 'endDate')
    this
  end
end