currency_by_ip 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/currency_by_ip/version.rb +1 -1
- data/lib/currency_by_ip.rb +10 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caa4b482cdc2060a77d3269c0135667c7a0ece2a
|
4
|
+
data.tar.gz: 865aaaf417125189078b3c17f2dfcbd4940b1996
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73a5f8b3e5a6e4b317a2bb57ee0a55c09bc95a335163e18f5f694ba38845294628b1d5981b5a04fc7b3ea1e2129d4f552aa501cbdd01f339a1be2cbe3402073f
|
7
|
+
data.tar.gz: 08ae33490af84d55e1797cb40b89db5f6235a1b81ac74501e670ebc5ac2c793f0faff00d0dc57652480fba63cf276240b78b492e77100555be23de2575f9411c
|
data/lib/currency_by_ip.rb
CHANGED
@@ -4,9 +4,15 @@ require "currency_by_ip/country_to_currency"
|
|
4
4
|
require "geoip"
|
5
5
|
|
6
6
|
module CurrencyByIp
|
7
|
-
def self.find_by_ip(ip,
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
def self.find_by_ip(ip,
|
8
|
+
geoip_data_path: "lib/currency_by_ip/GeoIP.dat",
|
9
|
+
geoip: nil)
|
10
|
+
geoip ||= GeoIP.new(geoip_data_path)
|
11
|
+
country = geoip.country(ip)
|
12
|
+
find_by_country_code(country.country_code2)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.find_by_country_code(country_code)
|
16
|
+
COUNTRY_TO_CURRENCY[country_code]
|
11
17
|
end
|
12
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: currency_by_ip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sunny Ripert
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: geoip
|