Skip to content

Commit

Permalink
Added parent location requirement, upped ver
Browse files Browse the repository at this point in the history
  • Loading branch information
JMaynor committed Aug 26, 2024
1 parent b4e124c commit 7d774fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion ezoff/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,20 @@ def deactivate_location(location_num: int) -> dict:
@Decorators.check_env_vars
def update_location(location_num: int, location: dict) -> dict:
"""
Updates a location
Updates a location.
Note: The location's parent ID (location[parent_id]) is a required field for this call,
because EZOffice will wipe out whatever is currently in that field
if you don't include it. No idea why. If you're not changing the parent
location of the location, you just use the current parent ID. The documentation
also suggests that location[name] is a required field, but that doesn't appear
to be the case. Not sure if documentation is wrong or I'm misunderstanding what
they're saying.
https://ezo.io/ezofficeinventory/developers/#api-update-location
"""

if "location[parent_id]" not in location:
raise ValueError("'location[parent_id]' is a required key")

# Remove any keys that are not valid
valid_keys = [
"location[parent_id]",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name="ezoff",
version="0.1.3",
version="0.1.4",
description="Python package that acts as a wrapper for the EZOffice API.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 7d774fd

Please sign in to comment.