Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save theterminalguy/e3f9800142ff6905647e6d8bb3ae0af3 to your computer and use it in GitHub Desktop.
Save theterminalguy/e3f9800142ff6905647e6d8bb3ae0af3 to your computer and use it in GitHub Desktop.
Area
Postcode
State
Street
Town
Zone
namespace :urban do
[
# returns all the state in Nigeria
# in the format below
'/states',
[
{
id: 1,
code: "AB",
name: "Abia",
capital: "Umuahia",
lat: 5.4308921,
lng: 7.5247243,
zone_id: 4
},
{....}
],
# returns a single state info
# params id or state_code
# e.g states/1 or states/ab
'states/:id|:state_code/',
# returns all states in Nigeria
# that matches the criteria
# params zone_id or zone_code
# e.g. states/zone/4 or states/zone/nc
'states/:zone_id|:zone_code',
# returns all town in the urban region
# or a state
# params state_id
'states/:state_id/urban/towns',
# returns a single town in the urban region
# of a state
# params state_id, town_id
'states/:state_id/urban/towns/:town_id',
# returns all lgas in the rural region
# of a state
# params state_id
'states/:state_id/rural/lgas/',
# returns a single lga in the rural region
# of a state
# params state_id, lga_id
'states/:state_id/rural/lgas/:lga_id',
# returns all the areas in the urban region
# of a state
# params state_id
'states/:state_id/urban/areas',
# returns a single area inthe urban region of a state
# params state_id, area_id
'states/:state_id/urban/areas/:area_id'
# returns all the streets in the urban region
# of a state
# params state_id
'states/:state_id/urban/streets'
# returns a single street in the urban region
# of a state
# params state_id, street_id
'states/:state_id/urban/streets/:street_id'
# returns all districts in the rural region
# of a state
# params state_id
'states/:state_id/rural/districts'
# returns a single district in the rural region
# of a state
# params state_id, district_id
'states/:state_id/rural/districts/:district_id'
# returns all towns in the rural region of a state
# params state_id
'states/:state_id/rural/towns'
# returns a single town in the rural region of a state
# params state_id, town_id
'states/:state_id/rural/towns/:town_id'
]
end
namespace :rural do
RuralDistrict
RuralLga
RuralPostCode
RuralTown
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment