Package passtools :: Module pt_pass :: Class Pass
[hide private]
[frames] | no frames]

Class Pass

source code

object --+
         |
        Pass

Instance Methods [hide private]
 
__init__(self, template_id=None, template_fields_model_dict=None)
Init, optionally populate, new pt_pass.Pass instance If template_id and template_fields_model are supplied, will create new complete instance, else just create empty instance.
source code
 
id(self) source code
 
template_id(self) source code
 
__str__(self)
str(x)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]
 
create(cls, template_id, template_fields_model_dict)
Create new Pass from specified template.
source code
 
update(cls, pass_id, update_fields)
Update existing pass
source code
 
push_update(cls, pass_id)
Update installed passes using push method
source code
 
get(cls, pass_id)
Retrieve existing pass with specified ID
source code
 
list(cls, **kwargs)
Retrieve list of existing passes created by owner of API-key If template_id is specified, retrieve only passes associated with that template Other parameters are translated into query-modifiers
source code
 
download(cls, pass_id, destination_path)
Download pkpass file corresponding to existing pass with specified ID
source code
 
delete(cls, pass_id)
delete existing pass
source code
 
add_locations(cls, pass_id, location_list)
add locations to an existing pass
source code
 
delete_location(cls, pass_id, location_id)
delete existing location from pass
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, template_id=None, template_fields_model_dict=None)
(Constructor)

source code 

Init, optionally populate, new pt_pass.Pass instance If template_id and template_fields_model are supplied, will create new complete instance, else just create empty instance.

API call used is v1/pass/<template_id> (POST)

Parameters:
  • template_id (int) - ID of the template used to create new pass [Optional]
  • template_fields_model_dict (dict) - template_fields_model dict of the template used to create new pass [Optional]
Returns:
None
Overrides: object.__init__

id(self)

source code 
Decorators:
  • @property

template_id(self)

source code 
Decorators:
  • @property

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

create(cls, template_id, template_fields_model_dict)
Class Method

source code 

Create new Pass from specified template.

API call used is v1/pass/<template_id> (POST)

Parameters:
  • template_id (int) - ID of the template used to create new pass
  • template_fields_model_dict (dict) - template_fields_model dict of the template used to create new pass
Returns:
json form of template full-form description

update(cls, pass_id, update_fields)
Class Method

source code 

Update existing pass

API call used is v1/pass/<pass_id> (PUT)

Parameters:
  • pass_id (int) - ID of desired Pass
  • update_fields (dict) - Pass.pass_dict dict
Returns:
json form of template full-form description

push_update(cls, pass_id)
Class Method

source code 

Update installed passes using push method

API call used is v1/pass/<pass_id>/push (PUT)

Parameters:
  • pass_id (int) - ID of desired Pass
Returns:
Response data

get(cls, pass_id)
Class Method

source code 

Retrieve existing pass with specified ID

API call used is v1/pass/<pass_id> (GET)

Parameters:
  • pass_id (int) - ID of desired Pass
Returns:
json form of template full-form description

list(cls, **kwargs)
Class Method

source code 

Retrieve list of existing passes created by owner of API-key If template_id is specified, retrieve only passes associated with that template Other parameters are translated into query-modifiers

Note that list() returns abbreviated form of passes. Use get() to retrieve full pass.

API call used is v1/pass (GET)

Parameters:
  • templateId (int) - ID of the template used to create new pass
  • pageSize (int) - Maximum length of list to return [Optional; Default = 10]
  • page (int) - 1-based index of page into list, based on page_size [Optional; Default = 1]
  • order (string) - Name of field on which to sort list [Optional; From (ID, Name, Created, Updated)]
  • direction (string) - Direction which to sort list [Optional; From (ASC, DESC); Default = DESC]
Returns:
json form of list of pass header descriptions

download(cls, pass_id, destination_path)
Class Method

source code 

Download pkpass file corresponding to existing pass with specified ID

API call used is v1/pass/<pass_id>/download (GET)

Parameters:
  • pass_id (int) - ID of desired Pass
  • destination_path (str) - path to receive pass file. Path must exist, and filename must end with ".pkpass"
Returns:
Writes pass to filesystem

delete(cls, pass_id)
Class Method

source code 

delete existing pass

API call used is v1/pass/<pass_id> (DELETE)

Parameters:
  • pass_id (int) - ID of Pass to delete
Returns:
json form of response data

add_locations(cls, pass_id, location_list)
Class Method

source code 

add locations to an existing pass

API call used is v1/pass/<pass_id>/locations (POST)

Parameters:
  • pass_id (int) - ID of the pass to add locations to
  • location_list (list) - list of locations to add
Returns:
json form of response data

delete_location(cls, pass_id, location_id)
Class Method

source code 

delete existing location from pass

API call used is v1/pass/<pass_id>/location/<location_id> (DELETE)

Parameters:
  • pass_id (int) - ID of the pass to delete from
  • location_id (int) - ID of the location to delete
Returns:
json form of response data