class TurkishCities

Constants

PHONE_CODE
PLATE_NUMBER
VERSION

Public Class Methods

change_locale(language_code) click to toggle source
# File lib/turkish_cities.rb, line 17
def self.change_locale(language_code)
  if %w[en tr].include?(language_code)
    I18n.locale = language_code.to_sym
    return I18n.t('language.success')
  end
  I18n.t('language.errors.unsupported_language_code')
end
distance_between(from, to, travel_method) click to toggle source
# File lib/turkish_cities.rb, line 49
def self.distance_between(from, to, travel_method)
  Distance.new(from, to, travel_method).distance_between
end
find_by_postcode(postcode) click to toggle source
# File lib/turkish_cities.rb, line 61
def self.find_by_postcode(postcode)
  Postcode.new.find_by_postcode(postcode)
end
find_name_by_phone_code(phone_code) click to toggle source
# File lib/turkish_cities.rb, line 29
def self.find_name_by_phone_code(phone_code)
  City.new.find_by_phone_code(phone_code)
end
find_name_by_plate_number(plate_number) click to toggle source
# File lib/turkish_cities.rb, line 25
def self.find_name_by_plate_number(plate_number)
  City.new.find_by_id(plate_number)
end
find_phone_code_by_name(city_name) click to toggle source
# File lib/turkish_cities.rb, line 37
def self.find_phone_code_by_name(city_name)
  City.new.find_by_name(city_name, self::PHONE_CODE)
end
find_plate_number_by_name(city_name) click to toggle source
# File lib/turkish_cities.rb, line 33
def self.find_plate_number_by_name(city_name)
  City.new.find_by_name(city_name, self::PLATE_NUMBER)
end
list_cities(options = {}) click to toggle source
# File lib/turkish_cities.rb, line 41
def self.list_cities(options = {})
  City.new.list_cities(options)
end
list_districts(city_name) click to toggle source
# File lib/turkish_cities.rb, line 45
def self.list_districts(city_name)
  City.new.list_districts(city_name)
end
list_neighborhoods(city_name, district_name, subdistrict_name = nil) click to toggle source
# File lib/turkish_cities.rb, line 57
def self.list_neighborhoods(city_name, district_name, subdistrict_name = nil)
  District.new(city_name, district_name).neighborhoods(subdistrict_name)
end
list_subdistricts(city_name, district_name) click to toggle source
# File lib/turkish_cities.rb, line 53
def self.list_subdistricts(city_name, district_name)
  District.new(city_name, district_name).subdistricts
end