Skip to content

Commit d4466b7

Browse files
committed
DEVOPS-247: Update example README. Address example payload tweak. Remove docker dir.
1 parent 477e4cb commit d4466b7

File tree

5 files changed

+36
-161
lines changed

5 files changed

+36
-161
lines changed

examples/README.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1-
Ruby Examples
2-
============
3-
Each example class can be run independently.
1+
## Endpoint Examples
42

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.
64

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.
116

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.
139

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.
1611

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
1917
20-
To run all of the examples:
21-
`find -maxdepth 1 -name *.rb -exec ruby {} api_key alternate_url`
18+
gem install rosette_api
2219
23-
Each example, when run, prints its output to the console.
20+
cd /source/examples
21+
ruby ping.rb $API_KEY
22+
```
2423

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
2729
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
2933
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+
```

examples/address_similarity.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212

1313
begin
1414
address1 = AddressParameter.new(
15-
'house_number': '1600',
16-
'road': 'Pennsylvania Ave NW',
17-
'city': 'Washington',
18-
'state': 'DC',
19-
'post_code': '20500'
15+
house_number: '1600',
16+
road: 'Pennsylvania Ave NW',
17+
city: 'Washington',
18+
state: 'DC',
19+
post_code: '20500'
2020
)
2121
address2 = AddressParameter.new(
22-
'house_number': '160',
23-
'road': 'Pennsilvana Avenue',
24-
'city': 'Washington',
25-
'state': 'D.C.',
26-
'post_code': '20500'
22+
house_number: '160',
23+
road: 'Pennsilvana Avenue',
24+
city: 'Washington',
25+
state: 'D.C.',
26+
post_code: '20500'
2727
)
2828
params = AddressSimilarityParameters.new(address1, address2)
2929
response = rosette_api.get_address_similarity(params)

examples/docker/Dockerfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

examples/docker/README.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

examples/docker/run_ruby.sh

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)