Class: Pago::V2026_04::Services::CheckoutLinks
- Defined in:
- lib/pago/v2026_04/services/checkout_links.rb,
sig/pago/v2026_04/generated.rbs
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#create(body: {}) ⇒ Models::CheckoutLink
Create a checkout link.
-
#delete(id) ⇒ nil
Delete a checkout link.
-
#get(id) ⇒ Models::CheckoutLink
Get a checkout link by ID.
-
#list(organization_id: nil, product_id: nil, page: 1, limit: 10, sorting: ["created_at"]) ⇒ Models::ListResourceCheckoutLink
List checkout links.
-
#list_each(organization_id: nil, product_id: nil, limit: 10, sorting: ["created_at"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of
list, fetching pages on demand. -
#update(id, body: {}) ⇒ Models::CheckoutLink
Update a checkout link.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Pago::Service
Instance Method Details
#create(body: {}) ⇒ Models::CheckoutLink
Create a checkout link.
Scopes: checkout_links:write
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/pago/v2026_04/services/checkout_links.rb', line 50 def create(body: {}) data = client.request( http_method: "POST", path: "/v1/checkout-links/", path_params: {}, query: {}, body: body, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::CheckoutLink.from_json(data) end |
#delete(id) ⇒ nil
Delete a checkout link.
Scopes: checkout_links:write
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/pago/v2026_04/services/checkout_links.rb', line 93 def delete(id) client.request( http_method: "DELETE", path: "/v1/checkout-links/{id}", path_params: { "id" => id }, query: {}, response_type: :none, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) end |
#get(id) ⇒ Models::CheckoutLink
Get a checkout link by ID.
Scopes: checkout_links:read checkout_links:write
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/pago/v2026_04/services/checkout_links.rb', line 72 def get(id) data = client.request( http_method: "GET", path: "/v1/checkout-links/{id}", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::CheckoutLink.from_json(data) end |
#list(organization_id: nil, product_id: nil, page: 1, limit: 10, sorting: ["created_at"]) ⇒ Models::ListResourceCheckoutLink
List checkout links.
Scopes: checkout_links:read checkout_links:write
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pago/v2026_04/services/checkout_links.rb', line 19 def list(organization_id: nil, product_id: nil, page: 1, limit: 10, sorting: ["created_at"]) data = client.request( http_method: "GET", path: "/v1/checkout-links/", path_params: {}, query: { "organization_id" => organization_id, "product_id" => product_id, "page" => page, "limit" => limit, "sorting" => sorting }, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::ListResourceCheckoutLink.from_json(data) end |
#list_each(organization_id: nil, product_id: nil, limit: 10, sorting: ["created_at"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of list, fetching pages on demand.
35 36 37 38 39 40 |
# File 'lib/pago/v2026_04/services/checkout_links.rb', line 35 def list_each(organization_id: nil, product_id: nil, limit: 10, sorting: ["created_at"], &block) paginator = ::Pago::Paginator.new do |page_number| list(organization_id: organization_id, product_id: product_id, page: page_number, limit: limit, sorting: sorting) end block ? paginator.each(&block) : paginator end |
#update(id, body: {}) ⇒ Models::CheckoutLink
Update a checkout link.
Scopes: checkout_links:write
114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/pago/v2026_04/services/checkout_links.rb', line 114 def update(id, body: {}) data = client.request( http_method: "PATCH", path: "/v1/checkout-links/{id}", path_params: { "id" => id }, query: {}, body: body, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::CheckoutLink.from_json(data) end |