Class: Ip2locationRails
- Inherits:
-
Object
- Object
- Ip2locationRails
- Defined in:
- lib/ip2location_rails.rb
Instance Method Summary collapse
- #addresstype ⇒ Object
- #areacode ⇒ Object
- #as ⇒ Object
- #asn ⇒ Object
- #category ⇒ Object
- #city ⇒ Object
- #country_code ⇒ Object
- #country_name ⇒ Object
- #district ⇒ Object
- #domain ⇒ Object
- #elevation ⇒ Object
- #iddcode ⇒ Object
-
#initialize(ip_address) ⇒ Ip2locationRails
constructor
A new instance of Ip2locationRails.
- #isp ⇒ Object
- #latitude ⇒ Object
- #location ⇒ Object
- #longitude ⇒ Object
- #mcc ⇒ Object
- #mnc ⇒ Object
- #mobilebrand ⇒ Object
- #netspeed ⇒ Object
- #region ⇒ Object
- #timezone ⇒ Object
- #usagetype ⇒ Object
- #weatherstationcode ⇒ Object
- #weatherstationname ⇒ Object
- #zipcode ⇒ Object
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
#addresstype ⇒ Object
93 94 95 |
# File 'lib/ip2location_rails.rb', line 93 def addresstype location['addresstype'] end |
#areacode ⇒ Object
49 50 51 |
# File 'lib/ip2location_rails.rb', line 49 def areacode location['areacode'] end |
#as ⇒ Object
109 110 111 |
# File 'lib/ip2location_rails.rb', line 109 def as location['as'] end |
#asn ⇒ Object
105 106 107 |
# File 'lib/ip2location_rails.rb', line 105 def asn location['asn'] end |
#category ⇒ Object
97 98 99 |
# File 'lib/ip2location_rails.rb', line 97 def category location['category'] end |
#city ⇒ Object
25 26 27 |
# File 'lib/ip2location_rails.rb', line 25 def city location['city'] end |
#country_code ⇒ Object
13 14 15 |
# File 'lib/ip2location_rails.rb', line 13 def country_code location['country_short'] end |
#country_name ⇒ Object
17 18 19 |
# File 'lib/ip2location_rails.rb', line 17 def country_name location['country_long'] end |
#district ⇒ Object
101 102 103 |
# File 'lib/ip2location_rails.rb', line 101 def district location['district'] end |
#domain ⇒ Object
41 42 43 |
# File 'lib/ip2location_rails.rb', line 41 def domain location['domain'] end |
#elevation ⇒ Object
85 86 87 |
# File 'lib/ip2location_rails.rb', line 85 def elevation location['elevation'] end |
#iddcode ⇒ Object
53 54 55 |
# File 'lib/ip2location_rails.rb', line 53 def iddcode location['iddcode'] end |
#isp ⇒ Object
37 38 39 |
# File 'lib/ip2location_rails.rb', line 37 def isp location['isp'] end |
#latitude ⇒ Object
29 30 31 |
# File 'lib/ip2location_rails.rb', line 29 def latitude location['latitude'] end |
#location ⇒ Object
9 10 11 |
# File 'lib/ip2location_rails.rb', line 9 def location @i2l.get_all(@ip_address) end |
#longitude ⇒ Object
33 34 35 |
# File 'lib/ip2location_rails.rb', line 33 def longitude location['longitude'] end |
#mcc ⇒ Object
73 74 75 |
# File 'lib/ip2location_rails.rb', line 73 def mcc location['mcc'] end |
#mnc ⇒ Object
77 78 79 |
# File 'lib/ip2location_rails.rb', line 77 def mnc location['mnc'] end |
#mobilebrand ⇒ Object
81 82 83 |
# File 'lib/ip2location_rails.rb', line 81 def mobilebrand location['mobilebrand'] end |
#netspeed ⇒ Object
45 46 47 |
# File 'lib/ip2location_rails.rb', line 45 def netspeed location['netspeed'] end |
#region ⇒ Object
21 22 23 |
# File 'lib/ip2location_rails.rb', line 21 def region location['region'] end |
#timezone ⇒ Object
57 58 59 |
# File 'lib/ip2location_rails.rb', line 57 def timezone location['timezone'] end |
#usagetype ⇒ Object
89 90 91 |
# File 'lib/ip2location_rails.rb', line 89 def usagetype location['usagetype'] end |
#weatherstationcode ⇒ Object
69 70 71 |
# File 'lib/ip2location_rails.rb', line 69 def weatherstationcode location['weatherstationcode'] end |
#weatherstationname ⇒ Object
65 66 67 |
# File 'lib/ip2location_rails.rb', line 65 def weatherstationname location['weatherstationname'] end |
#zipcode ⇒ Object
61 62 63 |
# File 'lib/ip2location_rails.rb', line 61 def zipcode location['zipcode'] end |