|
1 | | -Ruby Examples |
2 | | -============ |
3 | | -Each example class can be run independently. |
| 1 | +## Endpoint Examples |
4 | 2 |
|
5 | | -Each example file demonstrates one of the capabilities of the Rosette Platform. |
| 3 | +These examples are scripts that can be run independently to demonstrate the Rosette API functionality. |
6 | 4 |
|
7 | | -A note on prerequisites. Rosette API only suports TLS 1.2 so ensure your toolchain also supports it. |
8 | | - |
9 | | -## Running the example |
10 | | -You can run your desired `_endpoint_.rb` file to see it in action. |
| 5 | +Each example file demonstrates one of the capabilities of the Rosette Platform. Each example, when run, prints its output to the console. |
11 | 6 |
|
12 | | -`ruby _endpoint_.rb api_key(required) alternate_url(optional)` |
| 7 | +Here are some methods for running the examples. Each example will also accept an optional parameter for |
| 8 | +overriding the default URL. To use, place the url parameter after the key parameter. |
13 | 9 |
|
14 | | -For example, run `ruby categories.js <your_key>` if you want to see the categories |
15 | | -functionality demonstrated. |
| 10 | +A note on prerequisites. Rosette API only suports TLS 1.2 so ensure your toolchain also supports it. |
16 | 11 |
|
17 | | -All files require you to input your Rosette API User Key after `--key` to run. |
18 | | -For example: `ruby ping.js 1234567890` |
| 12 | +#### Docker/Latest Version From RubyGems |
| 13 | +``` |
| 14 | +git clone [email protected]:rosette-api/ruby.git |
| 15 | +cd ruby |
| 16 | +docker run -it -v $(pwd):/source --entrypoint bash ruby:2.6-slim-stretch |
19 | 17 |
|
20 | | -To run all of the examples: |
21 | | -`find -maxdepth 1 -name *.rb -exec ruby {} api_key alternate_url` |
| 18 | +gem install rosette_api |
22 | 19 |
|
23 | | -Each example, when run, prints its output to the console. |
| 20 | +cd /source/examples |
| 21 | +ruby ping.rb $API_KEY |
| 22 | +``` |
24 | 23 |
|
25 | | -## Docker ## |
26 | | -A Docker image for running the examples against the compiled source library is available on Docker Hub. |
| 24 | +#### Docker/Latest Source |
| 25 | +``` |
| 26 | +git clone [email protected]:rosette-api/ruby.git |
| 27 | +cd ruby |
| 28 | +docker run -it -v $(pwd):/source --entrypoint bash ruby:2.6-slim-stretch |
27 | 29 |
|
28 | | -Command: `docker run -e API_KEY=api-key -v "<binding root directory>:/source" rosetteapi/docker-ruby` |
| 30 | +cd /source |
| 31 | +gem build rosette_api.gemspec |
| 32 | +gem install rosette_api*.gem |
29 | 33 |
|
30 | | -Additional environment settings: |
31 | | -`-e ALT_URL=<alternative URL>` |
32 | | -`-e FILENAME=<single filename>` |
| 34 | +cd examples |
| 35 | +ruby ping.rb $API_KEY |
| 36 | +``` |
0 commit comments