pike13 0.1.0.beta

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.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +134 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +634 -0
  5. data/lib/pike13/api/v2/account/base.rb +31 -0
  6. data/lib/pike13/api/v2/account/business.rb +23 -0
  7. data/lib/pike13/api/v2/account/confirmation.rb +18 -0
  8. data/lib/pike13/api/v2/account/me.rb +20 -0
  9. data/lib/pike13/api/v2/account/password.rb +18 -0
  10. data/lib/pike13/api/v2/account/person.rb +18 -0
  11. data/lib/pike13/api/v2/desk/appointment.rb +28 -0
  12. data/lib/pike13/api/v2/desk/base.rb +30 -0
  13. data/lib/pike13/api/v2/desk/booking.rb +43 -0
  14. data/lib/pike13/api/v2/desk/business.rb +23 -0
  15. data/lib/pike13/api/v2/desk/custom_field.rb +23 -0
  16. data/lib/pike13/api/v2/desk/event.rb +23 -0
  17. data/lib/pike13/api/v2/desk/event_occurrence.rb +33 -0
  18. data/lib/pike13/api/v2/desk/event_occurrence_note.rb +38 -0
  19. data/lib/pike13/api/v2/desk/event_occurrence_visit.rb +18 -0
  20. data/lib/pike13/api/v2/desk/event_occurrence_waitlist_entry.rb +18 -0
  21. data/lib/pike13/api/v2/desk/form_of_payment.rb +38 -0
  22. data/lib/pike13/api/v2/desk/invoice.rb +83 -0
  23. data/lib/pike13/api/v2/desk/location.rb +23 -0
  24. data/lib/pike13/api/v2/desk/make_up.rb +36 -0
  25. data/lib/pike13/api/v2/desk/note.rb +38 -0
  26. data/lib/pike13/api/v2/desk/pack.rb +28 -0
  27. data/lib/pike13/api/v2/desk/pack_product.rb +43 -0
  28. data/lib/pike13/api/v2/desk/payment.rb +31 -0
  29. data/lib/pike13/api/v2/desk/person.rb +48 -0
  30. data/lib/pike13/api/v2/desk/person_plan.rb +18 -0
  31. data/lib/pike13/api/v2/desk/person_visit.rb +18 -0
  32. data/lib/pike13/api/v2/desk/person_waitlist_entry.rb +18 -0
  33. data/lib/pike13/api/v2/desk/person_waiver.rb +18 -0
  34. data/lib/pike13/api/v2/desk/plan.rb +28 -0
  35. data/lib/pike13/api/v2/desk/plan_product.rb +23 -0
  36. data/lib/pike13/api/v2/desk/punch.rb +33 -0
  37. data/lib/pike13/api/v2/desk/refund.rb +23 -0
  38. data/lib/pike13/api/v2/desk/revenue_category.rb +23 -0
  39. data/lib/pike13/api/v2/desk/sales_tax.rb +23 -0
  40. data/lib/pike13/api/v2/desk/service.rb +28 -0
  41. data/lib/pike13/api/v2/desk/staff_member.rb +28 -0
  42. data/lib/pike13/api/v2/desk/visit.rb +43 -0
  43. data/lib/pike13/api/v2/desk/waitlist_entry.rb +38 -0
  44. data/lib/pike13/api/v2/front/appointment.rb +28 -0
  45. data/lib/pike13/api/v2/front/base.rb +30 -0
  46. data/lib/pike13/api/v2/front/booking.rb +53 -0
  47. data/lib/pike13/api/v2/front/branding.rb +18 -0
  48. data/lib/pike13/api/v2/front/business.rb +23 -0
  49. data/lib/pike13/api/v2/front/event.rb +23 -0
  50. data/lib/pike13/api/v2/front/event_occurrence.rb +33 -0
  51. data/lib/pike13/api/v2/front/event_occurrence_note.rb +23 -0
  52. data/lib/pike13/api/v2/front/event_occurrence_waitlist_eligibility.rb +18 -0
  53. data/lib/pike13/api/v2/front/form_of_payment.rb +43 -0
  54. data/lib/pike13/api/v2/front/invoice.rb +58 -0
  55. data/lib/pike13/api/v2/front/location.rb +23 -0
  56. data/lib/pike13/api/v2/front/note.rb +24 -0
  57. data/lib/pike13/api/v2/front/payment.rb +23 -0
  58. data/lib/pike13/api/v2/front/person.rb +23 -0
  59. data/lib/pike13/api/v2/front/person_plan.rb +18 -0
  60. data/lib/pike13/api/v2/front/person_visit.rb +18 -0
  61. data/lib/pike13/api/v2/front/person_waitlist_entry.rb +18 -0
  62. data/lib/pike13/api/v2/front/person_waiver.rb +18 -0
  63. data/lib/pike13/api/v2/front/plan.rb +28 -0
  64. data/lib/pike13/api/v2/front/plan_product.rb +23 -0
  65. data/lib/pike13/api/v2/front/plan_terms.rb +28 -0
  66. data/lib/pike13/api/v2/front/service.rb +28 -0
  67. data/lib/pike13/api/v2/front/staff_member.rb +23 -0
  68. data/lib/pike13/api/v2/front/visit.rb +33 -0
  69. data/lib/pike13/api/v2/front/waitlist_entry.rb +33 -0
  70. data/lib/pike13/configuration.rb +58 -0
  71. data/lib/pike13/errors.rb +104 -0
  72. data/lib/pike13/http_client.rb +175 -0
  73. data/lib/pike13/version.rb +5 -0
  74. data/lib/pike13.rb +159 -0
  75. metadata +131 -0
