You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library includes [Solargraph](https://solargraph.org) support for both auto completion and go to definition.
141
+
Some editor language services like [Solargraph](https://github.com/castwide/solargraph?tab=readme-ov-file#gem-support) or [Sorbet](https://sorbet.org/docs/rbi#the-hidden-definitions-rbi) require a manually triggered indexing step before functionalities like auto-completion and go to definition can operate.
134
142
135
-
```ruby
136
-
gem "solargraph", group::development
137
-
```
143
+
Please refer to their respective documentation for details. This library also includes a [short guide](https://github.com/orbcorp/orb-ruby/tree/main/CONTRIBUTING.md#editor-support) on how to set up various editor services for internal development.
138
144
139
-
After Solargraph is installed, **you must populate its index** either via the provided editor command, or by running the following in your terminal:
145
+
## Advanced Concepts
140
146
141
-
```sh
142
-
bundle exec solargraph gems
143
-
```
147
+
### Model DSL
144
148
145
-
Note: if you had installed the gem either using a `git:` or `github:` URL, or had vendored the gem using bundler, you will need to set up your [`.solargraph.yml`](https://solargraph.org/guides/configuration) to include the path to the gem's `lib` directory.
149
+
This library uses a Model DSL to represent request parameters and response shapes in `lib/orb/models`.
The model classes service as anchor points for both toolchain readable documentation, and language service assisted navigation links. This information also allows the SDK's internals to perform translation between plain and rich data types; e.g., conversion between a `Time` instance and an ISO8601 `String`, and vice versa.
151
152
152
-
Otherwise Solargraph will not be able to provide type information or auto-completion for any non-indexed libraries.
153
-
154
-
### Sorbet
155
-
156
-
This library is written with [Sorbet type definitions](https://sorbet.org/docs/rbi). However, there is no runtime dependency on the `sorbet-runtime`.
157
-
158
-
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.
159
-
160
-
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:
161
-
162
-
Please follow Sorbet's [setup guides](https://sorbet.org/docs/adopting) for best experience.
153
+
In all places where a `BaseModel` type is specified, vanilla Ruby `Hash` can also be used. For example, the following are interchangeable as arguments:
163
154
164
155
```ruby
156
+
# This has tooling readability, for auto-completion, static analysis, and goto definition with supported language services
Note: **This library emits an intentional warning under the [`tapioca` toolchain](https://github.com/Shopify/tapioca)**. This is normal, and does not impact functionality.
171
-
172
-
### Ruby LSP
173
-
174
-
The Ruby LSP has [best effort support](https://shopify.github.io/ruby-lsp/#guessed-types) for inferring type information from Ruby code, and as such it may not always be able to provide accurate type information.
175
-
176
-
## Advanced
177
-
178
166
### Making custom/undocumented requests
179
167
180
-
This library is typed for convenient access to the documented API.
181
-
182
-
If you need to access undocumented endpoints, params, or response properties, the library can still be used.
183
-
184
168
#### Undocumented request params
185
169
186
170
If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a requests as seen in examples above.
@@ -191,15 +175,15 @@ To make requests to undocumented endpoints, you can make requests using `client.
191
175
192
176
```ruby
193
177
response = client.request(
194
-
method: :post,
195
-
path: '/undocumented/endpoint',
196
-
query: {"dog": "woof"},
197
-
headers: {"useful-header": "interesting-value"},
198
-
body: {"he": "llo"},
199
-
)
178
+
method::post,
179
+
path:'/undocumented/endpoint',
180
+
query: {"dog": "woof"},
181
+
headers: {"useful-header": "interesting-value"},
182
+
body: {"he": "llo"},
183
+
)
200
184
```
201
185
202
-
### Concurrency & Connection Pooling
186
+
### Concurrency & connection pooling
203
187
204
188
The `Orb::Client` instances are thread-safe, and should be re-used across multiple threads. By default, each `Client` have their own HTTP connection pool, with a maximum number of connections equal to thread count.
205
189
@@ -209,6 +193,30 @@ Unless otherwise specified, other classes in the SDK do not have locks protectin
209
193
210
194
Currently, `Orb::Client` instances are only fork-safe if there are no in-flight HTTP requests.
211
195
196
+
### Sorbet
197
+
198
+
#### Enums
199
+
200
+
Sorbet's typed enums require sub-classing of the [`T::Enum` class](https://sorbet.org/docs/tenum) from the `sorbet-runtime` gem.
201
+
202
+
Since this library does not depend on `sorbet-runtime`, it uses a [`T.all` intersection type](https://sorbet.org/docs/intersection-types) with a ruby primitive type to construct a "tagged alias" instead.
203
+
204
+
```ruby
205
+
moduleOrb::Models::BillingCycleRelativeDate
206
+
# This alias aids language service driven navigation.
This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.
@@ -218,3 +226,7 @@ This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` typ
218
226
## Requirements
219
227
220
228
Ruby 3.1.0 or higher.
229
+
230
+
## Contributing
231
+
232
+
See [the contributing documentation](https://github.com/orbcorp/orb-ruby/tree/main/CONTRIBUTING.md).
0 commit comments