pike13-cli 0.1.4 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8bb3b0ce498fa5b9c978bf8f2f4cef26870687b7c5e5a2176b3c8ad83e7807f
4
- data.tar.gz: 1f9c9d0964a193d4b07b6fa20eff3135194563366673c6530f681b2706fe9890
3
+ metadata.gz: 3d9d5c24ee525f89caa0a7f089ad717f7b0b417ca884ffc3f61e9b209dc9e524
4
+ data.tar.gz: c406d8361b7f586c8b2b8331e30a32872a846c709242e26d0d24b0d93cce36d3
5
5
  SHA512:
6
- metadata.gz: 12cea95d296ffc7902fa15fb853804ef720a8418be0ed06a6c2e9b0698db09cc79b0c1d28098a9f987d6ab1e7608c46f387ff9ef220dd77109a301b440157193
7
- data.tar.gz: 85b94e997bcce49eb6b440cc26e1fcc36299859d4981d4a785280ae7d5b05c1654973afd3839dc674753b2035c4237403176fd5b8db1bb94eb76765dd3e6facf
6
+ metadata.gz: bbfb3bdbbff055122320ddb9f82c4182b189396557b1148d53da52a08c6f445d95dd3abd4d60a95c50b64692266ca90723fba1b6d4cd4368e8209685b3cb149d
7
+ data.tar.gz: 00cad077b09d7bef5b65e00085308f36c11420909334f2ea3fef6e9f4bcb4af742122560f83d64e55dfa7ff7a9f54e59aa2b04a54b5b4205e3bd55393b2e73c9
data/CHANGELOG.md CHANGED
@@ -5,6 +5,85 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.0] - 2025-11-18
9
+
10
+ ### Added
11
+ - **Comprehensive Parameter Support** - Added extensive filtering and query parameters to major endpoints
12
+ - **Desk People List Parameters**:
13
+ - `--created_since` - Filter to people created since given timestamp (ISO 8601)
14
+ - `--updated_since` - Filter to people updated since given timestamp (ISO 8601)
15
+ - `--is-member` - Filter to people with current membership (true/false)
16
+ - `--include-relationships` - Include providers and dependents for each person
17
+ - `--include-balances` - Include balances for each person
18
+ - `--sort` - Sort results by attributes (updated_at, created_at, id). Use - for descending
19
+ - **Desk Events List Parameters**:
20
+ - `--from` - Start date (YYYY-MM-DD or timestamp)
21
+ - `--to` - End date (YYYY-MM-DD or timestamp, max 120 days from from)
22
+ - `--ids` - Comma-separated event IDs
23
+ - `--service-ids` - Comma-separated service IDs
24
+ - **Desk Event Occurrences List Parameters**:
25
+ - `--from` - Start date (YYYY-MM-DD)
26
+ - `--to` - End date (YYYY-MM-DD)
27
+ - `--ids` - Comma-separated event occurrence IDs
28
+ - `--state` - Comma-separated states (active,canceled,reserved,deleted)
29
+ - `--staff-member-ids` - Comma-separated staff member IDs
30
+ - `--service-ids` - Comma-separated service IDs
31
+ - `--event-ids` - Comma-separated event IDs
32
+ - `--location-ids` - Comma-separated location IDs
33
+ - `--group-by` - Group results by (day,hour)
34
+ - **Front Events List Parameters**:
35
+ - Same parameters as desk events (from, to, ids, service_ids)
36
+ - **Front Event Occurrences List Parameters**:
37
+ - Same parameters as desk event occurrences (from, to, ids, state, staff_member_ids, service_ids, event_ids, location_ids)
38
+ - **Person Visits Parameters**:
39
+ - `--from` - Start date for visit time range (YYYY-MM-DD or timestamp)
40
+ - `--to` - End date for visit time range (YYYY-MM-DD or timestamp)
41
+ - `--event-occurrence-id` - Scope to a specific event occurrence
42
+ - **Event Occurrence Eligibilities Parameters**:
43
+ - `--person-ids` - Comma-separated person IDs for enrollment eligibility checking
44
+
45
+ ### Changed
46
+ - **Pike13 SDK Integration** - Updated to use Pike13 SDK v0.1.4 with enhanced parameter support
47
+ - **Improved Code Organization** - Refactored parameter building logic for better maintainability
48
+ - Extracted complex parameter building into separate helper methods
49
+ - Reduced method complexity and improved code readability
50
+ - Applied functional programming patterns for cleaner parameter handling
51
+ - **Enhanced Command Structure** - Improved error handling and date validation across all parameterized commands
52
+ - **Updated API Usage** - Fixed visits command structure to match actual API endpoints
53
+
54
+ ### Fixed
55
+ - **Broken Visit List Command** - Removed non-functional `desk visits list` command that used non-existent API endpoint
56
+ - Updated to use proper `desk person_visits list PERSON_ID` pattern instead
57
+ - Added comprehensive parameter support to person visits endpoint
58
+ - **SDK Compatibility Issues** - Updated SDK method signatures to support new parameter passing
59
+ - Modified `Pike13::Desk::Person.all()` to accept `**params`
60
+ - Modified `Pike13::Desk::Event.all()` to accept `**params`
61
+ - Modified `Pike13::Front::Event.all()` to accept `**params`
62
+ - **Code Quality** - Resolved all RuboCop style and complexity violations
63
+ - Fixed 13 RuboCop offenses including line length, method complexity, and style issues
64
+ - All 129 files now pass style checks with zero violations
65
+
66
+ ### Examples
67
+ ```bash
68
+ # Filter people by membership status
69
+ pike13 desk people list --is-member=true
70
+
71
+ # Sort people by most recently updated
72
+ pike13 desk people list --sort="-updated_at"
73
+
74
+ # Filter events by date range
75
+ pike13 desk events list --from="2025-01-01" --to="2025-01-31"
76
+
77
+ # Filter event occurrences by state and service
78
+ pike13 desk event_occurrences list --state="active" --service-ids="123,456"
79
+
80
+ # Get person's visits within date range
81
+ pike13 desk person_visits list 12345 --from="2025-01-01" --to="2025-01-31"
82
+
83
+ # Check enrollment eligibility for specific people
84
+ pike13 desk event_occurrences eligibilities 789 --person-ids="111,222,333"
85
+ ```
86
+
8
87
  ## [0.1.4] - 2025-11-16
