Class: LitleOnline::CustomBilling

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

Class Method Summary collapse

Class Method Details

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



825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
# File 'lib/XMLFields.rb', line 825

def self.from_hash(hash, name='customBilling')
  base = hash[name]
  if(base)
    this = CustomBilling.new
    this.phone = base['phone']
    this.city = base['city']
    this.url = base['url']
    this.descriptor = base['descriptor']
    SchemaValidation.validate_regex(this.phone, false, /\A\d{1,13}\Z/, name, 'phone')
    SchemaValidation.validate_length(this.city, false, 1, 35, name, 'city')
    SchemaValidation.validate_regex(this.url, false, /\A([A-Z,a-z,0-9,\/,\-,_,.]){1,13}\Z/, name, 'url')
    SchemaValidation.validate_regex(this.descriptor, false, /\A([A-Z,a-z,0-9, ,\*,,,\-,',#,&,.]){4,25}\Z/, name, 'descriptor')
    this
  else
    nil
  end
end