Class: Zazu::Resources::Base
- Inherits:
-
Object
- Object
- Zazu::Resources::Base
- Defined in:
- lib/zazu/resources/base.rb
Overview
Shared scaffolding for every resource module. Carries a back- reference to the client and exposes thin HTTP helpers that delegate to Client#request.
Note on naming: the helpers are ‘http_get`, `http_post`, etc. rather than `get`/`post` so they do not shadow the public methods on resource subclasses. Public resources commonly define a `get(id)` method, and a same-named private helper on the base class would let `Base#list_page` accidentally dispatch to the subclass version when a list endpoint is hit.
Pagination:
Every resource that has a list endpoint exposes `#list` which
returns a {Zazu::Page}. Callers can walk pages explicitly via
`page.next` or use `each_page_record` for capped iteration.
Direct Known Subclasses
Accounts, Customers, Entity, Invoices, PaymentLinks, WebhookEndpoints
Constant Summary collapse
- MAX_PER_PAGE =
Page::MAX_PER_PAGE
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(client) ⇒ Base
Returns a new instance of Base.
26 27 28 |
# File 'lib/zazu/resources/base.rb', line 26 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
24 25 26 |
# File 'lib/zazu/resources/base.rb', line 24 def client @client end |