ipgeobase 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ipgeobase/ip_meta_data.rb +6 -4
- data/lib/ipgeobase/version.rb +1 -1
- data/test/lib/ip_meta_data_test.rb +11 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b0a9873fe55d2b32189a06c9d6ce17d1b4824ae
|
4
|
+
data.tar.gz: 950a50e48909a4ab2a191c7ef7b4d3b01dec739e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6179c1222a0bb3536d1f464a367b04dc778ce8faa9b9f4a590c9dd05982cac77bc72bddcfa38f75b2f440b104a943fda052390c478e2510fa88bafa389e28bf7
|
7
|
+
data.tar.gz: 39edb192daa62a893cad0a2fd4e0d7c2e2c0ecf3c3825dc0102489e930e7ed2b8a3ed240702b680cf47aacd06ce15ee7f2c5f974df86b05e90d5f7c0d79df175
|
@@ -28,11 +28,13 @@ module Ipgeobase
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
def encode(
|
32
|
-
if
|
33
|
-
|
31
|
+
def encode(entity)
|
32
|
+
return nil if entity.nil?
|
33
|
+
|
34
|
+
if entity.respond_to?(:encode)
|
35
|
+
entity.encode("UTF-8")
|
34
36
|
else
|
35
|
-
Iconv.iconv('utf-8', 'windows-1251',
|
37
|
+
Iconv.iconv('utf-8', 'windows-1251', entity).first
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
data/lib/ipgeobase/version.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class IpMetaDataTest < TestCase
|
6
|
+
def test_should_work_with_incorrect_response
|
7
|
+
resp = %Q{<?xml version="1.0" encoding="windows-1251"?><ip-answer><ip value="127.0.0.1"><message>Not found</message></ip></ip-answer>}
|
8
|
+
meta = Ipgeobase::IpMetaData.parse(resp)
|
9
|
+
assert_equal nil, meta.city
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipgeobase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mokevnin Kirill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: happymapper
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/ipgeobase/version.rb
|
57
57
|
- test/fixtures/response.xml
|
58
58
|
- test/fixtures/response_not_utf.xml
|
59
|
+
- test/lib/ip_meta_data_test.rb
|
59
60
|
- test/lib/ipgeobase_test.rb
|
60
61
|
- test/test_helper.rb
|
61
62
|
homepage: ''
|
@@ -77,13 +78,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
78
|
version: '0'
|
78
79
|
requirements: []
|
79
80
|
rubyforge_project: ipgeobase
|
80
|
-
rubygems_version: 2.2.
|
81
|
+
rubygems_version: 2.2.2
|
81
82
|
signing_key:
|
82
83
|
specification_version: 4
|
83
84
|
summary: geo to ip
|
84
85
|
test_files:
|
85
86
|
- test/fixtures/response.xml
|
86
87
|
- test/fixtures/response_not_utf.xml
|
88
|
+
- test/lib/ip_meta_data_test.rb
|
87
89
|
- test/lib/ipgeobase_test.rb
|
88
90
|
- test/test_helper.rb
|
89
|
-
has_rdoc:
|