File: db_ip_com.rb

package info (click to toggle)
ruby-geocoder 1.8.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 900 kB
  • sloc: ruby: 8,419; makefile: 3
file content (58 lines) | stat: -rw-r--r-- 960 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require 'geocoder/results/base'

module Geocoder::Result
  class DbIpCom < Base

    def coordinates
      ['latitude', 'longitude'].map{ |coordinate_name| @data[coordinate_name] }
    end

    def city
      @data['city']
    end

    def district
      @data['district']
    end

    def state_code
      @data['stateProvCode']
    end
    alias_method :state, :state_code

    def zip_code
      @data['zipCode']
    end
    alias_method :postal_code, :zip_code

    def country_name
      @data['countryName']
    end
    alias_method :country, :country_name

    def country_code
      @data['countryCode']
    end

    def continent_name
      @data['continentName']
    end
    alias_method :continent, :continent_name

    def continent_code
      @data['continentCode']
    end

    def time_zone
      @data['timeZone']
    end

    def gmt_offset
      @data['gmtOffset']
    end

    def currency_code
      @data['currencyCode']
    end
  end
end