Class: Geocoder::Result::MaxmindLocal

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

Instance Attribute Summary

Attributes inherited from Base

#cache_hit, #data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#address, #initialize, #latitude, #longitude, #province, #province_code

Constructor Details

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

Class Method Details

.response_attributesObject



34
35
36
# File 'lib/geocoder/results/maxmind_local.rb', line 34

def self.response_attributes
  %w[ip]
end

Instance Method Details

#cityObject



10
11
12
# File 'lib/geocoder/results/maxmind_local.rb', line 10

def city
  @data[:city_name]
end

#coordinatesObject



6
7
8
# File 'lib/geocoder/results/maxmind_local.rb', line 6

def coordinates
  [@data[:latitude], @data[:longitude]]
end

#countryObject



22
23
24
# File 'lib/geocoder/results/maxmind_local.rb', line 22

def country
  @data[:country_name]
end

#country_codeObject



26
27
28
# File 'lib/geocoder/results/maxmind_local.rb', line 26

def country_code
  @data[:country_code2]
end

#postal_codeObject



30
31
32
# File 'lib/geocoder/results/maxmind_local.rb', line 30

def postal_code
  @data[:postal_code]
end

#stateObject



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

def state
  @data[:region_name]
end

#state_codeObject



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

def state_code
  "" # Not available in Maxmind's database
end