data/README.md ADDED
@@ -0,0 +1,634 @@
1
+ # Pike13 Ruby Client
2
+
3
+ A Ruby gem for interacting with the [Pike13 Core API](https://developer.pike13.com/docs/api/v2).
4
+
5
+ ## Installation
6
+
7
+ Add to your Gemfile:
8
+
9
+ ```ruby
10
+ gem 'pike13'
11
+ ```
12
+
13
+ Or install directly:
14
+
15
+ ```bash
16
+ gem install pike13
17
+ ```
18
+
19
+ ## Configuration
20
+
21
+ ```ruby
22
+ require 'pike13'
23
+
24
+ # Global configuration (recommended)
25
+ Pike13.configure do |config|
26
+ config.access_token = "your_access_token"
27
+ config.base_url = "yourbusiness.pike13.com"
28
+ end
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ The Pike13 API is organized into three namespaces:
34
+
35
+ - **Account** - Account-level operations (not scoped to a business)
36
+ - **Desk** - Staff interface operations (full access)
37
+ - **Front** - Client interface operations (limited access)
38
+
39
+ ### Account Resources
40
+
41
+ Account-level resources for managing your Pike13 account.
42
+
43
+ ```ruby
44
+ # Get current account
45
+ Pike13::Account::Me.me
46
+
47
+ # List all businesses
48
+ Pike13::Account::Business.all
49
+
50
+ # Get all people
51
+ Pike13::Account::Person.all
52
+
53
+ # Password reset
54
+ Pike13::Account::Password.create(email: "user@example.com")
55
+
56
+ # Email confirmation
57
+ Pike13::Account::Confirmation.create(confirmation_token: "token")
58
+ ```
59
+
60
+ ### Desk Resources (Staff Interface)
61
+
62
+ Full staff interface with read/write access to all resources.
63
+
64
+ #### People
65
+
66
+ ```ruby
67
+ # List all people
68
+ Pike13::Desk::Person.all
69
+
70
+ # Find a person
71
+ Pike13::Desk::Person.find(123)
72
+
73
+ # Get authenticated user
74
+ Pike13::Desk::Person.me
75
+
76
+ # Search people
77
+ Pike13::Desk::Person.search("john")
78
+
79
+ # Create a person
80
+ Pike13::Desk::Person.create(
81
+ first_name: "John",
82
+ last_name: "Doe",
83
+ email: "john@example.com"
84
+ )
85
+
86
+ # Update a person
87
+ Pike13::Desk::Person.update(123, first_name: "Jane")
88
+
89
+ # Delete a person
90
+ Pike13::Desk::Person.destroy(123)
91
+ ```
92
+
93
+ #### Business
94
+
95
+ ```ruby
96
+ # Get business details
97
+ Pike13::Desk::Business.find
98
+ ```
99
+
100
+ #### Events & Event Occurrences
101
+
102
+ ```ruby
103
+ # List events
104
+ Pike13::Desk::Event.all
105
+
106
+ # Find event
107
+ Pike13::Desk::Event.find(100)
108
+
109
+ # List event occurrences
110
+ Pike13::Desk::EventOccurrence.all(from: "2025-01-01", to: "2025-01-31")
111
+
112
+ # Find occurrence
113
+ Pike13::Desk::EventOccurrence.find(789)
114
+
115
+ # Get occurrence summary
116
+ Pike13::Desk::EventOccurrence.summary
117
+
118
+ # Check enrollment eligibility
119
+ Pike13::Desk::EventOccurrence.enrollment_eligibilities(id: 789)
120
+
121
+ # List event occurrence notes
122
+ Pike13::Desk::EventOccurrenceNote.all(event_occurrence_id: 789)
123
+
124
+ # Find event occurrence note
125
+ Pike13::Desk::EventOccurrenceNote.find(event_occurrence_id: 789, id: 1)
126
+
127
+ # Create event occurrence note
128
+ Pike13::Desk::EventOccurrenceNote.create(
129
+ event_occurrence_id: 789,
130
+ attributes: { body: "This is a note" }
131
+ )
132
+
133
+ # Update event occurrence note
134
+ Pike13::Desk::EventOccurrenceNote.update(
135
+ event_occurrence_id: 789,
136
+ id: 1,
137
+ attributes: { body: "Updated note" }
138
+ )
139
+
140
+ # Delete event occurrence note
141
+ Pike13::Desk::EventOccurrenceNote.destroy(event_occurrence_id: 789, id: 1)
142
+
143
+ # List visits for an event occurrence
144
+ Pike13::Desk::EventOccurrenceVisit.all(event_occurrence_id: 789)
145
+
146
+ # List waitlist entries for an event occurrence
147
+ Pike13::Desk::EventOccurrenceWaitlistEntry.all(event_occurrence_id: 789)
148
+ ```
149
+
150
+ #### Appointments
151
+
152
+ ```ruby
153
+ # Find available slots
154
+ Pike13::Desk::Appointment.find_available_slots(
155
+ service_id: 100,
156
+ date: "2025-01-15",
157
+ location_ids: [1, 2],
158
+ staff_member_ids: [3, 4]
159
+ )
160
+
161
+ # Get availability summary
162
+ Pike13::Desk::Appointment.available_slots_summary(
163
+ service_id: 100,
164
+ from: "2025-01-01",
165
+ to: "2025-01-31",
166
+ location_ids: [1, 2],
167
+ staff_member_ids: [3, 4]
168
+ )
169
+ ```
170
+
171
+ #### Bookings
172
+
173
+ ```ruby
174
+ # Find booking
175
+ Pike13::Desk::Booking.find(123)
176
+
177
+ # Create booking
178
+ Pike13::Desk::Booking.create(
179
+ event_occurrence_id: 789,
180
+ person_id: 123
181
+ )
182
+
183
+ # Update booking
184
+ Pike13::Desk::Booking.update(456, state: "completed")
185
+
186
+ # Delete booking
187
+ Pike13::Desk::Booking.destroy(456)
188
+ ```
189
+
190
+ #### Visits
191
+
192
+ ```ruby
193
+ # List all visits
194
+ Pike13::Desk::Visit.all
195
+
196
+ # Find visit
197
+ Pike13::Desk::Visit.find(456)
198
+
199
+ # Get visit summary for a person
200
+ Pike13::Desk::Visit.summary(person_id: 123)
201
+ ```
202
+
203
+ #### Locations, Services, Staff
204
+
205
+ ```ruby
206
+ # Locations
207
+ Pike13::Desk::Location.all
208
+ Pike13::Desk::Location.find(1)
209
+
210
+ # Services
211
+ Pike13::Desk::Service.all
212
+ Pike13::Desk::Service.find(100)
213
+ Pike13::Desk::Service.enrollment_eligibilities(service_id: 100)
214
+
215
+ # Staff Members
216
+ Pike13::Desk::StaffMember.all
217
+ Pike13::Desk::StaffMember.find(5)
218
+ Pike13::Desk::StaffMember.me
219
+ ```
220
+
221
+ #### Plans & Products
222
+
223
+ ```ruby
224
+ # Plans
225
+ Pike13::Desk::Plan.all
226
+ Pike13::Desk::Plan.find(200)
227
+
228
+ # Plan Products
229
+ Pike13::Desk::PlanProduct.all
230
+ Pike13::Desk::PlanProduct.find(300)
231
+
232
+ # Pack Products
233
+ Pike13::Desk::PackProduct.all
234
+ Pike13::Desk::PackProduct.find(400)
235
+
236
+ # Packs (find only)
237
+ Pike13::Desk::Pack.find(500)
238
+
239
+ # Punches (find only)
240
+ Pike13::Desk::Punch.find(600)
241
+ ```
242
+
243
+ #### Invoices & Payments
244
+
245
+ ```ruby
246
+ # Invoices
247
+ Pike13::Desk::Invoice.all
248
+ Pike13::Desk::Invoice.find(700)
249
+
250
+ # Payments
251
+ Pike13::Desk::Payment.find(800)
252
+ Pike13::Desk::Payment.configuration
253
+ Pike13::Desk::Payment.void(payment_id: 800, invoice_item_ids_to_cancel: [1, 2])
254
+
255
+ # Refunds
256
+ Pike13::Desk::Refund.find(900)
257
+ Pike13::Desk::Refund.void(refund_id: 900)
258
+ ```
259
+
260
+ #### Financial Settings
261
+
262
+ ```ruby
263
+ # Revenue Categories
264
+ Pike13::Desk::RevenueCategory.all
265
+ Pike13::Desk::RevenueCategory.find(10)
266
+
267
+ # Sales Taxes
268
+ Pike13::Desk::SalesTax.all
269
+ Pike13::Desk::SalesTax.find(20)
270
+ ```
271
+
272
+ #### Notes
273
+
274
+ ```ruby
275
+ # List notes for a person
276
+ Pike13::Desk::Note.all(person_id: 123)
277
+
278
+ # Find note
279
+ Pike13::Desk::Note.find(person_id: 123, id: 1000)
280
+
281
+ # Create note
282
+ Pike13::Desk::Note.create(
283
+ person_id: 123,
284
+ attributes: { body: "This is a note" }
285
+ )
286
+
287
+ # Update note
288
+ Pike13::Desk::Note.update(
289
+ person_id: 123,
290
+ id: 1000,
291
+ attributes: { body: "Updated note" }
292
+ )
293
+
294
+ # Delete note
295
+ Pike13::Desk::Note.destroy(person_id: 123, id: 1000)
296
+ ```
297
+
298
+ #### Make-Ups
299
+
300
+ ```ruby
301
+ # Find make-up
302
+ Pike13::Desk::MakeUp.find(1100)
303
+
304
+ # List make-up reasons
305
+ Pike13::Desk::MakeUp.reasons
306
+
307
+ # Generate make-up credit
308
+ Pike13::Desk::MakeUp.generate(
309
+ visit_id: 456,
310
+ make_up_reason_id: 5,
311
+ free_form_reason: "Client was sick"
312
+ )
313
+ ```
314
+
315
+ #### Waitlist
316
+
317
+ ```ruby
318
+ # List waitlist entries
319
+ Pike13::Desk::WaitlistEntry.all
320
+
321
+ # Find waitlist entry
322
+ Pike13::Desk::WaitlistEntry.find(1200)
323
+ ```
324
+
325
+ #### Custom Fields
326
+
327
+ ```ruby
328
+ # List custom fields
329
+ Pike13::Desk::CustomField.all
330
+
331
+ # Find custom field
332
+ Pike13::Desk::CustomField.find(30)
333
+ ```
334
+
335
+ #### Person-Related Resources
336
+
337
+ ```ruby
338
+ # List person's visits
339
+ Pike13::Desk::PersonVisit.all(person_id: 123)
340
+
341
+ # List person's plans
342
+ Pike13::Desk::PersonPlan.all(person_id: 123)
343
+
344
+ # List person's waitlist entries
345
+ Pike13::Desk::PersonWaitlistEntry.all(person_id: 123)
346
+
347
+ # List person's waivers
348
+ Pike13::Desk::PersonWaiver.all(person_id: 123)
349
+
350
+ # List person's forms of payment
351
+ Pike13::Desk::FormOfPayment.all(person_id: 123)
352
+
353
+ # Find form of payment
354
+ Pike13::Desk::FormOfPayment.find(person_id: 123, id: 456)
355
+
356
+ # Create form of payment
357
+ Pike13::Desk::FormOfPayment.create(
358
+ person_id: 123,
359
+ attributes: { token: "tok_xxx" }
360
+ )
361
+
362
+ # Update form of payment
363
+ Pike13::Desk::FormOfPayment.update(
364
+ person_id: 123,
365
+ id: 456,
366
+ attributes: { is_default: true }
367
+ )
368
+
369
+ # Delete form of payment
370
+ Pike13::Desk::FormOfPayment.destroy(person_id: 123, id: 456)
371
+ ```
372
+
373
+ ### Front Resources (Client Interface)
374
+
375
+ Client-facing interface with limited read-only access.
376
+
377
+ #### Business & Branding
378
+
379
+ ```ruby
380
+ # Get business info
381
+ Pike13::Front::Business.find
382
+
383
+ # Get branding
384
+ Pike13::Front::Branding.find
385
+ ```
386
+
387
+ #### People
388
+
389
+ ```ruby
390
+ # Get authenticated client user (only)
391
+ Pike13::Front::Person.me
392
+ ```
393
+
394
+ #### Events & Event Occurrences
395
+
396
+ ```ruby
397
+ # List events
398
+ Pike13::Front::Event.all
399
+
400
+ # Find event
401
+ Pike13::Front::Event.find(100)
402
+
403
+ # List event occurrences
404
+ Pike13::Front::EventOccurrence.all(from: "2025-01-01", to: "2025-01-31")
405
+
406
+ # Find occurrence
407
+ Pike13::Front::EventOccurrence.find(789)
408
+
409
+ # Get occurrence summary
410
+ Pike13::Front::EventOccurrence.summary
411
+
412
+ # Check enrollment eligibility
413
+ Pike13::Front::EventOccurrence.enrollment_eligibilities(id: 789)
414
+
415
+ # List event occurrence notes
416
+ Pike13::Front::EventOccurrenceNote.all(event_occurrence_id: 789)
417
+
418
+ # Find event occurrence note
419
+ Pike13::Front::EventOccurrenceNote.find(event_occurrence_id: 789, id: 1)
420
+
421
+ # List waitlist eligibilities for an event occurrence
422
+ Pike13::Front::EventOccurrenceWaitlistEligibility.all(event_occurrence_id: 789)
423
+ ```
424
+
425
+ #### Appointments
426
+
427
+ ```ruby
428
+ # Find available slots
429
+ Pike13::Front::Appointment.find_available_slots(
430
+ service_id: 100,
431
+ date: "2025-01-15",
432
+ location_ids: [1, 2],
433
+ staff_member_ids: [3, 4]
434
+ )
435
+
436
+ # Get availability summary
437
+ Pike13::Front::Appointment.available_slots_summary(
438
+ service_id: 100,
439
+ from: "2025-01-01",
440
+ to: "2025-01-31",
441
+ location_ids: [1, 2],
442
+ staff_member_ids: [3, 4]
443
+ )
444
+ ```
445
+
446
+ #### Bookings
447
+
448
+ ```ruby
449
+ # Find booking
450
+ Pike13::Front::Booking.find(123)
451
+
452
+ # Find lease for booking
453
+ Pike13::Front::Booking.find_lease(booking_id: 123, id: 456)
454
+
455
+ # Create booking
456
+ Pike13::Front::Booking.create(
457
+ event_occurrence_id: 789,
458
+ person_id: 123
459
+ )
460
+
461
+ # Update booking
462
+ Pike13::Front::Booking.update(456, state: "completed")
463
+
464
+ # Delete booking
465
+ Pike13::Front::Booking.destroy(456)
466
+ ```
467
+
468
+ #### Visits
469
+
470
+ ```ruby
471
+ # List visits
472
+ Pike13::Front::Visit.all
473
+
474
+ # Find visit
475
+ Pike13::Front::Visit.find(456)
476
+ ```
477
+
478
+ #### Locations, Services, Staff
479
+
480
+ ```ruby
481
+ # Locations
482
+ Pike13::Front::Location.all
483
+ Pike13::Front::Location.find(1)
484
+
485
+ # Services
486
+ Pike13::Front::Service.all
487
+ Pike13::Front::Service.find(100)
488
+ Pike13::Front::Service.enrollment_eligibilities(service_id: 100)
489
+
490
+ # Staff Members
491
+ Pike13::Front::StaffMember.all
492
+ Pike13::Front::StaffMember.find(5)
493
+ ```
494
+
495
+ #### Plans & Products
496
+
497
+ ```ruby
498
+ # Plans
499
+ Pike13::Front::Plan.all
500
+ Pike13::Front::Plan.find(200)
501
+
502
+ # Plan Products
503
+ Pike13::Front::PlanProduct.all
504
+ Pike13::Front::PlanProduct.find(300)
505
+
506
+ # Plan Terms
507
+ Pike13::Front::PlanTerms.all(plan_id: 200)
508
+ Pike13::Front::PlanTerms.find(plan_id: 200, plan_terms_id: 1)
509
+ Pike13::Front::PlanTerms.complete(plan_id: 200, plan_terms_id: 1)
510
+ ```
511
+
512
+ #### Invoices & Payments
513
+
514
+ ```ruby
515
+ # Invoices (find only)
516
+ Pike13::Front::Invoice.find(700)
517
+
518
+ # Payments
519
+ Pike13::Front::Payment.find(800)
520
+ Pike13::Front::Payment.configuration
521
+ ```
522
+
523
+ #### Notes
524
+
525
+ ```ruby
526
+ # List notes for a person
527
+ Pike13::Front::Note.all(person_id: 123)
528
+
529
+ # Find note
530
+ Pike13::Front::Note.find(person_id: 123, id: 1000)
531
+ ```
532
+
533
+ #### Waitlist
534
+
535
+ ```ruby
536
+ # List waitlist entries
537
+ Pike13::Front::WaitlistEntry.all
538
+
539
+ # Find waitlist entry
540
+ Pike13::Front::WaitlistEntry.find(1200)
541
+ ```
542
+
543
+ #### Person-Related Resources
544
+
545
+ ```ruby
546
+ # List person's visits
547
+ Pike13::Front::PersonVisit.all(person_id: 123)
548
+
549
+ # List person's plans
550
+ Pike13::Front::PersonPlan.all(person_id: 123)
551
+
552
+ # List person's waitlist entries
553
+ Pike13::Front::PersonWaitlistEntry.all(person_id: 123)
554
+
555
+ # List person's waivers
556
+ Pike13::Front::PersonWaiver.all(person_id: 123)
557
+
558
+ # List person's forms of payment
559
+ Pike13::Front::FormOfPayment.all(person_id: 123)
560
+
561
+ # Find form of payment
562
+ Pike13::Front::FormOfPayment.find(person_id: 123, id: 456)
563
+
564
+ # Find form of payment for authenticated user
565
+ Pike13::Front::FormOfPayment.find_me(id: 456)
566
+
567
+ # Create form of payment
568
+ Pike13::Front::FormOfPayment.create(
569
+ person_id: 123,
570
+ attributes: { token: "tok_xxx" }
571
+ )
572
+
573
+ # Update form of payment
574
+ Pike13::Front::FormOfPayment.update(
575
+ person_id: 123,
576
+ id: 456,
577
+ attributes: { is_default: true }
578
+ )
579
+
580
+ # Delete form of payment
581
+ Pike13::Front::FormOfPayment.destroy(person_id: 123, id: 456)
582
+ ```
583
+
584
+ ## Error Handling
585
+
586
+ ```ruby
587
+ begin
588
+ person = Pike13::Desk::Person.find(999999)
589
+ rescue Pike13::AuthenticationError => e
590
+ # 401 Unauthorized
591
+ puts "Authentication failed: #{e.message}"
592
+ rescue Pike13::NotFoundError => e
593
+ # 404 Not Found
594
+ puts "Resource not found: #{e.message}"
595
+ rescue Pike13::ValidationError => e
596
+ # 422 Unprocessable Entity
597
+ puts "Validation failed: #{e.message}"
598
+ rescue Pike13::RateLimitError => e
599
+ # 429 Too Many Requests
600
+ puts "Rate limit exceeded. Retry after: #{e.rate_limit_reset}"
601
+ rescue Pike13::ServerError => e
602
+ # 5xx Server Error
603
+ puts "Server error: #{e.message}"
604
+ rescue Pike13::APIError => e
605
+ # Other API errors
606
+ puts "API error: #{e.message}"
607
+ end
608
+ ```
609
+
610
+ ## Development
611
+
612
+ ```bash
613
+ # Install dependencies
614
+ bundle install
615
+
616
+ # Run tests
617
+ bundle exec rake test
618
+
619
+ ## Contributing
620
+
621
+ 1. Fork it
622
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
623
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
624
+ 4. Push to the branch (`git push origin my-new-feature`)
625
+ 5. Create new Pull Request
626
+
627
+ ## License
628
+
629
+ MIT License
630
+
631
+ ## Links
632
+
633
+ - [Pike13 API Documentation](https://developer.pike13.com/docs/api/v2)
634
+ - [Pike13 Website](https://www.pike13.com/)
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Account
7
+ # Base class for all Account namespace resources
8
+ # Account endpoints use pike13.com (unscoped connection)
9
+ class Base
10
+ class << self
11
+ def configure(config)
12
+ # Account uses pike13.com by default, but can be overridden
13
+ @client = Pike13::HTTPClient.new(
14
+ base_url: config.account_full_url,
15
+ access_token: config.access_token
16
+ )
17
+ end
18
+
19
+ def client
20
+ # Return this class's client if set, otherwise traverse up to Base
21
+ return @client if instance_variable_defined?(:@client) && @client
22
+ return superclass.client if superclass.respond_to?(:client) && superclass != Object
23
+
24
+ raise "Client not configured. Call Pike13.configure first."
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Account
7
+ class Business < Base
8
+ class << self
9
+ # GET /account/businesses
10
+ def all
11
+ client.get("account/businesses")
12
+ end
13
+
14
+ # GET /account/businesses/:id
15
+ def find(id)
16
+ client.get("account/businesses/#{id}")
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Account
7
+ class Confirmation < Base
8
+ class << self
9
+ # POST /account/confirmations
10
+ def create(attributes)
11
+ client.post("account/confirmations", { account: attributes })
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Account
7
+ # Account resource for fetching current account details
8
+ class Me < Base
9
+ class << self
10
+ # GET /account
11
+ # Returns { accounts: [...] }
12
+ def me
13
+ client.get("account")
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end