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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 046e914f478a80c16bcfd507bcf3330ec343f718
4
- data.tar.gz: a652a23498ada22b8bb58addcc12f0e433d67368
3
+ metadata.gz: caa4b482cdc2060a77d3269c0135667c7a0ece2a
4
+ data.tar.gz: 865aaaf417125189078b3c17f2dfcbd4940b1996
5
5
  SHA512:
6
- metadata.gz: b6e78f46dada901fc4af0a893974fc6cf5ee26934009d00b4d380e1b993712470874b777ab5caa16ef2dc1cf6289a43e77125a3ec630d7f3ff5c878a0d53cc12
7
- data.tar.gz: 248a6b970576b2cc7daf2c9f11b66c06b0dbeb3e3327111aaef4e40dc6f0451d124740f9a99815566e4c9b9025f6f679c073374350d89535b5a4984b24d98a5f
6
+ metadata.gz: 73a5f8b3e5a6e4b317a2bb57ee0a55c09bc95a335163e18f5f694ba38845294628b1d5981b5a04fc7b3ea1e2129d4f552aa501cbdd01f339a1be2cbe3402073f
7
+ data.tar.gz: 08ae33490af84d55e1797cb40b89db5f6235a1b81ac74501e670ebc5ac2c793f0faff00d0dc57652480fba63cf276240b78b492e77100555be23de2575f9411c
@@ -1,3 +1,3 @@
1
1
  module CurrencyByIp
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -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, geoip_data_path: "lib/currency_by_ip/GeoIP.dat")
8
- geo_ip = GeoIP.new(geoip_data_path)
9
- country = geo_ip.country(ip)
10
- COUNTRY_TO_CURRENCY[country.country_code2]
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.1.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-19 00:00:00.000000000 Z
11
+ date: 2015-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: geoip