geo_ppp 0.1.3 → 0.1.5
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 +4 -4
- data/README.md +32 -14
- data/lib/geo_ppp/fetcher.rb +1 -1
- data/lib/geo_ppp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f73f28fd7637f9db3d180ca821318fb08ee7c77702c02c8cf644ffd16032a3a5
|
|
4
|
+
data.tar.gz: 7a0f670a6f636f22c49973ffc3bfcfde26c355556f1d9a6eb1c8e6352f814e7e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8aa4808a8265794ee8edc5d5302c9644b822c55c6f11a4e57e9118624fb00767627fa7569c16f52abf60c53b08915d3b4811105e35dd69602338d61b39b18851
|
|
7
|
+
data.tar.gz: 23d6871087aeb198f5d534914c06a471620f4be23fd8f241313abc521c818863dd8fa7d4699fe036c3b6e1493fae2c2c03781a3438a0092e78c0f9ac11a25acc
|
data/README.md
CHANGED
|
@@ -1,34 +1,52 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Geo Purchasing Power Parity
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/geo_ppp`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
3
|
+
Sell your digital products at purchasing power parity for based on users country. Not everyone is able to pay for the default pricing of the high income world. Cup of Coffee in Colombia or Indonesia cost less than USA or Australia, apply same principal to your digital products and get more customers. This package is inspired by `purchasing-power-parity` npm and uses their API.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
Add this line to your application's Gemfile
|
|
8
|
+
```bash
|
|
9
|
+
gem 'geo_ppp'
|
|
10
|
+
```
|
|
12
11
|
|
|
12
|
+
and run bundle
|
|
13
13
|
```bash
|
|
14
|
-
bundle
|
|
14
|
+
bundle install
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
gem install
|
|
20
|
+
gem install geo_pp
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
```ruby
|
|
26
|
+
GeoPPPFetcher.fetch
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
will return a following json structure, you could use ```pppConversionFactor``` to convert it price based on user's geographic location
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
```ruby
|
|
32
|
+
{"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}
|
|
33
|
+
```
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
```ruby
|
|
36
|
+
def index
|
|
37
|
+
original_price = 79.99
|
|
38
|
+
|
|
39
|
+
begin
|
|
40
|
+
response = GeoPPPFetcher.fetch
|
|
41
|
+
discounted_price = original_price * response['pppConversionFactor']
|
|
42
|
+
data = { original_price: original_price, discounted_price: discounted_price }
|
|
43
|
+
render json: { success: true, data: data }
|
|
44
|
+
rescue StandardError => e
|
|
45
|
+
render json: { success: false, error: e.message }, status: :unprocessable_entity
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
```
|
|
30
49
|
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
50
|
|
|
33
51
|
## Contributing
|
|
34
52
|
|
|
@@ -40,4 +58,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
40
58
|
|
|
41
59
|
## Code of Conduct
|
|
42
60
|
|
|
43
|
-
Everyone interacting in the
|
|
61
|
+
Everyone interacting in the geo_ppp project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/geo_ppp/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/geo_ppp/fetcher.rb
CHANGED
data/lib/geo_ppp/version.rb
CHANGED