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,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Account
7
+ class Password < Base
8
+ class << self
9
+ # POST /account/passwords
10
+ def create(attributes)
11
+ client.post("account/passwords", { account: attributes })
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 Account
7
+ class Person < Base
8
+ class << self
9
+ # GET /account/people
10
+ def all
11
+ client.get("account/people")
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 Appointment < Base
8
+ class << self
9
+ # GET /desk/appointments/:id
10
+ def find(id)
11
+ client.get("desk/appointments/#{id}")
12
+ end
13
+
14
+ # GET /desk/appointments/:service_id/available_slots
15
+ def find_available_slots(service_id:, **params)
16
+ client.get("desk/appointments/#{service_id}/available_slots", params)
17
+ end
18
+
19
+ # GET /desk/appointments/:service_id/available_slots/summary
20
+ def available_slots_summary(service_id:, **params)
21
+ client.get("desk/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 Desk
7
+ # Base class for all Desk namespace resources
8
+ # Desk 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,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class Booking < Base
8
+ class << self
9
+ # GET /desk/bookings/:id
10
+ def find(id)
11
+ client.get("desk/bookings/#{id}")
12
+ end
13
+
14
+ # POST /desk/bookings
15
+ def create(attributes)
16
+ client.post("desk/bookings", { booking: attributes })
17
+ end
18
+
19
+ # PUT /desk/bookings/:id
20
+ def update(id, attributes)
21
+ client.put("desk/bookings/#{id}", { booking: attributes })
22
+ end
23
+
24
+ # DELETE /desk/bookings/:id
25
+ def destroy(id)
26
+ client.delete("desk/bookings/#{id}")
27
+ end
28
+
29
+ # POST /desk/bookings/:booking_id/leases
30
+ def create_lease(booking_id, attributes)
31
+ client.post("desk/bookings/#{booking_id}/leases", { lease: attributes })
32
+ end
33
+
34
+ # PUT /desk/bookings/:booking_id/leases/:id
35
+ def update_lease(booking_id, id, attributes)
36
+ client.put("desk/bookings/#{booking_id}/leases/#{id}", { lease: attributes })
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ 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 Business < Base
8
+ class << self
9
+ # GET /desk/business
10
+ def get
11
+ client.get("desk/business")
12
+ end
13
+
14
+ # GET /desk/business/franchisees
15
+ def franchisees
16
+ client.get("desk/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 Desk
7
+ class CustomField < Base
8
+ class << self
9
+ # GET /desk/custom_fields
10
+ def all
11
+ client.get("desk/custom_fields")
12
+ end
13
+
14
+ # GET /desk/custom_fields/:id
15
+ def find(id)
16
+ client.get("desk/custom_fields/#{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 Event < Base
8
+ class << self
9
+ # GET /desk/events
10
+ def all
11
+ client.get("desk/events")
12
+ end
13
+
14
+ # GET /desk/events/:id
15
+ def find(id)
16
+ client.get("desk/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 Desk
7
+ class EventOccurrence < Base
8
+ class << self
9
+ # GET /desk/event_occurrences
10
+ def all
11
+ client.get("desk/event_occurrences")
12
+ end
13
+
14
+ # GET /desk/event_occurrences/:id
15
+ def find(id)
16
+ client.get("desk/event_occurrences/#{id}")
17
+ end
18
+
19
+ # GET /desk/event_occurrences/summary
20
+ def summary(**params)
21
+ client.get("desk/event_occurrences/summary", params)
22
+ end
23
+
24
+ # GET /desk/event_occurrences/:id/enrollment_eligibilities
25
+ def enrollment_eligibilities(id:, **params)
26
+ client.get("desk/event_occurrences/#{id}/enrollment_eligibilities", params)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ 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 EventOccurrenceNote < Base
8
+ class << self
9
+ # GET /desk/event_occurrences/:event_occurrence_id/notes
10
+ def all(event_occurrence_id:, **params)
11
+ client.get("desk/event_occurrences/#{event_occurrence_id}/notes", params)
12
+ end
13
+
14
+ # GET /desk/event_occurrences/:event_occurrence_id/notes/:id
15
+ def find(event_occurrence_id:, id:)
16
+ client.get("desk/event_occurrences/#{event_occurrence_id}/notes/#{id}")
17
+ end
18
+
19
+ # POST /desk/event_occurrences/:event_occurrence_id/notes
20
+ def create(event_occurrence_id:, attributes:)
21
+ client.post("desk/event_occurrences/#{event_occurrence_id}/notes", { note: attributes })
22
+ end
23
+
24
+ # PUT /desk/event_occurrences/:event_occurrence_id/notes/:id
25
+ def update(event_occurrence_id:, id:, attributes:)
26
+ client.put("desk/event_occurrences/#{event_occurrence_id}/notes/#{id}", { note: attributes })
27
+ end
28
+
29
+ # DELETE /desk/event_occurrences/:event_occurrence_id/notes/:id
30
+ def destroy(event_occurrence_id:, id:)
31
+ client.delete("desk/event_occurrences/#{event_occurrence_id}/notes/#{id}")
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ 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 EventOccurrenceVisit < Base
8
+ class << self
9
+ # GET /desk/event_occurrences/:event_occurrence_id/visits
10
+ def all(event_occurrence_id:, **params)
11
+ client.get("desk/event_occurrences/#{event_occurrence_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 EventOccurrenceWaitlistEntry < Base
8
+ class << self
9
+ # GET /desk/event_occurrences/:event_occurrence_id/waitlist_entries
10
+ def all(event_occurrence_id:, **params)
11
+ client.get("desk/event_occurrences/#{event_occurrence_id}/waitlist_entries", params)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ 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 FormOfPayment < Base
8
+ class << self
9
+ # GET /desk/people/:person_id/form_of_payments
10
+ def all(person_id:, **params)
11
+ client.get("desk/people/#{person_id}/form_of_payments", params)
12
+ end
13
+
14
+ # GET /desk/people/:person_id/form_of_payments/:id
15
+ def find(person_id:, id:)
16
+ client.get("desk/people/#{person_id}/form_of_payments/#{id}")
17
+ end
18
+
19
+ # POST /desk/people/:person_id/form_of_payments
20
+ def create(person_id:, attributes:)
21
+ client.post("desk/people/#{person_id}/form_of_payments", { form_of_payment: attributes })
22
+ end
23
+
24
+ # PUT /desk/people/:person_id/form_of_payments/:id
25
+ def update(person_id:, id:, attributes:)
26
+ client.put("desk/people/#{person_id}/form_of_payments/#{id}", { form_of_payment: attributes })
27
+ end
28
+
29
+ # DELETE /desk/people/:person_id/form_of_payments/:id
30
+ def destroy(person_id:, id:)
31
+ client.delete("desk/people/#{person_id}/form_of_payments/#{id}")
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class Invoice < Base
8
+ class << self
9
+ # GET /desk/invoices
10
+ def all
11
+ client.get("desk/invoices")
12
+ end
13
+
14
+ # GET /desk/invoices/:id
15
+ def find(id)
16
+ client.get("desk/invoices/#{id}")
17
+ end
18
+
19
+ # GET /desk/invoices/:id/payment_methods
20
+ def payment_methods(id)
21
+ client.get("desk/invoices/#{id}/payment_methods")
22
+ end
23
+
24
+ # POST /desk/invoices
25
+ def create(attributes)
26
+ client.post("desk/invoices", { invoice: attributes })
27
+ end
28
+
29
+ # PUT /desk/invoices/:invoice_id
30
+ def update(invoice_id, attributes)
31
+ client.put("desk/invoices/#{invoice_id}", { invoice: attributes })
32
+ end
33
+
34
+ # POST /desk/invoices/:invoice_id/invoice_items
35
+ def create_invoice_item(invoice_id, attributes)
36
+ client.post("desk/invoices/#{invoice_id}/invoice_items", { invoice_item: attributes })
37
+ end
38
+
39
+ # DELETE /desk/invoices/:invoice_id/invoice_items/:id
40
+ def destroy_invoice_item(invoice_id, id)
41
+ client.delete("desk/invoices/#{invoice_id}/invoice_items/#{id}")
42
+ end
43
+
44
+ # POST /desk/invoices/:invoice_id/invoice_items/:invoice_item_id/discounts
45
+ def create_discount(invoice_id, invoice_item_id, attributes)
46
+ client.post("desk/invoices/#{invoice_id}/invoice_items/#{invoice_item_id}/discounts", attributes)
47
+ end
48
+
49
+ # GET /desk/invoices/:invoice_id/invoice_items/:invoice_item_id/discounts
50
+ def discounts(invoice_id, invoice_item_id)
51
+ client.get("desk/invoices/#{invoice_id}/invoice_items/#{invoice_item_id}/discounts")
52
+ end
53
+
54
+ # DELETE /desk/invoices/:invoice_id/invoice_items/:invoice_item_id/discounts
55
+ def destroy_discounts(invoice_id, invoice_item_id)
56
+ client.delete("desk/invoices/#{invoice_id}/invoice_items/#{invoice_item_id}/discounts")
57
+ end
58
+
59
+ # POST /desk/invoices/:invoice_id/invoice_items/:invoice_item_id/prorates
60
+ def create_prorate(invoice_id, invoice_item_id, attributes)
61
+ client.post("desk/invoices/#{invoice_id}/invoice_items/#{invoice_item_id}/prorates", attributes)
62
+ end
63
+
64
+ # DELETE /desk/invoices/:invoice_id/invoice_items/:invoice_item_id/prorates
65
+ def destroy_prorate(invoice_id, invoice_item_id)
66
+ client.delete("desk/invoices/#{invoice_id}/invoice_items/#{invoice_item_id}/prorates")
67
+ end
68
+
69
+ # POST /desk/invoices/:invoice_id/payments
70
+ def create_payment(invoice_id, attributes)
71
+ client.post("desk/invoices/#{invoice_id}/payments", attributes)
72
+ end
73
+
74
+ # POST /desk/invoices/:invoice_id/payments/:payment_id/refunds
75
+ def create_refund(invoice_id, payment_id, attributes)
76
+ client.post("desk/invoices/#{invoice_id}/payments/#{payment_id}/refunds", attributes)
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ 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 Location < Base
8
+ class << self
9
+ # GET /desk/locations
10
+ def all
11
+ client.get("desk/locations")
12
+ end
13
+
14
+ # GET /desk/locations/:id
15
+ def find(id)
16
+ client.get("desk/locations/#{id}")
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class MakeUp < Base
8
+ class << self
9
+ # GET /desk/make_ups/:id
10
+ def find(id)
11
+ client.get("desk/make_ups/#{id}")
12
+ end
13
+
14
+ # GET /desk/make_ups/reasons
15
+ def reasons
16
+ client.get("desk/make_ups/reasons")
17
+ end
18
+
19
+ # POST /desk/make_ups/generate
20
+ def generate(visit_id:, make_up_reason_id:, free_form_reason: nil)
21
+ body = {
22
+ visit_id: visit_id,
23
+ make_up: {
24
+ make_up_reason_id: make_up_reason_id
25
+ }
26
+ }
27
+ body[:make_up][:free_form_reason] = free_form_reason if free_form_reason
28
+
29
+ client.post("desk/make_ups/generate", body)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ 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 Note < Base
8
+ class << self
9
+ # GET /desk/people/:person_id/notes
10
+ def all(person_id:)
11
+ client.get("desk/people/#{person_id}/notes")
12
+ end
13
+
14
+ # GET /desk/people/:person_id/notes/:id
15
+ def find(person_id:, id:)
16
+ client.get("desk/people/#{person_id}/notes/#{id}")
17
+ end
18
+
19
+ # POST /desk/people/:person_id/notes
20
+ def create(person_id:, attributes:)
21
+ client.post("desk/people/#{person_id}/notes", { note: attributes })
22
+ end
23
+
24
+ # PUT /desk/people/:person_id/notes/:id
25
+ def update(person_id:, id:, attributes:)
26
+ client.put("desk/people/#{person_id}/notes/#{id}", { note: attributes })
27
+ end
28
+
29
+ # DELETE /desk/people/:person_id/notes/:id
30
+ def destroy(person_id:, id:)
31
+ client.delete("desk/people/#{person_id}/notes/#{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 Desk
7
+ class Pack < Base
8
+ class << self
9
+ # GET /desk/packs
10
+ def all
11
+ client.get("desk/packs")
12
+ end
13
+
14
+ # GET /desk/packs/:id
15
+ def find(id)
16
+ client.get("desk/packs/#{id}")
17
+ end
18
+
19
+ # DELETE /desk/packs/:id
20
+ def destroy(id)
21
+ client.delete("desk/packs/#{id}")
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 PackProduct < Base
8
+ class << self
9
+ # GET /desk/pack_products
10
+ def all
11
+ client.get("desk/pack_products")
12
+ end
13
+
14
+ # GET /desk/pack_products/:id
15
+ def find(id)
16
+ client.get("desk/pack_products/#{id}")
17
+ end
18
+
19
+ # POST /desk/pack_products
20
+ def create(attributes)
21
+ client.post("desk/pack_products", { pack_product: attributes })
22
+ end
23
+
24
+ # PUT /desk/pack_products/:id
25
+ def update(id, attributes)
26
+ client.put("desk/pack_products/#{id}", { pack_product: attributes })
27
+ end
28
+
29
+ # DELETE /desk/pack_products/:id
30
+ def destroy(id)
31
+ client.delete("desk/pack_products/#{id}")
32
+ end
33
+
34
+ # POST /desk/pack_products/:pack_product_id/packs
35
+ def create_pack(pack_product_id, attributes)
36
+ client.post("desk/pack_products/#{pack_product_id}/packs", { pack: attributes })
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module API
5
+ module V2
6
+ module Desk
7
+ class Payment < Base
8
+ class << self
9
+ # GET /desk/payments/:id
10
+ def find(id)
11
+ client.get("desk/payments/#{id}")
12
+ end
13
+
14
+ # POST /desk/payments/:payment_id/voids
15
+ def void(payment_id:, invoice_item_ids_to_cancel: [])
16
+ body = { void: {} }
17
+ body[:void][:invoice_item_ids_to_cancel] = invoice_item_ids_to_cancel if invoice_item_ids_to_cancel.any?
18
+
19
+ client.post("desk/payments/#{payment_id}/voids", body)
20
+ end
21
+
22
+ # GET /desk/payments/configuration
23
+ def configuration
24
+ client.get("desk/payments/configuration")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end