ip_lookup 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b00445540dc98f541e8d87c8219796c94cc4606e2c3c1d9efe6b73732ef4a03
4
- data.tar.gz: e53488f375b7c8195ff07055be44da1623d0cbb962494477fbc3c42ba35aa1c8
3
+ metadata.gz: 56f8d386f164038d905d0847f1d1854cd9769518de4d68198bb15dde3ff1140c
4
+ data.tar.gz: 751cf470063f7754d35ee532b397c809745c7b8004358c6bcbef8c9e36362067
5
5
  SHA512:
6
- metadata.gz: 5742ef17eced00830cac7ec67ae7bfd678349d5a0ef04ede285810d28af6b8d0b918d851243cef3296084b0ce69ad7174cc23dc04817806dd798f2dfdd687675
7
- data.tar.gz: 40ce04da68196627b220b3520608bacfb8db0a4e6ec4a65c690173e687fc872b52b40be7f3ee63aa9dd47d9ae98552f88ca50f10f747f418f2ef42c6f805e0f2
6
+ metadata.gz: 726b74610936c5bdc280efde68d3b54946776911da19606e7d3be03f4619884c8ac6736e44f6e80152bf21c779755a28c84875316ad50222bcec4be75facc47a
7
+ data.tar.gz: a2db8f5ca770924c3d60712dce1570e8f4d1c93a74db632c76bb91732258d6a09bcc0e7c293ba75dc91aaa92bb5caf6eff81a8c600dfda52efd9c42e0080448d
data/lib/ip_lookup.rb CHANGED
@@ -13,7 +13,7 @@ class IPLookup
13
13
 
14
14
  def initialize(ip_address, silent_exceptions: false)
15
15
  @silent_exceptions = silent_exceptions
16
- @result = DB.new(silent_exceptions).lookup(ip_address)
16
+ @result = DB.new(silent_exceptions).lookup(sanitize(ip_address))
17
17
  rescue IPAddr::InvalidAddressError, IPAddr::AddressFamilyError => e
18
18
  raise e unless silent_exceptions
19
19
  end
@@ -48,6 +48,10 @@ class IPLookup
48
48
 
49
49
  private
50
50
 
51
+ def sanitize(ip_address)
52
+ ip_address.split(/\s*,\s*/).last
53
+ end
54
+
51
55
  def timezone_for(iso_code)
52
56
  tz = TZInfo::Country.get iso_code
53
57
  tz.zone_identifiers.first if tz.zone_identifiers.any?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class IPLookup
4
- VERSION = "1.2.3"
4
+ VERSION = "1.2.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ip_lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ole Richter
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-10-11 00:00:00.000000000 Z
13
+ date: 2019-06-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: maxminddb