pike13 0.1.1 → 0.1.3
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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +20 -3
- data/lib/pike13/api/v2/account/business.rb +0 -1
- data/lib/pike13/api/v2/desk/custom_field.rb +0 -5
- data/lib/pike13/api/v2/desk/make_up.rb +0 -5
- data/lib/pike13/validators.rb +12 -34
- data/lib/pike13/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6987b081753d6939cce1fb2783a3a6f68f1c5f44b8ba10b9de091e2de5ca4b6a
|
|
4
|
+
data.tar.gz: 755fd58715c57734e68276d5e05e3893ba47321f871a4dde3197347db7299577
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d65e0c49d5ed5f749c55504da384f9d2b52be2e16632dadea2f1d14e932edf135842be1626863aff8e1affe4f0c714fbcaf23d1bd21924081a79289b0ac8a62f
|
|
7
|
+
data.tar.gz: 16b8ae4034dd0d6da0769f9e0d93a80c5165c0bdc5248523618a35f3442219fa2c7387960208860c682e4ba96819022a28c1d315a1a82b73ff90c830fa067c6c
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ 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.1.3] - 2025-11-13
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Desk::CustomField**: Removed unsupported `find(id)` method that was not supported by the Pike13 API v2.
|
|
12
|
+
|
|
13
|
+
## [0.1.2] - 2025-11-06
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- **Desk::MakeUp**: Removed unsupported `find(id)` method that was not supported by the Pike13 API v2.
|
|
17
|
+
|
|
8
18
|
## [0.1.1] - 2025-11-02
|
|
9
19
|
|
|
10
20
|
### Fixed
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Pike13 Ruby Client
|
|
2
2
|
|
|
3
|
+
[](https://github.com/juanhuttemann/pike13-ruby/actions/workflows/ci.yml)
|
|
4
|
+
|
|
3
5
|
A Ruby gem for interacting with the Pike13 API, supporting both:
|
|
4
6
|
- **[Core API](https://developer.pike13.com/docs/api/v2)** - CRUD operations for managing people, events, invoices, and more
|
|
5
7
|
- **[Reporting API](https://developer.pike13.com/docs/reporting/v3)** - Advanced analytics and reporting queries
|
|
@@ -128,6 +130,9 @@ Pike13::Desk::Person.destroy(123)
|
|
|
128
130
|
```ruby
|
|
129
131
|
# Get business details
|
|
130
132
|
Pike13::Desk::Business.find
|
|
133
|
+
|
|
134
|
+
# Get franchisees (for franchise businesses)
|
|
135
|
+
Pike13::Desk::Business.franchisees
|
|
131
136
|
```
|
|
132
137
|
|
|
133
138
|
#### Events & Event Occurrences
|
|
@@ -177,10 +182,17 @@ Pike13::Desk::Appointment.available_slots_summary(
|
|
|
177
182
|
**Note:** Creating bookings requires an `idempotency_token` parameter to prevent duplicate bookings.
|
|
178
183
|
|
|
179
184
|
```ruby
|
|
185
|
+
# Booking operations
|
|
180
186
|
Pike13::Desk::Booking.find(123)
|
|
181
187
|
Pike13::Desk::Booking.create(event_occurrence_id: 789, person_id: 123, idempotency_token: SecureRandom.uuid)
|
|
182
188
|
Pike13::Desk::Booking.update(456, state: "completed")
|
|
183
189
|
Pike13::Desk::Booking.destroy(456)
|
|
190
|
+
|
|
191
|
+
# Lease management within bookings
|
|
192
|
+
Pike13::Desk::Booking.find_lease(booking_id: 123, id: 456)
|
|
193
|
+
Pike13::Desk::Booking.create_lease(123, event_occurrence_id: 789, person: { id: 1 })
|
|
194
|
+
Pike13::Desk::Booking.update_lease(123, 456, person: { id: 2 })
|
|
195
|
+
Pike13::Desk::Booking.destroy_lease(123, 456)
|
|
184
196
|
```
|
|
185
197
|
|
|
186
198
|
#### Visits
|
|
@@ -256,7 +268,6 @@ Pike13::Desk::Note.destroy(person_id: 123, id: 1000)
|
|
|
256
268
|
#### Make-Ups
|
|
257
269
|
|
|
258
270
|
```ruby
|
|
259
|
-
Pike13::Desk::MakeUp.find(1100) # Find make-up
|
|
260
271
|
Pike13::Desk::MakeUp.reasons # List make-up reasons
|
|
261
272
|
Pike13::Desk::MakeUp.generate(visit_id: 456, make_up_reason_id: 5, free_form_reason: "Client was sick")
|
|
262
273
|
```
|
|
@@ -272,7 +283,6 @@ Pike13::Desk::WaitlistEntry.find(1200) # Find waitlist entry
|
|
|
272
283
|
|
|
273
284
|
```ruby
|
|
274
285
|
Pike13::Desk::CustomField.all # List custom fields
|
|
275
|
-
Pike13::Desk::CustomField.find(30) # Find custom field
|
|
276
286
|
```
|
|
277
287
|
|
|
278
288
|
#### Person-Related Resources
|
|
@@ -297,6 +307,7 @@ Client-facing interface with limited read-only access.
|
|
|
297
307
|
|
|
298
308
|
```ruby
|
|
299
309
|
Pike13::Front::Business.find # Get business info
|
|
310
|
+
Pike13::Front::Business.franchisees # Get franchisees (for franchise businesses)
|
|
300
311
|
Pike13::Front::Branding.find # Get branding
|
|
301
312
|
```
|
|
302
313
|
|
|
@@ -332,11 +343,17 @@ Pike13::Front::Appointment.available_slots_summary(service_id: 100, from: "2025-
|
|
|
332
343
|
**Note:** Creating bookings requires an `idempotency_token` parameter to prevent duplicate bookings.
|
|
333
344
|
|
|
334
345
|
```ruby
|
|
346
|
+
# Booking operations
|
|
335
347
|
Pike13::Front::Booking.find(123)
|
|
336
|
-
Pike13::Front::Booking.find_lease(booking_id: 123, id: 456)
|
|
337
348
|
Pike13::Front::Booking.create(event_occurrence_id: 789, person_id: 123, idempotency_token: SecureRandom.uuid)
|
|
338
349
|
Pike13::Front::Booking.update(456, state: "completed")
|
|
339
350
|
Pike13::Front::Booking.destroy(456)
|
|
351
|
+
|
|
352
|
+
# Lease management within bookings
|
|
353
|
+
Pike13::Front::Booking.find_lease(booking_id: 123, id: 456)
|
|
354
|
+
Pike13::Front::Booking.create_lease(123, event_occurrence_id: 789, person: { id: 1 })
|
|
355
|
+
Pike13::Front::Booking.update_lease(123, 456, person: { id: 2 })
|
|
356
|
+
Pike13::Front::Booking.destroy_lease(123, 456)
|
|
340
357
|
```
|
|
341
358
|
|
|
342
359
|
#### Visits
|
data/lib/pike13/validators.rb
CHANGED
|
@@ -11,13 +11,9 @@ module Pike13
|
|
|
11
11
|
# @raise [ValidationError] if token is invalid
|
|
12
12
|
# @return [Boolean] true if valid
|
|
13
13
|
def self.validate_idempotency_token!(token)
|
|
14
|
-
if token.nil? || token.to_s.strip.empty?
|
|
15
|
-
raise ValidationError, "Idempotency token cannot be blank"
|
|
16
|
-
end
|
|
14
|
+
raise ValidationError, "Idempotency token cannot be blank" if token.nil? || token.to_s.strip.empty?
|
|
17
15
|
|
|
18
|
-
unless token.is_a?(String)
|
|
19
|
-
raise ValidationError, "Idempotency token must be a string, got #{token.class}"
|
|
20
|
-
end
|
|
16
|
+
raise ValidationError, "Idempotency token must be a string, got #{token.class}" unless token.is_a?(String)
|
|
21
17
|
|
|
22
18
|
if token.length > 255
|
|
23
19
|
raise ValidationError, "Idempotency token must be 255 characters or less, got #{token.length}"
|
|
@@ -32,9 +28,7 @@ module Pike13
|
|
|
32
28
|
# @raise [ValidationError] if attributes are invalid
|
|
33
29
|
# @return [Boolean] true if valid
|
|
34
30
|
def self.validate_note_attributes!(attributes)
|
|
35
|
-
unless attributes.is_a?(Hash)
|
|
36
|
-
raise ValidationError, "Note attributes must be a hash, got #{attributes.class}"
|
|
37
|
-
end
|
|
31
|
+
raise ValidationError, "Note attributes must be a hash, got #{attributes.class}" unless attributes.is_a?(Hash)
|
|
38
32
|
|
|
39
33
|
if attributes.key?(:body) || attributes.key?("body")
|
|
40
34
|
raise ValidationError,
|
|
@@ -47,9 +41,7 @@ module Pike13
|
|
|
47
41
|
end
|
|
48
42
|
|
|
49
43
|
note_value = attributes[:note] || attributes["note"]
|
|
50
|
-
if note_value.to_s.strip.empty?
|
|
51
|
-
raise ValidationError, "Note text cannot be blank"
|
|
52
|
-
end
|
|
44
|
+
raise ValidationError, "Note text cannot be blank" if note_value.to_s.strip.empty?
|
|
53
45
|
|
|
54
46
|
true
|
|
55
47
|
end
|
|
@@ -62,13 +54,11 @@ module Pike13
|
|
|
62
54
|
def self.validate_form_of_payment_type!(type)
|
|
63
55
|
valid_types = %w[creditcard ach]
|
|
64
56
|
|
|
65
|
-
unless type.is_a?(String)
|
|
66
|
-
raise ValidationError, "Form of payment type must be a string, got #{type.class}"
|
|
67
|
-
end
|
|
57
|
+
raise ValidationError, "Form of payment type must be a string, got #{type.class}" unless type.is_a?(String)
|
|
68
58
|
|
|
69
59
|
unless valid_types.include?(type.downcase)
|
|
70
60
|
raise ValidationError,
|
|
71
|
-
"Form of payment type must be one of: #{valid_types.join(
|
|
61
|
+
"Form of payment type must be one of: #{valid_types.join(", ")}. Got: '#{type}'"
|
|
72
62
|
end
|
|
73
63
|
|
|
74
64
|
true
|
|
@@ -80,15 +70,11 @@ module Pike13
|
|
|
80
70
|
# @raise [ValidationError] if parameters are invalid
|
|
81
71
|
# @return [Boolean] true if valid
|
|
82
72
|
def self.validate_booking_params!(params)
|
|
83
|
-
unless params.is_a?(Hash)
|
|
84
|
-
raise ValidationError, "Booking parameters must be a hash, got #{params.class}"
|
|
85
|
-
end
|
|
73
|
+
raise ValidationError, "Booking parameters must be a hash, got #{params.class}" unless params.is_a?(Hash)
|
|
86
74
|
|
|
87
75
|
# Check for idempotency token
|
|
88
76
|
token = params[:idempotency_token] || params["idempotency_token"]
|
|
89
|
-
if token
|
|
90
|
-
validate_idempotency_token!(token)
|
|
91
|
-
end
|
|
77
|
+
validate_idempotency_token!(token) if token
|
|
92
78
|
|
|
93
79
|
# Require either event_occurrence_id or leases array
|
|
94
80
|
has_event = params[:event_occurrence_id] || params["event_occurrence_id"]
|
|
@@ -108,27 +94,19 @@ module Pike13
|
|
|
108
94
|
# @raise [ValidationError] if attributes are invalid
|
|
109
95
|
# @return [Boolean] true if valid
|
|
110
96
|
def self.validate_person_attributes!(attributes)
|
|
111
|
-
unless attributes.is_a?(Hash)
|
|
112
|
-
raise ValidationError, "Person attributes must be a hash, got #{attributes.class}"
|
|
113
|
-
end
|
|
97
|
+
raise ValidationError, "Person attributes must be a hash, got #{attributes.class}" unless attributes.is_a?(Hash)
|
|
114
98
|
|
|
115
99
|
# Check required fields
|
|
116
100
|
first_name = attributes[:first_name] || attributes["first_name"]
|
|
117
101
|
last_name = attributes[:last_name] || attributes["last_name"]
|
|
118
102
|
|
|
119
|
-
if first_name.to_s.strip.empty?
|
|
120
|
-
raise ValidationError, "Person must have a first_name"
|
|
121
|
-
end
|
|
103
|
+
raise ValidationError, "Person must have a first_name" if first_name.to_s.strip.empty?
|
|
122
104
|
|
|
123
|
-
if last_name.to_s.strip.empty?
|
|
124
|
-
raise ValidationError, "Person must have a last_name"
|
|
125
|
-
end
|
|
105
|
+
raise ValidationError, "Person must have a last_name" if last_name.to_s.strip.empty?
|
|
126
106
|
|
|
127
107
|
# Validate email format if provided
|
|
128
108
|
email = attributes[:email] || attributes["email"]
|
|
129
|
-
if email && !email.to_s.match?(/\A[^@\s]+@[^@\s]+\z/)
|
|
130
|
-
raise ValidationError, "Invalid email format: #{email}"
|
|
131
|
-
end
|
|
109
|
+
raise ValidationError, "Invalid email format: #{email}" if email && !email.to_s.match?(/\A[^@\s]+@[^@\s]+\z/)
|
|
132
110
|
|
|
133
111
|
true
|
|
134
112
|
end
|
data/lib/pike13/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pike13
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Huttemann
|
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
141
|
version: '0'
|
|
142
142
|
requirements: []
|
|
143
|
-
rubygems_version: 3.
|
|
143
|
+
rubygems_version: 3.7.2
|
|
144
144
|
specification_version: 4
|
|
145
145
|
summary: Ruby client for the Pike13 API
|
|
146
146
|
test_files: []
|