Class: Pago::V2026_04::Services::CustomerPortal::BenefitGrants
- Defined in:
- lib/pago/v2026_04/services/customer_portal.rb,
sig/pago/v2026_04/generated.rbs
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#get(id) ⇒ Object
Get a benefit grant by ID for the authenticated customer.
-
#list(query: nil, type: nil, benefit_id: nil, checkout_id: nil, order_id: nil, subscription_id: nil, member_id: nil, page: 1, limit: 10, sorting: ["product_benefit", "-granted_at"]) ⇒ Models::ListResourceCustomerBenefitGrant
List benefits grants of the authenticated customer.
-
#list_each(query: nil, type: nil, benefit_id: nil, checkout_id: nil, order_id: nil, subscription_id: nil, member_id: nil, limit: 10, sorting: ["product_benefit", "-granted_at"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of
list, fetching pages on demand. -
#update(id, body: {}) ⇒ Object
Update a benefit grant for the authenticated customer.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Pago::Service
Instance Method Details
#get(id) ⇒ Object
Get a benefit grant by ID for the authenticated customer.
Scopes: customer_portal:read customer_portal:write
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 93 def get(id) data = client.request( http_method: "GET", path: "/v1/customer-portal/benefit-grants/{id}", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Unions::CustomerBenefitGrant.from_json(data) end |
#list(query: nil, type: nil, benefit_id: nil, checkout_id: nil, order_id: nil, subscription_id: nil, member_id: nil, page: 1, limit: 10, sorting: ["product_benefit", "-granted_at"]) ⇒ Models::ListResourceCustomerBenefitGrant
List benefits grants of the authenticated customer.
Scopes: customer_portal:read customer_portal:write
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 61 def list(query: nil, type: nil, benefit_id: nil, checkout_id: nil, order_id: nil, subscription_id: nil, member_id: nil, page: 1, limit: 10, sorting: ["product_benefit", "-granted_at"]) data = client.request( http_method: "GET", path: "/v1/customer-portal/benefit-grants/", path_params: {}, query: { "query" => query, "type" => type, "benefit_id" => benefit_id, "checkout_id" => checkout_id, "order_id" => order_id, "subscription_id" => subscription_id, "member_id" => member_id, "page" => page, "limit" => limit, "sorting" => sorting }, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::ListResourceCustomerBenefitGrant.from_json(data) end |
#list_each(query: nil, type: nil, benefit_id: nil, checkout_id: nil, order_id: nil, subscription_id: nil, member_id: nil, limit: 10, sorting: ["product_benefit", "-granted_at"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of list, fetching pages on demand.
77 78 79 80 81 82 |
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 77 def list_each(query: nil, type: nil, benefit_id: nil, checkout_id: nil, order_id: nil, subscription_id: nil, member_id: nil, limit: 10, sorting: ["product_benefit", "-granted_at"], &block) paginator = ::Pago::Paginator.new do |page_number| list(query: query, type: type, benefit_id: benefit_id, checkout_id: checkout_id, order_id: order_id, subscription_id: subscription_id, member_id: member_id, page: page_number, limit: limit, sorting: sorting) end block ? paginator.each(&block) : paginator end |
#update(id, body: {}) ⇒ Object
Update a benefit grant for the authenticated customer.
Scopes: customer_portal:write
116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 116 def update(id, body: {}) data = client.request( http_method: "PATCH", path: "/v1/customer-portal/benefit-grants/{id}", path_params: { "id" => id }, query: {}, body: body, response_type: :json, errors: { 403 => Errors::NotPermitted, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Unions::CustomerBenefitGrant.from_json(data) end |