diff --git a/CHANGELOG b/CHANGELOG index 5d81ec2c..3b0300bc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ == Version 2.1.0 unreleased * Added python 3 compatibility +* Fixed setting the format attribute on carrier and fulfillment services * Add a specific exception for signature validation failures == Version 2.0.4 diff --git a/shopify/resources/carrier_service.py b/shopify/resources/carrier_service.py index 1dfdbb08..635e9d0a 100644 --- a/shopify/resources/carrier_service.py +++ b/shopify/resources/carrier_service.py @@ -2,4 +2,10 @@ class CarrierService(ShopifyResource): - pass + def __get_format(self): + return self.attributes.get("format") + + def __set_format(self, data): + self.attributes["format"] = data + + format = property(__get_format, __set_format, None, "Format attribute") diff --git a/shopify/resources/fulfillment_service.py b/shopify/resources/fulfillment_service.py index f303fe38..c2c465b7 100644 --- a/shopify/resources/fulfillment_service.py +++ b/shopify/resources/fulfillment_service.py @@ -2,4 +2,10 @@ class FulfillmentService(ShopifyResource): - pass + def __get_format(self): + return self.attributes.get("format") + + def __set_format(self, data): + self.attributes["format"] = data + + format = property(__get_format, __set_format, None, "Format attribute") diff --git a/test/carrier_service_test.py b/test/carrier_service_test.py index 955a6bdf..fbd96180 100644 --- a/test/carrier_service_test.py +++ b/test/carrier_service_test.py @@ -13,3 +13,8 @@ def test_get_carrier_service(self): carrier_service = shopify.CarrierService.find(123456) self.assertEqual("Some Postal Service", carrier_service.name) + + def test_set_format_attribute(self): + carrier_service = shopify.CarrierService() + carrier_service.format = "json" + self.assertEqual("json", carrier_service.attributes['format']) diff --git a/test/fulfillment_service_test.py b/test/fulfillment_service_test.py index a1549f49..81296698 100644 --- a/test/fulfillment_service_test.py +++ b/test/fulfillment_service_test.py @@ -13,3 +13,8 @@ def test_get_fulfillment_service(self): fulfillment_service = shopify.FulfillmentService.find(123456) self.assertEqual("SomeService", fulfillment_service.name) + + def test_set_format_attribute(self): + fulfillment_service = shopify.FulfillmentService() + fulfillment_service.format = "json" + self.assertEqual("json", fulfillment_service.attributes['format'])