Skip to content

Commit a153652

Browse files
authored
Merge pull request #13 from algolia/feat/ruby-playground
Add Ruby playground
2 parents 794083b + cf8b234 commit a153652

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

ruby/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Gemfile.lock

ruby/Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
source "https://rubygems.org"
2+
3+
# See https://github.com/algolia/algoliasearch-client-ruby
4+
gem "algoliasearch", ">=1.26"
5+

ruby/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# About Algolia's API Client Ruby
2+
3+
Algolia's API Client ruby was created by, and is maintained by [Algolia](https://github.com/algolia). The Algolia Search API Client for Ruby lets you easily use the Algolia Search REST API from your ruby code.
4+
5+
## Get started locally
6+
7+
> **Requires:**
8+
- **[Ruby > 1.8.7](https://www.ruby-lang.org)**
9+
- **[Bundle](https://bundler.io/)**
10+
11+
First, use *bundle* to playground dependencies:
12+
```bash
13+
# Go inside the playground ruby folder
14+
cd api-clients-playground/ruby
15+
# Install dependencies
16+
bundle install
17+
```
18+
19+
Finally, edit and run the code on `index.rb`:
20+
```
21+
ruby index.rb
22+
```

ruby/index.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require 'algoliasearch'
2+
3+
Algolia.init(application_id: 'ALGOLIA_APP_ID',
4+
api_key: 'ALGOLIA_SECRET')
5+
index = Algolia::Index.new('INDEX_NAME')
6+
7+
res = index.search('')
8+
puts res

0 commit comments

Comments
 (0)