[COMMUNITY] Chino Ruby SDK <!-- omit in toc -->
Ruby SDK for Chino.io API
Community SDK: Most of the content and the code has been provided by third-parties.
Version: 3.0.0
Useful links
For issues or questions, please contact [email protected].
Table of content <!-- omit in toc -->
Requirements
Ruby - Download
Once you got the Ruby runtime, you may want to install the Bundler package manager which allows to run the
bundle
commands:gem install bundler
Installation
Copy file
config-chino-base.yml
toconfig-chino.yml
.Insert the credentials from your account on the Chino.io platform. Do not commit this file in git!
Install the dependencies using one of the following methods:
- Add this line to your application's Gemfile:
gem 'chino_ruby'
And then execute:
bundle
Install with:
gem install chino_ruby
Run
bundle exec rake install
Usage
Initialize a Chino.io client variable as follows:
@client = ChinoAPI.new("<your-customer-id>", "<your-customer-key>", "<server-url>")
The Customer ID and Key are provided with your account for the Chino.io platform.
The server URL must be one of:
https://api.test.chino.io/v1
for the Test APIhttps://api.chino.io/v1
for the Production API
Once you created your client instance, you can use it to call functions and communicate with the server.
Basic example
Let's create a Document on Chino.io:
Create a Repository
@repo = @client.repositories.create_repository("test repo description")
Create a Schema inside the Repository
fields = [] fields.push(Field.new("string", "test_string", true)) fields.push(Field.new("integer", "test_integer", true)) @schema = @client.schemas.create_schema(@repo.repository_id, "test schema description", fields)
Finally, create the Document inside the Schema
content = Hash.new content["test_string"] = "sample value ruby" content["test_integer"] = 123 @doc = @client.documents.create_document(@schema.schema_id, content)