Skip to content

Commit

Permalink
Merge pull request #70 from Shopify/carrier-service-format
Browse files Browse the repository at this point in the history
Add format setter and getter to CarrierService resource.
  • Loading branch information
dylanahsmith committed Jul 17, 2014
2 parents 68a9985 + c227d3b commit 4e98247
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions 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
Expand Down
8 changes: 7 additions & 1 deletion shopify/resources/carrier_service.py
Expand Up @@ -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")
8 changes: 7 additions & 1 deletion shopify/resources/fulfillment_service.py
Expand Up @@ -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")
5 changes: 5 additions & 0 deletions test/carrier_service_test.py
Expand Up @@ -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'])
5 changes: 5 additions & 0 deletions test/fulfillment_service_test.py
Expand Up @@ -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'])

0 comments on commit 4e98247

Please sign in to comment.