ip2location_ruby 8.2.2 → 8.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a86f4394b163a1ccd9896531c527f372644a319e17fb3cd9c9e6b563bc3c5c74
4
- data.tar.gz: cb3e119df9379eff6242e7f514c0e1f3f50922cc2304f0a3aee5a14c10338ecc
3
+ metadata.gz: 118e20ce9246a282a4762523c68870f645bde1532e79950e812e935eecc4252e
4
+ data.tar.gz: 23da14c93843dc1952371b5f250015d59fdf27323fcc0232882f65a036509a86
5
5
  SHA512:
6
- metadata.gz: 8ee0cda4118fb7b7e22eba89c662612a899fb94f1b764a596fdc94106a6391b6839353baca8e3a6d69c7aa2e993fd501ae49f33b2ac11182cd9b39acab8fad80
7
- data.tar.gz: 3954de881966a8f9c5e0a84af9bb5a0eaeb7b9ded44031090ee5be2387aa365035915b29e5baa826bc262d316ccec7914108d57ddaad9f82738654a58e141709
6
+ metadata.gz: 5d1da0f2aed10f79b0268e38368abaaa66b8c2e5f24a862fb46fd6c5c58047f6e5a15941561ba527020fcd312aa62f1c8e918fc8273ffa25ba6f4a3e6847a834
7
+ data.tar.gz: f1481d6b6bfd5143612c6772a4c9be2d2f0216e74293afa80b1fcba422755016a27167c99640880e1fda45577e3cee7b69b3398a7f7fe89b68f7394e418614f9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 8.2.2
1
+ 8.2.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ip2location_ruby"
8
- s.version = "8.2.2"
8
+ s.version = "8.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.require_paths = ["lib"]
@@ -34,10 +34,9 @@ Gem::Specification.new do |s|
34
34
  "lib/ip2location_ruby/i2l_string_data.rb",
35
35
  "lib/ip2location_ruby/ip2location_config.rb",
36
36
  "lib/ip2location_ruby/ip2location_record.rb",
37
- "spec/assets/DB24.DEMO4.BIN",
38
- "spec/assets/DB24.DEMO6.BIN",
39
- "spec/assets/IP-COUNTRY-SAMPLE.BIN",
40
- "spec/ip2location_ruby_spec.rb",
37
+ "spec/assets/IP2LOCATION-LITE-DB1.IPV6.BIN",
38
+ "spec/ip2location_ruby_database_spec.rb",
39
+ "spec/ip2location_ruby_webservice_spec.rb",
41
40
  "spec/spec_helper.rb",
42
41
  "rb/data/IP2LOCATION-LITE-DB1.IPV6.BIN"
43
42
  ]
@@ -408,7 +408,7 @@ class Ip2location
408
408
  if valid
409
409
  rec = get_record(ip)
410
410
  if !(rec.nil?)
411
- mnc = (defined?(mnc) && rec.mnc != '') ? rec.mnc : FIELD_NOT_SUPPORTED
411
+ mnc = (defined?(rec.mnc) && rec.mnc != '') ? rec.mnc : FIELD_NOT_SUPPORTED
412
412
  else
413
413
  mnc = INVALID_IP_ADDRESS
414
414
  end
