diff --git a/CHANGELOG.md b/CHANGELOG.md index 116cbbf..1112337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * Add missing RIPE API endpoints to be consistent with RIPE SDK - [#31](https://github.com/ripe-tech/ripe-api/pull/31) +* Add `Invoice Rule` API methods - [peri-invoicing/#3](https://github.com/ripe-tech/peri-invoicing/issues/3) ### Changed diff --git a/src/ripe/__init__.py b/src/ripe/__init__.py index 46128df..32fbc22 100644 --- a/src/ripe/__init__.py +++ b/src/ripe/__init__.py @@ -10,6 +10,7 @@ from . import country_group from . import design from . import factory_rule +from . import invoice_rule from . import justification from . import locale from . import model @@ -31,6 +32,7 @@ from .config import ConfigAPI from .design import DesignAPI from .factory_rule import FactoryRuleAPI +from .invoice_rule import InvoiceRuleAPI from .justification import JustificationAPI from .locale import LocaleAPI from .model import ModelAPI diff --git a/src/ripe/invoice_rule.py b/src/ripe/invoice_rule.py new file mode 100644 index 0000000..a85a71f --- /dev/null +++ b/src/ripe/invoice_rule.py @@ -0,0 +1,29 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +class InvoiceRuleAPI(object): + + def list_invoice_rules(self, *args, **kwargs): + url = self.base_url + "invoice_rules" + contents = self.get(url, **kwargs) + return contents + + def create_invoice_rule(self, invoice_rule): + url = self.base_url + "invoice_rules" + contents = self.post(url, data_j = invoice_rule) + return contents + + def get_invoice_rule(self, id): + url = self.base_url + "invoice_rules/%d" % id + contents = self.get(url) + return contents + + def update_invoice_rule(self, id, invoice_rule): + url = self.base_url + "invoice_rules/%d" % id + contents = self.put(url, data_j = invoice_rule) + return contents + + def delete_invoice_rule(self, id): + url = self.base_url + "invoice_rules/%d" % id + contents = self.delete(url) + return contents