Class: Ip2proxyRails
- Inherits:
-
Object
- Object
- Ip2proxyRails
- Defined in:
- lib/ip2proxy_rails.rb
Instance Method Summary collapse
- #as ⇒ Object
- #asn ⇒ Object
- #city ⇒ Object
- #country_code ⇒ Object
- #country_name ⇒ Object
- #domain ⇒ Object
- #fraud_score ⇒ Object
-
#initialize(ip_address) ⇒ Ip2proxyRails
constructor
A new instance of Ip2proxyRails.
- #is_proxy ⇒ Object
- #isp ⇒ Object
- #last_seen ⇒ Object
- #provider ⇒ Object
- #proxy ⇒ Object
- #proxy_type ⇒ Object
- #region ⇒ Object
- #threat ⇒ Object
- #usagetype ⇒ Object
Constructor Details
#initialize(ip_address) ⇒ Ip2proxyRails
Returns a new instance of Ip2proxyRails.
4 5 6 7 |
# File 'lib/ip2proxy_rails.rb', line 4 def initialize(ip_address) @ip_address = ip_address @i2p = Ip2proxy.new.open(Rails.configuration.ip2proxy_db_path) end |
Instance Method Details
#as ⇒ Object
53 54 55 |
# File 'lib/ip2proxy_rails.rb', line 53 def as proxy['as'] end |
#asn ⇒ Object
49 50 51 |
# File 'lib/ip2proxy_rails.rb', line 49 def asn proxy['asn'] end |
#city ⇒ Object
33 34 35 |
# File 'lib/ip2proxy_rails.rb', line 33 def city proxy['city'] end |
#country_code ⇒ Object
21 22 23 |
# File 'lib/ip2proxy_rails.rb', line 21 def country_code proxy['country_short'] end |
#country_name ⇒ Object
25 26 27 |
# File 'lib/ip2proxy_rails.rb', line 25 def country_name proxy['country_long'] end |
#domain ⇒ Object
41 42 43 |
# File 'lib/ip2proxy_rails.rb', line 41 def domain proxy['domain'] end |
#fraud_score ⇒ Object
69 70 71 |
# File 'lib/ip2proxy_rails.rb', line 69 def fraud_score proxy['fraud_score'] end |
#is_proxy ⇒ Object
13 14 15 |
# File 'lib/ip2proxy_rails.rb', line 13 def is_proxy proxy['is_proxy'].to_s end |
#isp ⇒ Object
37 38 39 |
# File 'lib/ip2proxy_rails.rb', line 37 def isp proxy['isp'] end |
#last_seen ⇒ Object
57 58 59 |
# File 'lib/ip2proxy_rails.rb', line 57 def last_seen proxy['last_seen'] end |
#provider ⇒ Object
65 66 67 |
# File 'lib/ip2proxy_rails.rb', line 65 def provider proxy['provider'] end |
#proxy ⇒ Object
9 10 11 |
# File 'lib/ip2proxy_rails.rb', line 9 def proxy @i2p.get_all(@ip_address) end |
#proxy_type ⇒ Object
17 18 19 |
# File 'lib/ip2proxy_rails.rb', line 17 def proxy_type proxy['proxy_type'] end |
#region ⇒ Object
29 30 31 |
# File 'lib/ip2proxy_rails.rb', line 29 def region proxy['region'] end |
#threat ⇒ Object
61 62 63 |
# File 'lib/ip2proxy_rails.rb', line 61 def threat proxy['threat'] end |
#usagetype ⇒ Object
45 46 47 |
# File 'lib/ip2proxy_rails.rb', line 45 def usagetype proxy['usagetype'] end |