Class: Starcall::Regions

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

Overview

This class is used to list and validate regions.

Class Method Summary collapse

Class Method Details

.listObject

A list of valid Riot Regions.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/starcall/regions.rb', line 7

def self.list
  [
    'br',   # Brazil
    'eune', # EU North East
    'euw',  # EU West
    'lan',  # Latin America North
    'las',  # Latin America South
    'na',   # North America
    'oce',  # Oceania
    'ru',   # Russia
    'tr',   # Turkey
    'jp',   # Japan
    'kr'    # Korea
  ]
end

.valid?(region:) ⇒ Boolean

A method to check is the region is valid, if not, raise an error.

Returns:

  • (Boolean)

Raises:



24
25
26
27
28
# File 'lib/starcall/regions.rb', line 24

def self.valid?(region:)
  return true if list.include? region

  raise Starcall::Errors::InvalidRegion.new(region: region)
end