Module: RegionLookup

Defined in:
lib/region_lookup.rb,
lib/region_lookup/query.rb,
lib/region_lookup/loader.rb,
lib/region_lookup/version.rb

Defined Under Namespace

Modules: Loader, Query Classes: Error

Constant Summary collapse

VERSION =
"0.1.5"

Class Method Summary collapse

Class Method Details

.cities(country_code) ⇒ Object



20
21
22
23
# File 'lib/region_lookup.rb', line 20

def self.cities(country_code)
  Query.cities(country_code)
rescue => e
end

.cities_based_on_state_name(country_code, state_name) ⇒ Object



25
26
27
28
# File 'lib/region_lookup.rb', line 25

def self.cities_based_on_state_name(country_code, state_name)
  Query.cities_based_on_state_name(country_code, state_name)
rescue => e
end

.countriesObject



11
12
13
# File 'lib/region_lookup.rb', line 11

def self.countries
  Query.countries
end

.get_city(country_code, city_name) ⇒ Object



30
31
32
33
# File 'lib/region_lookup.rb', line 30

def self.get_city(country_code, city_name)
  cities(country_code).find{ |city| city['name'] == city_name }
rescue => e
end

.get_country(country_code) ⇒ Object



35
36
37
38
# File 'lib/region_lookup.rb', line 35

def self.get_country(country_code)
  countries.find{ |country| country['iso2'] == country_code }
rescue => e
end

.states(country_code) ⇒ Object



15
16
17
18
# File 'lib/region_lookup.rb', line 15

def self.states(country_code)
  Query.states(country_code)
rescue => e
end