9
88
 
10
89
  ### Fixed
data/README.md CHANGED
@@ -91,6 +91,84 @@ pike13 desk people update 123 --first-name "Jane"
91
91
  pike13 desk people delete 123
92
92
  ```
93
93
 
94
+ #### Advanced Filtering and Parameters
95
+
96
+ The CLI now supports comprehensive filtering and query parameters for major endpoints:
97
+
98
+ ##### People List Parameters
99
+
100
+ ```bash
101
+ # Filter people by membership status
102
+ pike13 desk people list --is-member=true
103
+ pike13 desk people list --is-member=false
104
+
105
+ # Filter by creation/update time
106
+ pike13 desk people list --created-since="2025-01-01T00:00:00Z"
107
+ pike13 desk people list --updated-since="2025-01-01T00:00:00Z"
108
+
109
+ # Include additional data
110
+ pike13 desk people list --include-relationships
111
+ pike13 desk people list --include-balances
112
+
113
+ # Sort results
114
+ pike13 desk people list --sort="updated_at"
115
+ pike13 desk people list --sort="-updated_at" # descending
116
+ pike13 desk people list --sort="created_at"
117
+ pike13 desk people list --sort="id"
118
+
119
+ # Combine multiple filters
120
+ pike13 desk people list --is-member=true --sort="-updated_at" --include-relationships
121
+ ```
122
+
123
+ ##### Events List Parameters
124
+
125
+ ```bash
126
+ # Filter by date range
127
+ pike13 desk events list --from="2025-01-01" --to="2025-01-31"
128
+
129
+ # Filter by specific IDs
130
+ pike13 desk events list --ids="123,456,789"
131
+ pike13 desk events list --service-ids="111,222"
132
+ ```
133
+
134
+ ##### Event Occurrences List Parameters
135
+
136
+ ```bash
137
+ # Filter by date range
138
+ pike13 desk event_occurrences list --from="2025-01-01" --to="2025-01-31"
139
+
140
+ # Filter by state
141
+ pike13 desk event_occurrences list --state="active"
142
+ pike13 desk event_occurrences list --state="active,canceled"
143
+
144
+ # Filter by staff, services, events, or locations
145
+ pike13 desk event_occurrences list --staff-member-ids="111,222"
146
+ pike13 desk event_occurrences list --service-ids="333,444"
147
+ pike13 desk event_occurrences list --event-ids="555,666"
148
+ pike13 desk event_occurrences list --location-ids="777,888"
149
+
150
+ # Group results
151
+ pike13 desk event_occurrences list --group-by="day"
152
+ pike13 desk event_occurrences list --group-by="hour"
153
+ ```
154
+
155
+ ##### Person Visits Parameters
156
+
157
+ ```bash
158
+ # Get visits for a specific person within date range
159
+ pike13 desk person_visits list 12345 --from="2025-01-01" --to="2025-01-31"
160
+
161
+ # Filter by specific event occurrence
162
+ pike13 desk person_visits list 12345 --event-occurrence-id=67890
163
+ ```
164
+
165
+ ##### Enrollment Eligibility Parameters
166
+
167
+ ```bash
168
+ # Check eligibility for specific people
169
+ pike13 desk event_occurrences eligibilities 789 --person-ids="111,222,333"
170
+ ```
171
+
94
172
  #### Business
95
173
 
96
174
  ```bash
