papi-projects 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: papi-projects
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: PAPI is an API for managing projects
5
5
  License: MIT
6
6
  Author: sandyjmacdonald
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "papi-projects"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "PAPI is an API for managing projects"
5
5
  authors = ["sandyjmacdonald <sandyjmacdonald@gmail.com>"]
6
6
  license = "MIT"
@@ -51,24 +51,24 @@ def main():
51
51
  project_name = args.name
52
52
  project_id = args.project_id
53
53
 
54
- if user_id and not user_name:
55
- user = User(user_id=user_id)
56
- elif user_name and not user_id:
57
- user = User(user_name)
58
- elif user_id and user_name:
59
- user = User(user_name, user_id=user_id)
60
- else:
61
- logger.warning("Please provide either a three-letter user ID and/or user name")
62
- return
63
-
64
54
  if project_id and not project_name:
65
55
  project = Project(id=project_id)
56
+ user_id = project.user_id
57
+ user = User(user_id=user_id)
66
58
  elif project_name and not project_id:
59
+ if user_id and not user_name:
60
+ user = User(user_id=user_id)
61
+ elif user_name and not user_id:
62
+ user = User(user_name)
63
+ elif user_id and user_name:
64
+ user = User(user_name, user_id=user_id)
67
65
  project = Project(name=project_name, user_id=user.user_id)
68
66
  elif project_id and project_name:
69
67
  project = Project(name=project_name, id=project_id)
68
+ user_id = project.user_id
69
+ user = User(user_id=user_id)
70
70
  else:
71
- logger.warning("Please provide either a valid project ID and/or project name")
71
+ logger.warning("Please provide either a valid project ID or valid three-letter user ID")
72
72
  return
73
73
 
74
74
  # Create project on Notion
@@ -108,24 +108,24 @@ def main():
108
108
  enable_toggl = args.enable_toggl
109
109
  enable_notion = args.enable_notion
110
110
 
111
- if user_id and not user_name:
112
- user = User(user_id=user_id)
113
- elif user_name and not user_id:
114
- user = User(user_name)
115
- elif user_id and user_name:
116
- user = User(user_name, user_id=user_id)
117
- else:
118
- logger.warning("Please provide either a three-letter user ID and/or user name")
119
- return
120
-
121
111
  if project_id and not project_name:
122
112
  project = Project(id=project_id)
113
+ user_id = project.user_id
114
+ user = User(user_id=user_id)
123
115
  elif project_name and not project_id:
116
+ if user_id and not user_name:
117
+ user = User(user_id=user_id)
118
+ elif user_name and not user_id:
119
+ user = User(user_name)
120
+ elif user_id and user_name:
121
+ user = User(user_name, user_id=user_id)
124
122
  project = Project(name=project_name, user_id=user.user_id)
125
123
  elif project_id and project_name:
126
124
  project = Project(name=project_name, id=project_id)
125
+ user_id = project.user_id
126
+ user = User(user_id=user_id)
127
127
  else:
128
- logger.warning("Please provide either a valid project ID and/or project name")
128
+ logger.warning("Please provide either a valid project ID or valid three-letter user ID")
129
129
  return
130
130
 
131
131
  if enable_toggl:
@@ -53,28 +53,18 @@ def main():
53
53
  project_name = args.name
54
54
  project_id = args.project_id
55
55
 
56
- if not project_id and user_id:
57
- # Create project instance, grant code and name are optional
58
- if grant_code and project_name:
59
- project = Project(user_id=user_id, grant_code=grant_code, name=project_name)
60
- elif grant_code and not project_name:
61
- project = Project(user_id=user_id, grant_code=grant_code)
62
- elif not grant_code and project_name:
63
- project = Project(user_id=user_id, name=project_name)
56
+ if project_id and not project_name:
57
+ project = Project(id=project_id)
58
+ elif project_name and not project_id:
59
+ if user_id:
60
+ project = Project(name=project_name, user_id=user_id)
64
61
  else:
65
- project = Project(user_id=user_id)
66
- elif not user_id and project_id:
67
- # Create project instance, grant code and name are optional
68
- if grant_code and project_name:
69
- project = Project(id=project_id, grant_code=grant_code, name=project_name)
70
- elif grant_code and not project_name:
71
- project = Project(id=project_id, grant_code=grant_code)
72
- elif not grant_code and project_name:
73
- project = Project(id=project_id, name=project_name)
74
- else:
75
- project = Project(id=project_id)
62
+ logger.warning("Please provide either a valid project ID or valid three-letter user ID")
63
+ return
64
+ elif project_id and project_name:
65
+ project = Project(name=project_name, id=project_id)
76
66
  else:
77
- logger.warning("Please provide either a three-letter user_id *or* a full project_id")
67
+ logger.warning("Please provide either a valid project ID or valid three-letter user ID")
78
68
  return
79
69
 
80
70
  # Create project on Toggl Track
File without changes