Skip to content

EuleriaHealth/chino_rails_6

Repository files navigation

[COMMUNITY] Chino Ruby SDK

Gem Version

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


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 to config-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 API
  • https://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:

  1. Create a Repository

    @repo = @client.repositories.create_repository("test repo description")
  2. 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)
  3. 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)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published