@@ -0,0 +1,147 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Ip2location" do
4
+ it "work correctly with ipv4" do
5
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
6
+ record = i2l.get_all('8.8.8.8')
7
+ expect(record['country_short']).to eq 'US'
8
+ end
9
+
10
+ it "work correctly with get_country_short" do
11
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
12
+ record = i2l.get_country_short('8.8.8.8')
13
+ expect(record).to eq 'US'
14
+ end
15
+
16
+ it "work correctly with get_country_long" do
17
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
18
+ record = i2l.get_country_long('8.8.8.8')
19
+ expect(record).to eq 'United States of America'
20
+ end
21
+
22
+ it "work correctly with get_region" do
23
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
24
+ record = i2l.get_region('8.8.8.8')
25
+ expect(record).to eq 'NOT SUPPORTED'
26
+ end
27
+
28
+ it "work correctly with get_city" do
29
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
30
+ record = i2l.get_city('8.8.8.8')
31
+ expect(record).to eq 'NOT SUPPORTED'
32
+ end
33
+
34
+ it "work correctly with get_latitude" do
35
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
36
+ record = i2l.get_latitude('8.8.8.8')
37
+ expect(record).to eq 'NOT SUPPORTED'
38
+ end
39
+
40
+ it "work correctly with get_longitude" do
41
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
42
+ record = i2l.get_longitude('8.8.8.8')
43
+ expect(record).to eq 'NOT SUPPORTED'
44
+ end
45
+
46
+ it "work correctly with get_isp" do
47
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
48
+ record = i2l.get_isp('8.8.8.8')
49
+ expect(record).to eq 'NOT SUPPORTED'
50
+ end
51
+
52
+ it "work correctly with get_domain" do
53
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
54
+ record = i2l.get_domain('8.8.8.8')
55
+ expect(record).to eq 'NOT SUPPORTED'
56
+ end
57
+
58
+ it "work correctly with get_zipcode" do
59
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
60
+ record = i2l.get_zipcode('8.8.8.8')
61
+ expect(record).to eq 'NOT SUPPORTED'
62
+ end
63
+
64
+ it "work correctly with get_timezone" do
65
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
66
+ record = i2l.get_timezone('8.8.8.8')
67
+ expect(record).to eq 'NOT SUPPORTED'
68
+ end
69
+
70
+ it "work correctly with get_netspeed" do
71
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
72
+ record = i2l.get_netspeed('8.8.8.8')
73
+ expect(record).to eq 'NOT SUPPORTED'
74
+ end
75
+
76
+ it "work correctly with get_iddcode" do
77
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
78
+ record = i2l.get_iddcode('8.8.8.8')
79
+ expect(record).to eq 'NOT SUPPORTED'
80
+ end
81
+
82
+ it "work correctly with get_areacode" do
83
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
84
+ record = i2l.get_areacode('8.8.8.8')
85
+ expect(record).to eq 'NOT SUPPORTED'
86
+ end
87
+
88
+ it "work correctly with get_weatherstationcode" do
89
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
90
+ record = i2l.get_weatherstationcode('8.8.8.8')
91
+ expect(record).to eq 'NOT SUPPORTED'
92
+ end
93
+
94
+ it "work correctly with get_weatherstationname" do
95
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
96
+ record = i2l.get_weatherstationname('8.8.8.8')
97
+ expect(record).to eq 'NOT SUPPORTED'
98
+ end
99
+
100
+ it "work correctly with get_mcc" do
101
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
102
+ record = i2l.get_mcc('8.8.8.8')
103
+ expect(record).to eq 'NOT SUPPORTED'
104
+ end
105
+
106
+ it "work correctly with get_mnc" do
107
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
108
+ record = i2l.get_mnc('8.8.8.8')
109
+ expect(record).to eq 'NOT SUPPORTED'
110
+ end
111
+
112
+ it "work correctly with get_mobilebrand" do
113
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
114
+ record = i2l.get_mobilebrand('8.8.8.8')
115
+ expect(record).to eq 'NOT SUPPORTED'
116
+ end
117
+
118
+ it "work correctly with get_elevation" do
119
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
120
+ record = i2l.get_elevation('8.8.8.8')
121
+ expect(record).to eq 'NOT SUPPORTED'
122
+ end
123
+
124
+ it "work correctly with get_usagetype" do
125
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
126
+ record = i2l.get_usagetype('8.8.8.8')
127
+ expect(record).to eq 'NOT SUPPORTED'
128
+ end
129
+
130
+ it "work correctly with ipv6" do
131
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
132
+ record = i2l.get_all('2001:4860:4860::8888')
133
+ expect(record['country_short']).to eq 'US'
134
+ end
135
+
136
+ it "work correctly with ipv6 get_country_long" do
137
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
138
+ record = i2l.get_country_long('2001:4860:4860::8888')
139
+ expect(record).to eq 'United States of America'
140
+ end
141
+
142
+ it "work correctly with ipv6 get_region" do
143
+ i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB1.IPV6.BIN")
144
+ record = i2l.get_region('2001:4860:4860::8888')
145
+ expect(record).to eq 'NOT SUPPORTED'
146
+ end
147
+ end
@@ -0,0 +1,15 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Ip2location" do
4
+ it "work correctly with web service lookup" do
5
+ ws = Ip2locationWebService.new('demo', 'WS24', true)
6
+ record = ws.lookup('8.8.8.8', '', 'en')
7
+ expect(record['country_code']).to eq 'US'
8
+ end
9
+
10
+ it "work correctly with web service get_credit" do
11
+ ws = Ip2locationWebService.new('demo', 'WS24', true)
12
+ record = ws.get_credit()
13
+ expect(record).to_not eq 0
14
+ end
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ip2location_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.2
4
+ version: 8.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ip2location
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-30 00:00:00.000000000 Z
11
+ date: 2020-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -109,10 +109,9 @@ files:
109
109
  - lib/ip2location_ruby/ip2location_config.rb
