maxminddb 0.1.15 → 0.1.16

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
  SHA1:
3
- metadata.gz: 2950442ee2ba4359f1b315e930bdd1b657d27b90
4
- data.tar.gz: c0a2768251d072966bb978fd7590864ebc2d2e68
3
+ metadata.gz: de3d917a3dc6c98952db3093c0b757f0118e214f
4
+ data.tar.gz: 825e4a603556972cb5455530b8961bdf55a3d9fe
5
5
  SHA512:
6
- metadata.gz: '09488fd2b9863ea77ff054b500b218211187b2fa91e15307c7d126396a12b23be89c4932b92e92e6f5a57aca6e5a73da71c816e4d01c8632f65ca2d2634e0f85'
7
- data.tar.gz: f8f60d819f9b81938a963cf0464462fcff067510db5ae6799b82531b60447d8812c7f3d353e4a7bcae596733faa5e9f9647af6c374d1b1558331b8aa40b2368e
6
+ metadata.gz: aa879149d7c2a6ed871bcf35a460b02267147a00a64f1c9c3facc5f8b1876aedeccb5cb1ab186e20c220906a051678736c1a5c429048b49fe907c4dfb07f8666
7
+ data.tar.gz: 3a7b04887875dad51eda9a3f1e670df59de0fe6d55a1bb823011214a4e098e7225c84726068e785dbb208e3defcff911418463de0f93cc3901844f3be5e331f2
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 0.1.16 (May 22, 2018)
4
+
5
+ - Adds is_in_european_union feature
6
+
3
7
  ### 0.1.15 (December 18, 2017)
4
8
 
5
9
  - Implement #most_specific method for result subdivisions #31
data/README.md CHANGED
@@ -39,6 +39,7 @@ ret.country.name # => 'United States'
39
39
  ret.country.name('zh-CN') # => '美国'
40
40
  ret.country.iso_code # => 'US'
41
41
  ret.city.name(:fr) # => 'Mountain View'
42
+ ret.subdivisions.most_specific.name # => 'California'
42
43
  ret.location.latitude # => -122.0574
43
44
  ret.to_hash # => {"city"=>{"geoname_id"=>5375480, "names"=>{"de"=>"Mountain View", "en"=>"Mountain View", "fr"=>"Mountain View", "ja"=>"マウンテンビュー", "ru"=>"Маунтин-Вью", "zh-CN"=>"芒廷维尤"}}, "continent"=>{"code"=>"NA", "geoname_id"=>6255149, "names"=>{"de"=>"Nordamerika", "en"=>"North America", "es"=>"Norteamérica", "fr"=>"Amérique du Nord", "ja"=>"北アメリカ", "pt-BR"=>"América do Norte", "ru"=>"Северная Америка", "zh-CN"=>"北美洲"}}, "country"=>{"geoname_id"=>6252001, "iso_code"=>"US", "names"=>{"de"=>"USA", "en"=>"United States", "es"=>"Estados Unidos", "fr"=>"États-Unis", "ja"=>"アメリカ合衆国", "pt-BR"=>"Estados Unidos", "ru"=>"Сша", "zh-CN"=>"美国"}}, "location"=>{"latitude"=>37.419200000000004, "longitude"=>-122.0574, "metro_code"=>807, "time_zone"=>"America/Los_Angeles"}, "postal"=>{"code"=>"94043"}, "registered_country"=>{"geoname_id"=>6252001, "iso_code"=>"US", "names"=>{"de"=>"USA", "en"=>"United States", "es"=>"Estados Unidos", "fr"=>"États-Unis", "ja"=>"アメリカ合衆国", "pt-BR"=>"Estados Unidos", "ru"=>"Сша", "zh-CN"=>"美国"}}, "subdivisions"=>[{"geoname_id"=>5332921, "iso_code"=>"CA", "names"=>{"de"=>"Kalifornien", "en"=>"California", "es"=>"California", "fr"=>"Californie", "ja"=>"カリフォルニア州", "pt-BR"=>"Califórnia", "ru"=>"Калифорния", "zh-CN"=>"加利福尼亚州"}}]}
44
45
  ```
@@ -61,6 +62,9 @@ db.metadata['build_epoch'] # => 1493762948
61
62
  db.metadata # => {"binary_format_major_version"=>2, "binary_format_minor_version"=>0, "build_epoch"=>1493762948, "database_type"=>"GeoLite2-City", "description"=>{"en"=>"GeoLite2 City database"}, "ip_version"=>6, "languages"=>["de", "en", "es", "fr", "ja", "pt-BR", "ru", "zh-CN"], "node_count"=>3678850, "record_size"=>28}
62
63
  ```
63
64
 
65
+ ### Regarding thread safety
66
+
67
+ A MaxMindDB instance doesn't do any write operation after it is created. So we can consider it as an immutable object which is 'thread-safe'.
64
68
 
65
69
  ## Contributing
66
70
 
@@ -13,6 +13,10 @@ module MaxMindDB
13
13
  raw['geoname_id']
14
14
  end
15
15
 
16
+ def is_in_european_union
17
+ raw['is_in_european_union']
18
+ end
19
+
16
20
  def iso_code
17
21
  raw['iso_code']
18
22
  end
@@ -1,3 +1,3 @@
1
1
  module MaxMindDB
2
- VERSION = "0.1.15"
2
+ VERSION = "0.1.16"
3
3
  end
@@ -17,11 +17,11 @@ describe MaxMindDB do
17
17
  end
18
18
 
19
19
  it 'returns Mountain View as the English name' do
20
- expect(city_db.lookup(ip).city.name).to eq('Mountain View')
20
+ expect(city_db.lookup(ip).city.name).to eq('Alameda')
21
21
  end
22
22
 
23
23
  it 'returns -122.0574 as the longitude' do
24
- expect(city_db.lookup(ip).location.longitude).to eq(-122.0574)
24
+ expect(city_db.lookup(ip).location.longitude).to eq(-122.2788)
25
25
  end
26
26
 
27
27
  it 'returns nil for is_anonymous_proxy' do
@@ -32,6 +32,10 @@ describe MaxMindDB do
32
32
  expect(country_db.lookup(ip).country.name).to eq('United States')
33
33
  end
34
34
 
35
+ it 'returns false for the is_in_european_union' do
36
+ expect(country_db.lookup(ip).country.is_in_european_union).to eq(nil)
37
+ end
38
+
35
39
  it 'returns US as the country iso code' do
36
40
  expect(country_db.lookup(ip).country.iso_code).to eq('US')
37
41
  end
@@ -44,7 +48,7 @@ describe MaxMindDB do
44
48
  end
45
49
 
46
50
  it 'returns Mountain View as the English name' do
47
- expect(city_db.lookup(integer_ip).city.name).to eq('Mountain View')
51
+ expect(city_db.lookup(integer_ip).city.name).to eq('Alameda')
48
52
  end
49
53
 
50
54
  it 'returns United States as the English country name' do
@@ -60,6 +64,10 @@ describe MaxMindDB do
60
64
  expect(city_db.lookup(ip)).to be_found
61
65
  end
62
66
 
67
+ it 'returns false for the is_in_european_union' do
68
+ expect(country_db.lookup(ip).country.is_in_european_union).to eq(true)
69
+ end
70
+
63
71
  it 'returns FI as the country iso code' do
64
72
  expect(country_db.lookup(ip).country.iso_code).to eq('FI')
65
73
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maxminddb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - yhirose
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2018-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler