pago-sdk 1.0.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.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +131 -0
  4. data/lib/pago/base_client.rb +116 -0
  5. data/lib/pago/errors.rb +83 -0
  6. data/lib/pago/http.rb +78 -0
  7. data/lib/pago/model.rb +86 -0
  8. data/lib/pago/paginator.rb +67 -0
  9. data/lib/pago/serde.rb +186 -0
  10. data/lib/pago/service.rb +17 -0
  11. data/lib/pago/v2026_04/client.rb +124 -0
  12. data/lib/pago/v2026_04/enums.rb +4552 -0
  13. data/lib/pago/v2026_04/errors.rb +1121 -0
  14. data/lib/pago/v2026_04/models.rb +46344 -0
  15. data/lib/pago/v2026_04/services/benefit_grants.rb +48 -0
  16. data/lib/pago/v2026_04/services/benefits.rb +179 -0
  17. data/lib/pago/v2026_04/services/checkout_links.rb +131 -0
  18. data/lib/pago/v2026_04/services/checkouts.rb +185 -0
  19. data/lib/pago/v2026_04/services/custom_fields.rb +132 -0
  20. data/lib/pago/v2026_04/services/customer_meters.rb +69 -0
  21. data/lib/pago/v2026_04/services/customer_portal.rb +1181 -0
  22. data/lib/pago/v2026_04/services/customer_seats.rb +137 -0
  23. data/lib/pago/v2026_04/services/customer_sessions.rb +35 -0
  24. data/lib/pago/v2026_04/services/customers.rb +556 -0
  25. data/lib/pago/v2026_04/services/discounts.rb +131 -0
  26. data/lib/pago/v2026_04/services/disputes.rb +93 -0
  27. data/lib/pago/v2026_04/services/event_types.rb +74 -0
  28. data/lib/pago/v2026_04/services/events.rb +126 -0
  29. data/lib/pago/v2026_04/services/files.rb +135 -0
  30. data/lib/pago/v2026_04/services/license_keys.rb +183 -0
  31. data/lib/pago/v2026_04/services/members.rb +47 -0
  32. data/lib/pago/v2026_04/services/meters.rb +142 -0
  33. data/lib/pago/v2026_04/services/metrics.rb +188 -0
  34. data/lib/pago/v2026_04/services/oauth2.rb +175 -0
  35. data/lib/pago/v2026_04/services/orders.rb +238 -0
  36. data/lib/pago/v2026_04/services/organizations.rb +113 -0
  37. data/lib/pago/v2026_04/services/payments.rb +72 -0
  38. data/lib/pago/v2026_04/services/products.rb +142 -0
  39. data/lib/pago/v2026_04/services/refunds.rb +73 -0
  40. data/lib/pago/v2026_04/services/subscriptions.rb +171 -0
  41. data/lib/pago/v2026_04/services/webhooks.rb +212 -0
  42. data/lib/pago/v2026_04/unions.rb +739 -0
  43. data/lib/pago/v2026_04/webhooks.rb +86 -0
  44. data/lib/pago/version.rb +5 -0
  45. data/lib/pago/webhooks.rb +159 -0
  46. data/lib/pago.rb +39 -0
  47. data/sig/pago/v2026_04/generated.rbs +12401 -0
  48. data/sig/pago.rbs +204 -0
  49. metadata +91 -0
