Class: Ip2locationRails

Inherits:
Object
  • Object
show all
Defined in:
lib/ip2location_rails.rb

Instance Method Summary collapse

Constructor Details

#initialize(ip_address) ⇒ Ip2locationRails

Returns a new instance of Ip2locationRails.



4
5
6
7
# File 'lib/ip2location_rails.rb', line 4

def initialize(ip_address)
    @ip_address = ip_address
    @i2l = Ip2location.new.open(Rails.configuration.ip2location_db_path)
end

Instance Method Details

#addresstypeObject



93
94
95
# File 'lib/ip2location_rails.rb', line 93

def addresstype
    location['addresstype']
end

#areacodeObject



49
50
51
# File 'lib/ip2location_rails.rb', line 49

def areacode
    location['areacode']
end

#asObject



109
110
111
# File 'lib/ip2location_rails.rb', line 109

def as
    location['as']
end

#asnObject



105
106
107
# File 'lib/ip2location_rails.rb', line 105

def asn
    location['asn']
end

#categoryObject



97
98
99
# File 'lib/ip2location_rails.rb', line 97

def category
    location['category']
end

#cityObject



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

def city
    location['city']
end

#country_codeObject



13
14
15
# File 'lib/ip2location_rails.rb', line 13

def country_code
    location['country_short']
end

#country_nameObject



17
18
19
# File 'lib/ip2location_rails.rb', line 17

def country_name
    location['country_long']
end

#districtObject



101
102
103
# File 'lib/ip2location_rails.rb', line 101

def district
    location['district']
end

#domainObject



41
42
43
# File 'lib/ip2location_rails.rb', line 41

def domain
    location['domain']
end

#elevationObject



85
86
87
# File 'lib/ip2location_rails.rb', line 85

def elevation
    location['elevation']
end

#iddcodeObject



53
54
55
# File 'lib/ip2location_rails.rb', line 53

def iddcode
    location['iddcode']
end

#ispObject



37
38
39
# File 'lib/ip2location_rails.rb', line 37

def isp
    location['isp']
end

#latitudeObject



29
30
31
# File 'lib/ip2location_rails.rb', line 29

def latitude
    location['latitude']
end

#locationObject



9
10
11
# File 'lib/ip2location_rails.rb', line 9

def location
    @i2l.get_all(@ip_address)
end

#longitudeObject



33
34
35
# File 'lib/ip2location_rails.rb', line 33

def longitude
    location['longitude']
end

#mccObject



73
74
75
# File 'lib/ip2location_rails.rb', line 73

def mcc
    location['mcc']
end

#mncObject



77
78
79
# File 'lib/ip2location_rails.rb', line 77

def mnc
    location['mnc']
end

#mobilebrandObject



81
82
83
# File 'lib/ip2location_rails.rb', line 81

def mobilebrand
    location['mobilebrand']
end

#netspeedObject



45
46
47
# File 'lib/ip2location_rails.rb', line 45

def netspeed
    location['netspeed']
end

#regionObject



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

def region
    location['region']
end

#timezoneObject



57
58
59
# File 'lib/ip2location_rails.rb', line 57

def timezone
    location['timezone']
end

#usagetypeObject



89
90
91
# File 'lib/ip2location_rails.rb', line 89

def usagetype
    location['usagetype']
end

#weatherstationcodeObject



69
70
71
# File 'lib/ip2location_rails.rb', line 69

def weatherstationcode
    location['weatherstationcode']
end

#weatherstationnameObject



65
66
67
# File 'lib/ip2location_rails.rb', line 65

def weatherstationname
    location['weatherstationname']
end

#zipcodeObject



61
62
63
# File 'lib/ip2location_rails.rb', line 61

def zipcode
    location['zipcode']
end