geo_ppp 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f73f28fd7637f9db3d180ca821318fb08ee7c77702c02c8cf644ffd16032a3a5
4
- data.tar.gz: 7a0f670a6f636f22c49973ffc3bfcfde26c355556f1d9a6eb1c8e6352f814e7e
3
+ metadata.gz: 11aca1821df7a6983f1bde1f3280cf79c9992cda2d0e5969a7d9974b8563c704
4
+ data.tar.gz: '0972f1da32af3b6d6c0f79429f5684d245e0d5308a1fe3813837bedbc8d6123f'
5
5
  SHA512:
6
- metadata.gz: 8aa4808a8265794ee8edc5d5302c9644b822c55c6f11a4e57e9118624fb00767627fa7569c16f52abf60c53b08915d3b4811105e35dd69602338d61b39b18851
7
- data.tar.gz: 23d6871087aeb198f5d534914c06a471620f4be23fd8f241313abc521c818863dd8fa7d4699fe036c3b6e1493fae2c2c03781a3438a0092e78c0f9ac11a25acc
6
+ metadata.gz: 93b74ef9317a47a14cfc5a7e1d5caa3f5bb1f2810c1c66c0130ae2391be3745a0ec4f5c70fdd716b86b2edc6a9432fb5b5445a7eade62fee47ca4f2ed51db29b
7
+ data.tar.gz: a643c92d4b2ebc8cc4312ecc06953183fd5a98ccebff8b1b4414a93acfce453d06ca3175cd35db474ccef5a81f613fce9597f4fe44d90caa25b03d30526df40b
data/README.md CHANGED
@@ -25,8 +25,14 @@ gem install geo_pp
25
25
  ```ruby
26
26
  GeoPPPFetcher.fetch
27
27
  ```
28
+ will get the purchasing power parity data based on user's IP address.
28
29
 
29
- will return a following json structure, you could use ```pppConversionFactor``` to convert it price based on user's geographic location
30
+ ```ruby
31
+ GeoPPPFetcher.fetch('LK')
32
+ ```
33
+ will get the purchasing power parity data based on country code provided.
34
+
35
+ Both above will return a following json structure, you could use ```pppConversionFactor``` to convert it price based on user's geographic location
30
36
 
31
37
  ```ruby
32
38
  {"countryCodeIsoAlpha2":"LK","countryCodeIsoAlpha3":"LKA","currenciesCountry":{"LKR":{"symbol":"Rs රු","name":"Sri Lankan rupee"}},"currencyMain":{"exchangeRate":300.701498,"name":"USD","symbol":"$"},"ppp":10040.0,"pppConversionFactor":0.33}
@@ -3,11 +3,16 @@ require 'json'
3
3
 
4
4
  class GeoPPPFetcher
5
5
  GEO_API_URL = 'https://freegeoip.app/json/'.freeze
6
- PPP_API_URL = 'https://api.purchasing-power-parity.com/?target='.freeze
7
-
8
- def self.fetch
9
- geo = fetch_geo
10
- fetch_ppp(geo)
6
+ # https://api.purchasing-power-parity.com/?target=ID redirects to https://ppp-api.fly.dev/?target=ID and then results are returned
7
+ PPP_API_URL = 'https://ppp-api.fly.dev/?target='.freeze
8
+
9
+ def self.fetch(country_code = nil)
10
+ geo = if country_code.nil?
11
+ fetch_geo
12
+ else
13
+ { 'country_code' => country_code }
14
+ end
15
+ fetch_ppp(geo)
11
16
  end
12
17
 
13
18
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GeoPpp
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geo_ppp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - waruna
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-09 00:00:00.000000000 Z
10
+ date: 2025-01-24 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: A Ruby library to fetch PPP based on user's geolocation using freegeoip.com
13
13
  and purchasing-power-parity.com APIs.