Skip to content

Commit 0420f35

Browse files
chore: add more examples to README.md (#118)
1 parent 9b1ea1d commit 0420f35

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,25 @@ customer = orb.customers.create(email: "example-customer@withorb.com", name: "My
4343
puts(customer.id)
4444
```
4545

46+
## Pagination
47+
48+
List methods in the Orb API are paginated.
49+
50+
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
51+
52+
```ruby
53+
page = orb.coupons.list
54+
55+
# Fetch single item from page.
56+
coupon = page.data[0]
57+
puts(coupon.id)
58+
59+
# Automatically fetches more pages as needed.
60+
page.auto_paging_each do |coupon|
61+
puts(coupon.id)
62+
end
63+
```
64+
4665
### Errors
4766

4867
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Orb::Error` will be thrown:
@@ -117,9 +136,9 @@ orb.customers.create(
117136

118137
## Sorbet Support
119138

120-
This library is written with [Sorbet type definitions](https://sorbet.org/docs/rbi). However, there is no runtime dependency on the Sorbet runtime.
139+
This library is written with [Sorbet type definitions](https://sorbet.org/docs/rbi). However, there is no runtime dependency on the `sorbet-runtime`.
121140

122-
What this means is that while you can use Sorbet to type check your code statically, and benefit from the [Sorbet Language Server](https://sorbet.org/docs/lsp) in your editor, there is no runtime type checking and execution overhead from Sorbet.
141+
What this means is that while you can use Sorbet to type check your code statically, and benefit from the [Sorbet Language Server](https://sorbet.org/docs/lsp) in your editor, there is no runtime type checking and execution overhead from Sorbet itself.
123142

124143
Due to limitations with the Sorbet type system, where a method otherwise can take an instance of `Orb::BaseModel` class, you will need to use the `**` splat operator to pass the arguments:
125144

0 commit comments

Comments
 (0)