Class: Starcall::Helpers::RegionParser

Inherits:
Object
  • Object
show all
Defined in:
lib/starcall/helpers/region_parser.rb

Overview

The API URLs don’t use the actual region name, they used different ones. This converts from a region name to the URL string.

Class Method Summary collapse

Class Method Details

.parse(region:) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/starcall/helpers/region_parser.rb', line 10

def self.parse(region:)
  Starcall::Regions.valid?(region: region)

  region_matchup = {
    br: 'br1',
    eune: 'eun1',
    euw: 'euw1',
    lan: 'la1',
    las: 'la2',
    na: 'na1',
    oce: 'oc1',
    ru: 'ru',
    tr: 'tr1',
    jp: 'jp1',
    kr: 'kr'
  }
  region_matchup[region.to_sym]
end