@@ -0,0 +1,137 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pago
4
+ module V2026_04
5
+ module Services
6
+ class CustomerSeats < ::Pago::Service
7
+ # **Scopes**: `customer_seats:read`
8
+ #
9
+ # @param subscription_id [String, nil]
10
+ # @param order_id [String, nil]
11
+ # @raise [Errors::ListSeats401Error] on HTTP 401.
12
+ # @raise [Errors::ListSeats403Error] on HTTP 403.
13
+ # @raise [Errors::ListSeats404Error] on HTTP 404.
14
+ # @raise [Errors::HTTPValidationError] on HTTP 422.
15
+ # @raise [Pago::NetworkError] when the request never reached the API.
16
+ # @return [Models::SeatsList]
17
+ def list_seats(subscription_id: nil, order_id: nil)
18
+ data = client.request(
19
+ http_method: "GET",
20
+ path: "/v1/customer-seats",
21
+ path_params: {},
22
+ query: { "subscription_id" => subscription_id, "order_id" => order_id },
23
+ response_type: :json,
24
+ errors: { 401 => Errors::ListSeats401Error, 403 => Errors::ListSeats403Error, 404 => Errors::ListSeats404Error, 422 => Errors::HTTPValidationError }
25
+ )
26
+ Models::SeatsList.from_json(data)
27
+ end
28
+
29
+ # **Scopes**: `customer_seats:write`
30
+ #
31
+ # @param body [Hash, Models::SeatAssign] the request body.
32
+ # @raise [Errors::AssignSeat400Error] on HTTP 400.
33
+ # @raise [Errors::AssignSeat401Error] on HTTP 401.
34
+ # @raise [Errors::AssignSeat403Error] on HTTP 403.
35
+ # @raise [Errors::AssignSeat404Error] on HTTP 404.
36
+ # @raise [Errors::HTTPValidationError] on HTTP 422.
37
+ # @raise [Pago::NetworkError] when the request never reached the API.
38
+ # @return [Models::CustomerSeat]
39
+ def assign_seat(body: {})
40
+ data = client.request(
41
+ http_method: "POST",
42
+ path: "/v1/customer-seats",
43
+ path_params: {},
44
+ query: {},
45
+ body: body,
46
+ response_type: :json,
47
+ errors: { 400 => Errors::AssignSeat400Error, 401 => Errors::AssignSeat401Error, 403 => Errors::AssignSeat403Error, 404 => Errors::AssignSeat404Error, 422 => Errors::HTTPValidationError }
48
+ )
49
+ Models::CustomerSeat.from_json(data)
50
+ end
51
+
52
+ # **Scopes**: `customer_seats:write`
53
+ #
54
+ # @param seat_id [String]
55
+ # @raise [Errors::RevokeSeat401Error] on HTTP 401.
56
+ # @raise [Errors::RevokeSeat403Error] on HTTP 403.
57
+ # @raise [Errors::RevokeSeat404Error] on HTTP 404.
58
+ # @raise [Errors::HTTPValidationError] on HTTP 422.
59
+ # @raise [Pago::NetworkError] when the request never reached the API.
60
+ # @return [Models::CustomerSeat]
61
+ def revoke_seat(seat_id)
62
+ data = client.request(
63
+ http_method: "DELETE",
64
+ path: "/v1/customer-seats/{seat_id}",
65
+ path_params: { "seat_id" => seat_id },
66
+ query: {},
67
+ response_type: :json,
68
+ errors: { 401 => Errors::RevokeSeat401Error, 403 => Errors::RevokeSeat403Error, 404 => Errors::RevokeSeat404Error, 422 => Errors::HTTPValidationError }
69
+ )
70
+ Models::CustomerSeat.from_json(data)
71
+ end
72
+
73
+ # **Scopes**: `customer_seats:write`
74
+ #
75
+ # @param seat_id [String]
76
+ # @raise [Errors::ResendInvitation400Error] on HTTP 400.
77
+ # @raise [Errors::ResendInvitation401Error] on HTTP 401.
78
+ # @raise [Errors::ResendInvitation403Error] on HTTP 403.
79
+ # @raise [Errors::ResendInvitation404Error] on HTTP 404.
80
+ # @raise [Errors::HTTPValidationError] on HTTP 422.
81
+ # @raise [Pago::NetworkError] when the request never reached the API.
82
+ # @return [Models::CustomerSeat]
83
+ def resend_invitation(seat_id)
84
+ data = client.request(
85
+ http_method: "POST",
86
+ path: "/v1/customer-seats/{seat_id}/resend",
87
+ path_params: { "seat_id" => seat_id },
88
+ query: {},
89
+ response_type: :json,
90
+ errors: { 400 => Errors::ResendInvitation400Error, 401 => Errors::ResendInvitation401Error, 403 => Errors::ResendInvitation403Error, 404 => Errors::ResendInvitation404Error, 422 => Errors::HTTPValidationError }
91
+ )
92
+ Models::CustomerSeat.from_json(data)
93
+ end
94
+
95
+ # @param invitation_token [String]
96
+ # @raise [Errors::GetClaimInfo400Error] on HTTP 400.
97
+ # @raise [Errors::GetClaimInfo403Error] on HTTP 403.
98
+ # @raise [Errors::GetClaimInfo404Error] on HTTP 404.
99
+ # @raise [Errors::HTTPValidationError] on HTTP 422.
100
+ # @raise [Pago::NetworkError] when the request never reached the API.
101
+ # @return [Models::SeatClaimInfo]
102
+ def get_claim_info(invitation_token)
103
+ data = client.request(
104
+ http_method: "GET",
105
+ path: "/v1/customer-seats/claim/{invitation_token}",
106
+ path_params: { "invitation_token" => invitation_token },
107
+ query: {},
108
+ response_type: :json,
109
+ errors: { 400 => Errors::GetClaimInfo400Error, 403 => Errors::GetClaimInfo403Error, 404 => Errors::GetClaimInfo404Error, 422 => Errors::HTTPValidationError }
110
+ )
111
+ Models::SeatClaimInfo.from_json(data)
112
+ end
113
+
114
+ # @param body [Hash, Models::SeatClaim] the request body.
115
+ # @raise [Errors::ClaimSeat400Error] on HTTP 400.
116
+ # @raise [Errors::ClaimSeat403Error] on HTTP 403.
117
+ # @raise [Errors::HTTPValidationError] on HTTP 422.
118
+ # @raise [Pago::NetworkError] when the request never reached the API.
119
+ # @return [Models::CustomerSeatClaimResponse]
120
+ def claim_seat(body: {})
121
+ data = client.request(
122
+ http_method: "POST",
123
+ path: "/v1/customer-seats/claim",
124
+ path_params: {},
125
+ query: {},
126
+ body: body,
127
+ response_type: :json,
128
+ errors: { 400 => Errors::ClaimSeat400Error, 403 => Errors::ClaimSeat403Error, 422 => Errors::HTTPValidationError }
129
+ )
130
+ Models::CustomerSeatClaimResponse.from_json(data)
131
+ end
132
+
133
+ end
134
+
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pago
4
+ module V2026_04
5
+ module Services
6
+ class CustomerSessions < ::Pago::Service
7
+ # Create a customer session.
8
+ #
9
+ # For organizations with `member_model_enabled`, this will automatically
10
+ # create a member session for the owner member of the customer.
11
+ #
12
+ # **Scopes**: `customer_sessions:write`
13
+ #
14
+ # @param body [Hash, Models::CustomerSessionCustomerIDCreate, Models::CustomerSessionCustomerExternalIDCreate] the request body.
15
+ # @raise [Errors::HTTPValidationError] on HTTP 422.
16
+ # @raise [Pago::NetworkError] when the request never reached the API.
17
+ # @return [Models::CustomerSession]
18
+ def create(body: {})
19
+ data = client.request(
20
+ http_method: "POST",
21
+ path: "/v1/customer-sessions/",
22
+ path_params: {},
23
+ query: {},
24
+ body: body,
25
+ response_type: :json,
26
+ errors: { 422 => Errors::HTTPValidationError }
27
+ )
28
+ Models::CustomerSession.from_json(data)
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+ end
35
+ end