Skip to content

Commit

Permalink
Merge pull request #34 from ripe-tech/jc/feat-add-new-endpoints
Browse files Browse the repository at this point in the history
feat: better feature parity with JS SDK
  • Loading branch information
joamag authored Mar 11, 2022
2 parents 2bd3f98 + e365013 commit 0157a68
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 36 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

*
* Added methods for waybill deletion (void) - [ripe-pulse/#301](https://github.com/ripe-tech/ripe-pulse/issues/301)
* Methods to unset order tracking info - [ripe-pulse/#301](https://github.com/ripe-tech/ripe-pulse/issues/301)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion src/ripe/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

class AccountAPI(object):

def self_account(self, *args, **kwargs):
url = self.base_url + "accounts/me"
contents = self.get(url, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/ripe/availability_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

class AvailabilityRuleAPI(object):

def list_availability_rules(self, *args, **kwargs):
url = self.base_url + "availability_rules"
contents = self.get(url, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/ripe/factory_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

class FactoryRuleAPI(object):

def list_factory_rules(self, *args, **kwargs):
url = self.base_url + "factory_rules"
contents = self.get(url, **kwargs)
Expand Down
58 changes: 29 additions & 29 deletions src/ripe/invoice_rule.py
Original file line number Diff line number Diff line change
@@ -1,29 +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
#!/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
2 changes: 1 addition & 1 deletion src/ripe/letter_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

class LetterRuleAPI(object):

def list_letter_rules(self, *args, **kwargs):
url = self.base_url + "letter_rules"
contents = self.get(url, **kwargs)
Expand Down
38 changes: 36 additions & 2 deletions src/ripe/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,24 @@ def create_note_order(self, number, note):
contents = self.post(url, data_j = note)
return contents

def create_waybill_order(self, number, waybill):
def create_waybill_order(self, number):
url = self.base_url + "orders/%d/waybill" % number
contents = self.post(url, data_j = waybill)
contents = self.post(url)
return contents

def create_return_waybill_order(self, number):
url = self.base_url + "orders/%d/return_waybill" % number
contents = self.post(url)
return contents

def void_waybill_order(self, number):
url = self.base_url + "orders/%d/waybill" % number
contents = self.delete(url)
return contents

def void_return_waybill_order(self, number):
url = self.base_url + "orders/%d/return_waybill" % number
contents = self.delete(url)
return contents

def refresh_shipping_order(self, number):
Expand Down Expand Up @@ -142,6 +157,25 @@ def set_tracking_order(self, number, tracking_number, tracking_url):
)
return contents

def set_return_tracking_order(self, number, return_tracking_number, return_tracking_url):
url = self.base_url + "orders/%d/return_tracking" % number
contents = self.put(
url,
return_tracking_number = return_tracking_number,
return_tracking_url = return_tracking_url
)
return contents

def unset_tracking_order(self, number):
url = self.base_url + "orders/%d/tracking" % number
contents = self.delete(url)
return contents

def unset_return_tracking_order(self, number):
url = self.base_url + "orders/%d/return_tracking" % number
contents = self.delete(url)
return contents

def precustomization_order(self, number, tracking_number, tracking_url):
url = self.base_url + "orders/%d/tracking" % number
contents = self.put(
Expand Down

0 comments on commit 0157a68

Please sign in to comment.