price_waterfall 0.1.0 → 0.1.1
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/CHANGELOG.md +7 -0
- data/README.md +31 -2
- data/lib/price_waterfall/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 317beae9cd5516d448e093afa00e35314eb24fdc9c8e4b5682f9d745a261c316
|
|
4
|
+
data.tar.gz: 9f743ee469662b650ecf71dfa1508456dee48b53edb576bb309353ce7280f30f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b7ec91354c6734ea4c96f6f8455539781df37236b2841d69203317a8ec629e7996053d704ceb7b170a513a9506245a559c52affd914e5776be0fac21b1cb99e
|
|
7
|
+
data.tar.gz: c607510743060a3ce8f1c78f613d7fbca5773e43c9c37cdfc0e673059077b3230051fb9a321d364fa97a25e55b807b98ba7d90b42d381d86181d8ff1de261c78
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# PriceWaterfall
|
|
2
2
|
|
|
3
|
+
[](https://rubygems.org/gems/price_waterfall)
|
|
4
|
+
[](https://github.com/PratikBaravkar/price_waterfall/actions/workflows/main.yml)
|
|
5
|
+
[](LICENSE.txt)
|
|
6
|
+
|
|
3
7
|
A Ruby gem for layered, explainable price calculation in integer cents. **Every price explains itself.**
|
|
4
8
|
|
|
5
9
|
Prices in B2B and e-commerce apps pass through many layers: list price, price lists,
|
|
@@ -35,7 +39,7 @@ result.explain
|
|
|
35
39
|
- [Results and explain](#results-and-explain): the trace, `to_h` for audit trails
|
|
36
40
|
- Reference: [Steps](#steps), [Value sources](#value-sources), [Conditions in data](#conditions-in-data),
|
|
37
41
|
[Time windows](#time-windows)
|
|
38
|
-
- [Security](#security) · [
|
|
42
|
+
- [Security](#security) · [Versioning](#versioning) · [Contributing](#contributing)
|
|
39
43
|
|
|
40
44
|
## Installation
|
|
41
45
|
|
|
@@ -58,6 +62,9 @@ require "price_waterfall"
|
|
|
58
62
|
It has no runtime dependencies and needs Ruby 3.2 or newer (CI tests 3.2, 3.3, 3.4 and 4.0).
|
|
59
63
|
Rails is not required.
|
|
60
64
|
|
|
65
|
+
This README is the guide; the API reference for every public class and method is on
|
|
66
|
+
[rubydoc.info](https://rubydoc.info/gems/price_waterfall).
|
|
67
|
+
|
|
61
68
|
## Design rules
|
|
62
69
|
|
|
63
70
|
- Pure Ruby, no runtime dependencies; works with or without Rails.
|
|
@@ -572,11 +579,33 @@ their own prices:
|
|
|
572
579
|
- **Errors are typed.** Every error is a `PriceWaterfall::Error` naming the step; your own code's
|
|
573
580
|
exceptions are wrapped in `StepError` with the original as `cause` ([errors](#errors)).
|
|
574
581
|
|
|
575
|
-
##
|
|
582
|
+
## Versioning
|
|
583
|
+
|
|
584
|
+
PriceWaterfall follows [Semantic Versioning](https://semver.org). Until 1.0, a minor release
|
|
585
|
+
(0.1 → 0.2) may change the public API; patch releases (0.1.0 → 0.1.1) only fix bugs. Pin the
|
|
586
|
+
minor version (`gem "price_waterfall", "~> 0.1.0"`) and read the
|
|
587
|
+
[changelog](CHANGELOG.md) before upgrading. Every change is listed there.
|
|
588
|
+
|
|
589
|
+
## Contributing
|
|
590
|
+
|
|
591
|
+
Bug reports and pull requests are welcome on
|
|
592
|
+
[GitHub](https://github.com/PratikBaravkar/price_waterfall/issues). For a new feature or a
|
|
593
|
+
change to existing behaviour, please open an issue first so we can agree on the design.
|
|
576
594
|
|
|
577
595
|
After checking out the repo, run `bin/setup` to install dependencies, then `bundle exec rake`
|
|
578
596
|
to run the specs and RuboCop. `bin/console` gives an interactive prompt.
|
|
579
597
|
|
|
598
|
+
A pull request needs:
|
|
599
|
+
|
|
600
|
+
- **Specs for the change.** `bundle exec rake` fails below 100% line and branch coverage.
|
|
601
|
+
- **A clean RuboCop run**, without disabling cops in `lib/`.
|
|
602
|
+
- **Working README examples.** Every Ruby example in this README runs as a spec
|
|
603
|
+
(`spec/readme_examples_spec.rb`); add `# => value` to show and check a result.
|
|
604
|
+
- **A changelog entry** under `## [Unreleased]` in [CHANGELOG.md](CHANGELOG.md) for anything users
|
|
605
|
+
will notice.
|
|
606
|
+
|
|
607
|
+
CI runs the suite on Ruby 3.2, 3.3, 3.4 and 4.0.
|
|
608
|
+
|
|
580
609
|
## License
|
|
581
610
|
|
|
582
611
|
Available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: price_waterfall
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pratik Baravkar
|
|
@@ -10,9 +10,12 @@ cert_chain: []
|
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: Define a pricing waterfall (base price, overrides, percentage and fixed
|
|
13
|
-
discounts, volume tiers, rounding) with a small DSL
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
discounts, volume tiers, rounding) with a small Ruby DSL, or load the same rules
|
|
14
|
+
as data from JSON, YAML or a database, validated with every problem's path for admin
|
|
15
|
+
forms. Custom step types, value sources and operators are registered in Ruby, so
|
|
16
|
+
stored rules never run code. Every result returns the final price in integer cents
|
|
17
|
+
plus a step-by-step trace explaining how it was reached. Pure Ruby, no runtime dependencies,
|
|
18
|
+
works with or without Rails.
|
|
16
19
|
email:
|
|
17
20
|
- baravkarpratik5@gmail.com
|
|
18
21
|
executables: []
|