devartis / passbook

Python library to create Apple Passbook (.pkpass) files
http://www.devartis.com/
MIT License
276 stars 112 forks source link

Add methods for adding header and auxiliary fields #19

Closed thijstriemstra closed 11 years ago

thijstriemstra commented 11 years ago

I'm not sure why they're missing but it would be nice to have these convenience methods as well:

diff --git a/passbook/models.py b/passbook/models.py
index bfcbc6b..f3eaf8d 100644
--- a/passbook/models.py
+++ b/passbook/models.py
@@ -121,12 +121,18 @@ class PassInformation(object):
         self.backFields = []
         self.auxiliaryFields = []

+    def addHeaderField(self, key, value, label):
+        self.headerFields.append(Field(key, value, label))
+
     def addPrimaryField(self, key, value, label):
         self.primaryFields.append(Field(key, value, label))

     def addSecondaryField(self, key, value, label):
         self.secondaryFields.append(Field(key, value, label))

+    def addAuxiliaryField(self, key, value, label):
+        self.auxiliaryFields.append(Field(key, value, label))
+
     def addBackField(self, key, value, label):
         self.backFields.append(Field(key, value, label))
fara commented 11 years ago

Thanks, fixed on latest version.