110
110
  - lib/ip2location_ruby/ip2location_record.rb
111
111
  - rb/data/IP2LOCATION-LITE-DB1.IPV6.BIN
112
- - spec/assets/DB24.DEMO4.BIN
113
- - spec/assets/DB24.DEMO6.BIN
114
- - spec/assets/IP-COUNTRY-SAMPLE.BIN
115
- - spec/ip2location_ruby_spec.rb
112
+ - spec/assets/IP2LOCATION-LITE-DB1.IPV6.BIN
113
+ - spec/ip2location_ruby_database_spec.rb
114
+ - spec/ip2location_ruby_webservice_spec.rb
116
115
  - spec/spec_helper.rb
117
116
  homepage: https://github.com/ip2location/ip2location-ruby
118
117
  licenses:
Binary file
Binary file
@@ -1,53 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "Ip2location" do
4
- it "work correctly with ipv4" do
5
- i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP-COUNTRY-SAMPLE.bin")
6
- record = i2l.get_all('13.5.10.6')
7
- record.should_not be_nil
8
- record.country_short.should == 'US'
9
- end
10
-
11
- it "work correctly with ipv4 with new library" do
12
- i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/DB24.DEMO4.bin")
13
- record = i2l.get_all('13.5.10.6')
14
- record.should_not be_nil
15
- record.country_short.should == 'KR'
16
- end
17
-
18
- it "work correctly with ipv6 with new library" do
19
- i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/DB24.DEMO6.bin")
20
- record = i2l.get_all('2a01:04f8:0d16:26c2::')
21
- record.should_not be_nil
22
- record.country_short.should == 'DE'
23
- end
24
-
25
- # it "profile ipv6 in IPV6.BIN" do
26
- # i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IPV6-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE.BIN")
27
- # File.new(File.dirname(__FILE__) + "/assets/ipv6_ip.txt").readlines.each do |line|
28
- # record = i2l.get_all(line.split(' ').first)
29
- # end
30
- # end
31
-
32
- # it "profile ipv4 in IPV6.BIN" do
33
- # i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IPV6-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE.BIN")
34
- # File.new(File.dirname(__FILE__) + "/assets/ipv4_ip.txt").readlines.each do |line|
35
- # record = i2l.get_all(line.split(' ').first)
36
- # end
37
- # end
38
-
39
- # it "profile ipv4 in IPV4.BIN" do
40
- # i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE.BIN")
41
- # File.new(File.dirname(__FILE__) + "/assets/ipv4_ip.txt").readlines.each do |line|
42
- # record = i2l.get_all(line.split(' ').first)
43
- # end
44
- # end
45
-
46
- # this need spec/assets/IP2LOCATION-LITE-DB5.bin file which too big to include in this test.
47
-
48
- # it "should get float value of attitude" do
49
- # i2l = Ip2location.new.open(File.dirname(__FILE__) + "/assets/IP2LOCATION-LITE-DB5.bin")
50
- # record = i2l.get_all('192.110.164.88')
51
- # record['latitude'].should eq(33.44837951660156)
52
- # end
53
- end