Class: LitleOnline::CreateDiscount

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 = "createDiscount") ⇒ Object



999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
# File 'lib/XMLFields.rb', line 999

def self.from_hash(hash,index=0, name="createDiscount")
  base = hash[name][index]
  if(base)
    this = CreateDiscount.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, true, 1, 100, name, "name")
    SchemaValidation.validate_size(this.amount,true,0,999999999999,name,'amount')
    SchemaValidation.validate_date(this.startDate, true, name, 'startDate')
    SchemaValidation.validate_date(this.endDate, true, name, 'endDate')
    this
  end
end