@@ -107,14 +185,24 @@ pike13 desk events list
107
185
  # Get an event
108
186
  pike13 desk events get 100
109
187
 
110
- # List event occurrences
188
+ # List events with filtering
189
+ pike13 desk events list --from "2025-01-01" --to "2025-01-31"
190
+ pike13 desk events list --service-ids="123,456"
191
+
192
+ # Get an event
193
+ pike13 desk events get 100
194
+
195
+ # List event occurrences with advanced filtering
111
196
  pike13 desk event_occurrences list --from "2025-01-01" --to "2025-01-31"
197
+ pike13 desk event_occurrences list --state="active" --service-ids="123"
198
+ pike13 desk event_occurrences list --staff-member-ids="456" --group-by="day"
112
199
 
113
200
  # Get event occurrence
114
201
  pike13 desk event_occurrences get 789
115
202
 
116
- # Get enrollment eligibilities
203
+ # Get enrollment eligibilities with person filtering
117
204
  pike13 desk event_occurrences eligibilities 789
205
+ pike13 desk event_occurrences eligibilities 789 --person-ids="111,222,333"
118
206
  ```
119
207
 
120
208
  #### Event Occurrence Notes
@@ -285,8 +373,13 @@ Client-facing interface with limited read-only access:
285
373
  # Get authenticated client user (only)
286
374
  pike13 front people me
287
375
 
288
- # List events (client view)
289
- pike13 front events list
376
+ # List events (client view) with filtering
377
+ pike13 front events list --from="2025-01-01" --to="2025-01-31"
378
+ pike13 front events list --service-ids="123,456"
379
+
380
+ # List event occurrences (client view) with filtering
381
+ pike13 front event_occurrences list --from="2025-01-01" --to="2025-01-31"
382
+ pike13 front event_occurrences list --state="active" --service-ids="123"
290
383
 
291
384
  # List locations (client view)
292
385
  pike13 front locations list
@@ -8,10 +8,16 @@ module Pike13
8
8
  desc "list", "List all events"
9
9
  map "ls" => :list
10
10
  format_options
11
+ option :from, type: :string, desc: "Start date (YYYY-MM-DD or timestamp)"
12
+ option :to, type: :string, desc: "End date (YYYY-MM-DD or timestamp, max 120 days from from)"
13
+ option :ids, type: :string, desc: "Comma-separated event IDs"
14
+ option :service_ids, type: :string, desc: "Comma-separated service IDs"
11
15
  def list
16
+ validate_event_date_formats
12
17
  handle_error do
18
+ params = build_event_params
13
19
  result = with_progress("Fetching events") do
14
- Pike13::Desk::Event.all
20
+ Pike13::Desk::Event.all(**params)
15
21
  end
16
22
  output(result)
17
23
  end
@@ -25,6 +31,22 @@ module Pike13
25
31
  output(result)
26
32
  end
27
33
  end
34
+
35
+ private
36
+
37
+ def validate_event_date_formats
38
+ validate_date_format(options[:from], "from") if options[:from]
39
+ validate_date_format(options[:to], "to") if options[:to]
40
+ end
41
+
42
+ def build_event_params
43
+ params = {}
44
+ params[:from] = options[:from] if options[:from]
45
+ params[:to] = options[:to] if options[:to]
46
+ params[:ids] = options[:ids] if options[:ids]
47
+ params[:service_ids] = options[:service_ids] if options[:service_ids]
48
+ params
49
+ end
28
50
  end
29
51
  end
30
52
  end
@@ -14,16 +14,17 @@ module Pike13
14
14
  format_options
15
15
  option :from, type: :string, desc: "Start date (YYYY-MM-DD)"
16
16
  option :to, type: :string, desc: "End date (YYYY-MM-DD)"
17
+ option :ids, type: :string, desc: "Comma-separated event occurrence IDs"
18
+ option :state, type: :string, desc: "Comma-separated states (active,canceled,reserved,deleted)"
19
+ option :staff_member_ids, type: :string, desc: "Comma-separated staff member IDs"
20
+ option :service_ids, type: :string, desc: "Comma-separated service IDs"
21
+ option :event_ids, type: :string, desc: "Comma-separated event IDs"
22
+ option :location_ids, type: :string, desc: "Comma-separated location IDs"
23
+ option :group_by, type: :string, desc: "Group results by (day,hour)"
17
24
  def list
18
- # Validate date formats
19
- validate_date_format(options[:from], "from") if options[:from]
20
- validate_date_format(options[:to], "to") if options[:to]
21
-
25
+ validate_event_occurrence_date_formats
22
26
  handle_error do
23
- params = {}
24
- params[:from] = options[:from] if options[:from]
25
- params[:to] = options[:to] if options[:to]
26
-
27
+ params = build_event_occurrence_params
27
28
  result = with_progress("Fetching event occurrences") do
28
29
  Pike13::Desk::EventOccurrence.all(**params)
29
30
  end
@@ -51,12 +52,28 @@ module Pike13
51
52
 
52
53
  desc "eligibilities ID", "Get enrollment eligibilities for an event occurrence"
53
54
  format_options
55
+ option :person_ids, type: :string, desc: "Comma-separated person IDs"
54
56
  def eligibilities(id)
55
57
  handle_error do
56
- result = Pike13::Desk::EventOccurrence.enrollment_eligibilities(id: id)
58
+ params = { id: id }
59
+ params[:person_ids] = options[:person_ids] if options[:person_ids]
60
+
61
+ result = Pike13::Desk::EventOccurrence.enrollment_eligibilities(**params)
57
62
  output(result)
58
63
  end
59
64
  end
65
+
66
+ private
67
+
68
+ def validate_event_occurrence_date_formats
69
+ validate_date_format(options[:from], "from") if options[:from]
70
+ validate_date_format(options[:to], "to") if options[:to]
71
+ end
72
+
73
+ def build_event_occurrence_params
74
+ %i[from to ids state staff_member_ids service_ids event_ids location_ids group_by]
75
+ .each_with_object({}) { |key, params| params[key] = options[key] if options[key] }
76
+ end
60
77
  end
61
78
  end
62
79
  end
@@ -8,10 +8,18 @@ module Pike13
8
8
  desc "list", "List all people"
9
9
  map "ls" => :list
10
10
  format_options
11
+ option :created_since, type: :string, desc: "Filter to people created since given timestamp (ISO 8601)"
12
+ option :updated_since, type: :string, desc: "Filter to people updated since given timestamp (ISO 8601)"
13
+ option :is_member, type: :boolean, desc: "Filter to people with current membership"
14
+ option :include_relationships, type: :boolean, desc: "Include providers and dependents for each person"
15
+ option :include_balances, type: :boolean, desc: "Include balances for each person"
16
+ option :sort, type: :string,
17
+ desc: "Sort results by attributes (updated_at, created_at, id). Use - for descending"
11
18
  def list
12
19
  handle_error do
20
+ params = build_person_params
13
21
  result = with_progress("Fetching people") do
14
- Pike13::Desk::Person.all
22
+ Pike13::Desk::Person.all(**params)
15
23
  end
16
24
  output(result)
17
25
  end
@@ -91,6 +99,21 @@ module Pike13
91
99
  success_message "Person #{id} deleted successfully"
92
100
  end
93
101
  end
102
+
103
+ private
104
+
105
+ def build_person_params
106
+ params = {}
107
+ params[:created_since] = options[:created_since] if options[:created_since]
108
+ params[:updated_since] = options[:updated_since] if options[:updated_since]
109
+ params[:is_member] = options[:is_member] unless options[:is_member].nil?
110
+ [
111
+ [:include_relationships, options[:include_relationships]],
112
+ [:include_balances, options[:include_balances]],
113
+ [:sort, options[:sort]]
114
+ ].each { |key, value| params[key] = value if value }
115
+ params
116
+ end
94
117
  end
95
118
  end
96
119
  end
@@ -12,10 +12,21 @@ module Pike13
12
12
  desc "list PERSON_ID", "List visits for a person"
13
13
  map "ls" => :list
14
14
  format_options
15
+ option :from, type: :string, desc: "Start date for visit time range (YYYY-MM-DD or timestamp)"
16
+ option :to, type: :string, desc: "End date for visit time range (YYYY-MM-DD or timestamp)"
17
+ option :event_occurrence_id, type: :numeric, desc: "Scope to a specific event occurrence"
15
18
  def list(person_id)
19
+ validate_date_format(options[:from], "from") if options[:from]
20
+ validate_date_format(options[:to], "to") if options[:to]
21
+
16
22
  handle_error do
17
- result = with_progress("Fetching person visits") do
18
- Pike13::Desk::PersonVisit.all(person_id: person_id)
23
+ params = {}
24
+ params[:from] = options[:from] if options[:from]
25
+ params[:to] = options[:to] if options[:to]
26
+ params[:event_occurrence_id] = options[:event_occurrence_id] if options[:event_occurrence_id]
27
+
28
+ result = with_progress("Fetching visits for person #{person_id}") do
29
+ Pike13::Desk::PersonVisit.all(person_id: person_id, **params)
19
30
  end
20
31
  output(result)
21
32
  end
@@ -5,18 +5,6 @@ module Pike13
5
5
  module Commands
6
6
  class Desk < Base
7
7
  class Visit < Base
8
- desc "list", "List all visits"
9
- map "ls" => :list
10
- format_options
11
- def list
12
- handle_error do
13
- result = with_progress("Fetching visits") do
14
- Pike13::Desk::Visit.all
15
- end
16
- output(result)
17
- end
18
- end
19
-
20
8
  desc "get ID", "Get a visit by ID"
21
9
  format_options
22
10
  def get(id)
@@ -7,14 +7,36 @@ module Pike13
7
7
  class Event < Base
8
8
  desc "list", "List events (client view)"
9
9
  format_options
10
+ option :from, type: :string, desc: "Start date (YYYY-MM-DD or timestamp)"
11
+ option :to, type: :string, desc: "End date (YYYY-MM-DD or timestamp, max 120 days from from)"
12
+ option :ids, type: :string, desc: "Comma-separated event IDs"
13
+ option :service_ids, type: :string, desc: "Comma-separated service IDs"
10
14
  def list
15
+ validate_front_event_date_formats
11
16
  handle_error do
17
+ params = build_front_event_params
12
18
  result = with_progress("Fetching events") do
13
- Pike13::Front::Event.all
19
+ Pike13::Front::Event.all(**params)
14
20
  end
15
21
  output(result)
16
22
  end
17
23
  end
24
+
25
+ private
26
+
27
+ def validate_front_event_date_formats
28
+ validate_date_format(options[:from], "from") if options[:from]
29
+ validate_date_format(options[:to], "to") if options[:to]
30
+ end
31
+
32
+ def build_front_event_params
33
+ params = {}
34
+ params[:from] = options[:from] if options[:from]
35
+ params[:to] = options[:to] if options[:to]
36
+ params[:ids] = options[:ids] if options[:ids]
37
+ params[:service_ids] = options[:service_ids] if options[:service_ids]
38
+ params
39
+ end
18
40
  end
19
41
  end
20
42
  end
@@ -13,21 +13,34 @@ module Pike13
13
13
  format_options
14
14
  option :from, type: :string, desc: "Start date (YYYY-MM-DD)"
15
15
  option :to, type: :string, desc: "End date (YYYY-MM-DD)"
16
+ option :ids, type: :string, desc: "Comma-separated event occurrence IDs"
17
+ option :state, type: :string, desc: "Comma-separated states (active,canceled,reserved,deleted)"
18
+ option :staff_member_ids, type: :string, desc: "Comma-separated staff member IDs"
19
+ option :service_ids, type: :string, desc: "Comma-separated service IDs"
20
+ option :event_ids, type: :string, desc: "Comma-separated event IDs"
21
+ option :location_ids, type: :string, desc: "Comma-separated location IDs"
16
22
  def list
17
- validate_date_format(options[:from], "from") if options[:from]
18
- validate_date_format(options[:to], "to") if options[:to]
19
-
23
+ validate_front_event_occurrence_date_formats
20
24
  handle_error do
21
- params = {}
22
- params[:from] = options[:from] if options[:from]
23
- params[:to] = options[:to] if options[:to]
24
-
25
+ params = build_front_event_occurrence_params
25
26
  result = with_progress("Fetching event occurrences") do
26
27
  Pike13::Front::EventOccurrence.all(**params)
27
28
  end
28
29
  output(result)
29
30
  end
30
31
  end
32
+
33
+ private
34
+
35
+ def validate_front_event_occurrence_date_formats
36
+ validate_date_format(options[:from], "from") if options[:from]
37
+ validate_date_format(options[:to], "to") if options[:to]
38
+ end
39
+
40
+ def build_front_event_occurrence_params
41
+ %i[from to ids state staff_member_ids service_ids event_ids location_ids]
42
+ .each_with_object({}) { |key, params| params[key] = options[key] if options[key] }
43
+ end
31
44
  end
32
45
  end
33
46
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pike13
4
4
  module CLI
5
- VERSION = "0.1.4"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pike13-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pike13 CLI Contributors