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
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class Person < Base
8
+ class << self
9
+ # GET /desk/people
10
+ def all
11
+ client.get("desk/people")
12
+ end
13
+
14
+ # GET /desk/people/:id
15
+ def find(id)
16
+ client.get("desk/people/#{id}")
17
+ end
18
+
19
+ # GET /desk/people/me
20
+ def me
21
+ find(:me)
22
+ end
23
+
24
+ # GET /desk/people/search?q=query
25
+ def search(query)
26
+ client.get("desk/people/search", q: query)
27
+ end
28
+
29
+ # POST /desk/people
30
+ def create(attributes)
31
+ client.post("desk/people", { person: attributes })
32
+ end
33
+
34
+ # PUT /desk/people/:id
35
+ def update(id, attributes)
36
+ client.put("desk/people/#{id}", { person: attributes })
37
+ end
38
+
39
+ # DELETE /desk/people/:id
40
+ def destroy(id)
41
+ client.delete("desk/people/#{id}")
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class PersonPlan < Base
8
+ class << self
9
+ # GET /desk/people/:person_id/plans
10
+ def all(person_id:, **params)
11
+ client.get("desk/people/#{person_id}/plans", params)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class PersonVisit < Base
8
+ class << self
9
+ # GET /desk/people/:person_id/visits
10
+ def all(person_id:, **params)
11
+ client.get("desk/people/#{person_id}/visits", params)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class PersonWaitlistEntry < Base
8
+ class << self
9
+ # GET /desk/people/:person_id/waitlist_entries
10
+ def all(person_id:, **params)
11
+ client.get("desk/people/#{person_id}/waitlist_entries", params)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class PersonWaiver < Base
8
+ class << self
9
+ # GET /desk/people/:person_id/waivers
10
+ def all(person_id:, **params)
11
+ client.get("desk/people/#{person_id}/waivers", params)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class Plan < Base
8
+ class << self
9
+ # GET /desk/plans
10
+ def all
11
+ client.get("desk/plans")
12
+ end
13
+
14
+ # GET /desk/plans/:id
15
+ def find(id)
16
+ client.get("desk/plans/#{id}")
17
+ end
18
+
19
+ # POST /desk/plans/:plan_id/end_date_updates
20
+ def create_end_date_update(plan_id, attributes)
21
+ client.post("desk/plans/#{plan_id}/end_date_updates", attributes)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class PlanProduct < Base
8
+ class << self
9
+ # GET /desk/plan_products
10
+ def all
11
+ client.get("desk/plan_products")
12
+ end
13
+
14
+ # GET /desk/plan_products/:id
15
+ def find(id)
16
+ client.get("desk/plan_products/#{id}")
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class Punch < Base
8
+ class << self
9
+ # GET /desk/punches
10
+ def all
11
+ client.get("desk/punches")
12
+ end
13
+
14
+ # GET /desk/punches/:id
15
+ def find(id)
16
+ client.get("desk/punches/#{id}")
17
+ end
18
+
19
+ # POST /desk/punches
20
+ def create(attributes)
21
+ client.post("desk/punches", { punch: attributes })
22
+ end
23
+
24
+ # DELETE /desk/punches/:id
25
+ def destroy(id)
26
+ client.delete("desk/punches/#{id}")
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class Refund < Base
8
+ class << self
9
+ # GET /desk/refunds/:id
10
+ def find(id)
11
+ client.get("desk/refunds/#{id}")
12
+ end
13
+
14
+ # POST /desk/refunds/:refund_id/voids
15
+ def void(refund_id:)
16
+ client.post("desk/refunds/#{refund_id}/voids", {})
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class RevenueCategory < Base
8
+ class << self
9
+ # GET /desk/revenue_categories
10
+ def all
11
+ client.get("desk/revenue_categories")
12
+ end
13
+
14
+ # GET /desk/revenue_categories/:id
15
+ def find(id)
16
+ client.get("desk/revenue_categories/#{id}")
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class SalesTax < Base
8
+ class << self
9
+ # GET /desk/sales_taxes
10
+ def all
11
+ client.get("desk/sales_taxes")
12
+ end
13
+
14
+ # GET /desk/sales_taxes/:id
15
+ def find(id)
16
+ client.get("desk/sales_taxes/#{id}")
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class Service < Base
8
+ class << self
9
+ # GET /desk/services
10
+ def all
11
+ client.get("desk/services")
12
+ end
13
+
14
+ # GET /desk/services/:id
15
+ def find(id)
16
+ client.get("desk/services/#{id}")
17
+ end
18
+
19
+ # GET /desk/services/:service_id/enrollment_eligibilities
20
+ def enrollment_eligibilities(service_id:, **params)
21
+ client.get("desk/services/#{service_id}/enrollment_eligibilities", params)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class StaffMember < Base
8
+ class << self
9
+ # GET /desk/staff_members
10
+ def all
11
+ client.get("desk/staff_members")
12
+ end
13
+
14
+ # GET /desk/staff_members/:id
15
+ def find(id)
16
+ client.get("desk/staff_members/#{id}")
17
+ end
18
+
19
+ # GET /desk/staff_members/me
20
+ def me
21
+ find(:me)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class Visit < Base
8
+ class << self
9
+ # GET /desk/visits
10
+ def all
11
+ client.get("desk/visits")
12
+ end
13
+
14
+ # GET /desk/visits/:id
15
+ def find(id)
16
+ client.get("desk/visits/#{id}")
17
+ end
18
+
19
+ # GET /desk/people/:person_id/visits/summary
20
+ def summary(person_id:, **params)
21
+ client.get("desk/people/#{person_id}/visits/summary", params)
22
+ end
23
+
24
+ # POST /desk/visits
25
+ def create(attributes)
26
+ client.post("desk/visits", { visit: attributes })
27
+ end
28
+
29
+ # PUT /desk/visits/:id
30
+ def update(id, attributes)
31
+ client.put("desk/visits/#{id}", { visit: attributes })
32
+ end
33
+
34
+ # DELETE /desk/visits/:id
35
+ def destroy(id, **params)
36
+ client.delete("desk/visits/#{id}", params)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class WaitlistEntry < Base
8
+ class << self
9
+ # GET /desk/waitlist_entries
10
+ def all
11
+ client.get("desk/waitlist_entries")
12
+ end
13
+
14
+ # GET /desk/waitlist_entries/:id
15
+ def find(id)
16
+ client.get("desk/waitlist_entries/#{id}")
17
+ end
18
+
19
+ # POST /desk/waitlist_entries
20
+ def create(attributes)
21
+ client.post("desk/waitlist_entries", { waitlist_entry: attributes })
22
+ end
23
+
24
+ # PUT /desk/waitlist_entries/:id
25
+ def update(id, attributes)
26
+ client.put("desk/waitlist_entries/#{id}", { waitlist_entry: attributes })
27
+ end
28
+
29
+ # DELETE /desk/waitlist_entries/:id
30
+ def destroy(id)
31
+ client.delete("desk/waitlist_entries/#{id}")
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Front
7
+ class Appointment < Base
8
+ class << self
9
+ # GET /front/appointments/:id
10
+ def find(id)
11
+ client.get("front/appointments/#{id}")
12
+ end
13
+
14
+ # GET /front/appointments/:service_id/available_slots
15
+ def find_available_slots(service_id:, **params)
16
+ client.get("front/appointments/#{service_id}/available_slots", params)
17
+ end
18
+
19
+ # GET /front/appointments/:service_id/available_slots/summary
20
+ def available_slots_summary(service_id:, **params)
21
+ client.get("front/appointments/#{service_id}/available_slots/summary", params)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Front
7
+ # Base class for all Front namespace resources
8
+ # Front endpoints use the business subdomain (scoped connection)
9
+ class Base
10
+ class << self
11
+ def configure(config)
12
+ @client = Pike13::HTTPClient.new(
13
+ base_url: config.full_url,
14
+ access_token: config.access_token
15
+ )
16
+ end
17
+
18
+ def client
19
+ # Return this class's client if set, otherwise traverse up to Base
20
+ return @client if instance_variable_defined?(:@client) && @client
21
+ return superclass.client if superclass.respond_to?(:client) && superclass != Object
22
+
23
+ raise "Client not configured. Call Pike13.configure first."
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Front
7
+ class Booking < Base
8
+ class << self
9
+ # GET /front/bookings/:id
10
+ def find(id)
11
+ client.get("front/bookings/#{id}")
12
+ end
13
+
14
+ # GET /front/bookings/:booking_id/leases/:id
15
+ def find_lease(booking_id:, id:, **params)
16
+ client.get("front/bookings/#{booking_id}/leases/#{id}", params)
17
+ end
18
+
19
+ # POST /front/bookings
20
+ def create(attributes)
21
+ client.post("front/bookings", { booking: attributes })
22
+ end
23
+
24
+ # PUT /front/bookings/:id
25
+ def update(id, attributes)
26
+ client.put("front/bookings/#{id}", { booking: attributes })
27
+ end
28
+
29
+ # DELETE /front/bookings/:id
30
+ def destroy(id)
31
+ client.delete("front/bookings/#{id}")
32
+ end
33
+
34
+ # POST /front/bookings/:booking_id/leases
35
+ def create_lease(booking_id, attributes)
36
+ client.post("front/bookings/#{booking_id}/leases", { lease: attributes })
37
+ end
38
+
39
+ # PUT /front/bookings/:booking_id/leases/:id
40
+ def update_lease(booking_id, id, attributes)
41
+ client.put("front/bookings/#{booking_id}/leases/#{id}", { lease: attributes })
42
+ end
43
+
44
+ # DELETE /front/bookings/:booking_id/leases/:lease_id
45
+ def destroy_lease(booking_id, lease_id)
46
+ client.delete("front/bookings/#{booking_id}/leases/#{lease_id}")
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Front
7
+ class Branding < Base
8
+ class << self
9
+ # GET /front/branding
10
+ def get
11
+ client.get("front/branding")
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Front
7
+ class Business < Base
8
+ class << self
9
+ # GET /front/business
10
+ def get
11
+ client.get("front/business")
12
+ end
13
+
14
+ # GET /front/business/franchisees
15
+ def franchisees
16
+ client.get("front/business/franchisees")
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Front
7
+ class Event < Base
8
+ class << self
9
+ # GET /front/events
10
+ def all
11
+ client.get("front/events")
12
+ end
13
+
14
+ # GET /front/events/:id
15
+ def find(id)
16
+ client.get("front/events/#{id}")
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Front
7
+ class EventOccurrence < Base
8
+ class << self
9
+ # GET /front/event_occurrences
10
+ def all
11
+ client.get("front/event_occurrences")
12
+ end
13
+
14
+ # GET /front/event_occurrences/:id
15
+ def find(id)
16
+ client.get("front/event_occurrences/#{id}")
17
+ end
18
+
19
+ # GET /front/event_occurrences/summary
20
+ def summary(**params)
21
+ client.get("front/event_occurrences/summary", params)
22
+ end
23
+
24
+ # GET /front/event_occurrences/:id/enrollment_eligibilities
25
+ def enrollment_eligibilities(id:, **params)
26
+ client.get("front/event_occurrences/#{id}/enrollment_eligibilities", params)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Front
7
+ class EventOccurrenceNote < Base
8
+ class << self
9
+ # GET /front/event_occurrences/:event_occurrence_id/notes
10
+ def all(event_occurrence_id:, **params)
11
+ client.get("front/event_occurrences/#{event_occurrence_id}/notes", params)
12
+ end
13
+
14
+ # GET /front/event_occurrences/:event_occurrence_id/notes/:id
15
+ def find(event_occurrence_id:, id:)
16
+ client.get("front/event_occurrences/#{event_occurrence_id}/notes/#{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 Front
7
+ class EventOccurrenceWaitlistEligibility < Base
8
+ class << self
9
+ # GET /front/event_occurrences/:event_occurrence_id/waitlist_eligibilities
10
+ def all(event_occurrence_id:, **params)
11
+ client.get("front/event_occurrences/#{event_occurrence_id}/waitlist_eligibilities", params)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end