Class: Geocoder::Result::UkOrdnanceSurveyNames

Inherits:
Base
  • Object
show all
Defined in:
lib/geocoder/results/uk_ordnance_survey_names.rb

Instance Attribute Summary

Attributes inherited from Base

#cache_hit, #data

Instance Method Summary collapse

Methods inherited from Base

#address, #initialize, #latitude, #longitude

Constructor Details

This class inherits a constructor from Geocoder::Result::Base

Instance Method Details

#cityObject



14
15
16
# File 'lib/geocoder/results/uk_ordnance_survey_names.rb', line 14

def city
  is_postcode? ? data['DISTRICT_BOROUGH'] : data['NAME1']
end

#coordinatesObject



7
8
9
10
11
12
# File 'lib/geocoder/results/uk_ordnance_survey_names.rb', line 7

def coordinates
  @coordinates ||= Geocoder::EastingNorthing.new(
    easting: data['GEOMETRY_X'],
    northing: data['GEOMETRY_Y'],
  ).lat_lng
end

#countryObject



40
41
42
# File 'lib/geocoder/results/uk_ordnance_survey_names.rb', line 40

def country
  'United Kingdom'
end

#country_codeObject



44
45
46
# File 'lib/geocoder/results/uk_ordnance_survey_names.rb', line 44

def country_code
  'UK'
end

#countyObject Also known as: state



18
19
20
# File 'lib/geocoder/results/uk_ordnance_survey_names.rb', line 18

def county
  data['COUNTY_UNITARY']
end

#county_codeObject Also known as: state_code



23
24
25
# File 'lib/geocoder/results/uk_ordnance_survey_names.rb', line 23

def county_code
  code_from_uri data['COUNTY_UNITARY_URI']
end

#postal_codeObject



36
37
38
# File 'lib/geocoder/results/uk_ordnance_survey_names.rb', line 36

def postal_code
  is_postcode? ? data['NAME1'] : ''
end

#provinceObject



28
29
30
# File 'lib/geocoder/results/uk_ordnance_survey_names.rb', line 28

def province
  data['REGION']
end

#province_codeObject



32
33
34
# File 'lib/geocoder/results/uk_ordnance_survey_names.rb', line 32

def province_code
  code_from_uri data['REGION_URI']
end