Class: Dinie::Resources::Customers::CreditOffers
- Inherits:
-
Object
- Object
- Dinie::Resources::Customers::CreditOffers
- Defined in:
- lib/dinie/generated/resources/customers.rb
Overview
Operations on the credit offers resource.
Instance Method Summary collapse
-
#initialize(http) ⇒ CreditOffers
constructor
A new instance of CreditOffers.
-
#list(customer_id, limit: Internal::OMIT, starting_after: Internal::OMIT, request_options: {}, **filters) ⇒ Object
List credit offers for a customer.
Constructor Details
#initialize(http) ⇒ CreditOffers
Returns a new instance of CreditOffers.
138 139 140 |
# File 'lib/dinie/generated/resources/customers.rb', line 138 def initialize(http) @http = http end |
Instance Method Details
#list(customer_id, limit: Internal::OMIT, starting_after: Internal::OMIT, request_options: {}, **filters) ⇒ Object
List credit offers for a customer
List credit offers for a specific customer, filterable by ‘status`
150 151 152 153 154 155 156 157 158 159 |
# File 'lib/dinie/generated/resources/customers.rb', line 150 def list(customer_id, limit: Internal::OMIT, starting_after: Internal::OMIT, request_options: {}, **filters) path = "/customers/#{customer_id}/credit-offers" fetch_page = lambda do |cursor| query = { limit:, starting_after: cursor || starting_after, **filters } .reject { |_key, value| Internal.omitted?(value) } body = @http.request(method: :get, path:, query:, request_options:) { data: body[:data].map { |raw| CreditOffer.deserialize(raw) }, has_more: body[:has_more] } end Dinie::Page.from_fetch(fetch_page) end |