Top Level Namespace

Defined Under Namespace

Modules: Brawlstars

Instance Method Summary collapse

Instance Method Details

#cleanTag(tag) ⇒ Object


7
8
9
# File 'lib/brawlstars/validation.rb', line 7

def cleanTag(tag)
  tag.upcase.delete("#").gsub("O", "0")
end

#validateRegion(region) ⇒ Object


3
4
5
# File 'lib/brawlstars/validation.rb', line 3

def validateRegion(region)
  raise Brawlstars::Error::RegionError if (region != "global" and regionCodes.include? region.upcase)
end

#validateTag(tag) ⇒ Object


11
12
13
14
15
# File 'lib/brawlstars/validation.rb', line 11

def validateTag(tag)
  tag = cleanTag(tag)
  raise Brawlstars::Error::TagError if (!tag.match(/^[0289CGJLPQRUVY]+$/) or tag.length < 3)
  tag
end