Sha256: 616c6c4af031b3dc53b602792ac636a1c01e45d31885672d8537de679f7fbf9c

Contents?: true

Size: 701 Bytes

Versions: 4

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

require 'starcall/regions'

module Starcall
  module Helpers
    # 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 RegionParser
      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
starcall-0.6.0 lib/starcall/helpers/region_parser.rb
starcall-0.5.0 lib/starcall/helpers/region_parser.rb
starcall-0.4.0 lib/starcall/helpers/region_parser.rb
starcall-0.3.0 lib/starcall/helpers/region_parser.rb