OST SDKs

OST SDKs

  • Docs
  • SDKs
  • API References
  • Login
  • Support

›Server Sides SDKs

Introduction

  • Getting Started
  • Authentication
  • API Actions in SDKs
  • WebHooks

Server Sides SDKs

  • PHP
  • Ruby
  • Node.js
  • Java

Mobile Wallet SDKs

  • User Interface Components
  • UI Recommendations
  • Set-Up Guidelines

    • Android
    • iOS
    • React Native

Ruby SDK Quickstart Guide

The Ruby SDK is a Ruby wrapper for the OST Platform API. This Quick Start Guide will show you how to use the Ruby SDK.

You can also view the source code on GitHub

1. Create Token On OST Platform

Follow the Create Token guide to complete token setup.

2. Get Credentials

Once token setup is complete, go to the Developers page inside OST Platform dashboard to get access to your API key and API secret.

Every account is provided with two pairs of keys: one for Sandbox and one for Production. Use your Sandbox API keys for development and testing.

3. Install SDK

To install the SDK run the following command

gem install ost-sdk-ruby

Source code: Ruby SDK GitHub Repo

4. Get Token Information

To get the information about your Token, you will have to use tokens service provided by Ruby SDK.

Instantiating the SDK object

Before using any service of SDK you will have to provide API key and API secret to instantiate new SDK object.

Instantiating The SDK Sample Code

require('ost-sdk-ruby')

ost_sdk = OSTSdk::Saas::Services.new({
                                      api_key: <api_key>, 
                                      api_secret: <api_secret>, 
                                      api_base_url: <api_base_url>, 
                                      config: {timeout: <request_timeout_in_seconds>}
                                    })

Call tokens service

Now you can call any of the SDK. You will call tokens service to get the tokens details.

Get Tokens Details Sample Code

tokens_service = ost_sdk.services.tokens

get_params = {}
response = tokens_service.get()

Token Information

Token entity has important information about your token which we recommend you to save on your server for further use.

{
  "success":true,
  "data":{
    "result_type":"token",
    "token":{
      "id":1085,
      "name":"OSTD",
      "symbol":"OSTD",
      "conversion_factor":1,
      "total_supply":"20000000000000000000000",
      "decimals":18,
      "origin_chain":{
        "chain_id":3,
        "branded_token":"0xd31756555d3a28c990c39fb85087e41afc09ff7a",
        "organization":{
          "contract":"0x0a886e74747f5fed2db45c53df5e0c7b2bacc3d7",
          "owner":"0xaa541c16d8bd7f61c2c0ec31f30b481d435bd5c1"
        },
        "stakers":[
          "0xaa541c16d8bd7f61c2c0ec31f30b481d435bd5c1"
        ]
      },
      "auxiliary_chains":[
        {
          "chain_id":199,
          "utility_branded_token":"0xdd7df6a4ec6a0c2edd051da875ab9a32e9567869",
          "company_token_holders":[
            "0xa9632350057c2226c5a10418b1c3bc9acdf7e2ee"
          ],
          "organization":{
            "contract":"0x5e0c62d0f3f286461ef70e1a01e26bc766107912",
            "owner":"0xaa541c16d8bd7f61c2c0ec31f30b481d435bd5c1"
          }
        }
      ],
      "updated_timestamp":1551870482
    }
  }
}
**Congratulations**

You have completed your first API call from Server Side SDK

5. Register User

Next, you can set-up your users in OST Platform. User objects in OST Platform do not have any personal information about your application users. OST Platform deploys smart contracts for every user and the user object holds the addresses of smart contracts and can be identified by a unique identifier (uuid v4).

note

Create users from your servers. You will be responsible for maintaining the mapping between your application users and OST Platform users.

Create User

To create the user object you will use the user service. No input parameters are needed to create user.


users_service = ost_sdk.services.users
create_params = {}
response = users_service.create(create_params)

Response (User Object)

{
    "success": true,
    "data": {
        "result_type": "user",
        "user": {
            "id": "7303bd10-5114-423e-9206-04cafafb1708",
            "token_id": 1085,
            "token_holder_address": null,
            "device_manager_address": null,
            "recovery_address": null,
            "recovery_owner_address": null,
            "type": "user",
            "status": "CREATED",
            "updated_timestamp": 1552365651
        }
    }
}

Ideally after user creation you should map the user's id with unique identifier of your application user. E.g.: jack.ryan@example.com can be a unique identifier of your application user, this email can be mapped with newly created user's id.

A detailed explanation about each attribute of user is available on user object section in API References.

Next Steps

  1. Android Wallet SDK Setup
  2. iOS Wallet SDK Setup
  3. API Reference
← PHPNode.js →
  • 1. Create Token On OST Platform
  • 2. Get Credentials
  • 3. Install SDK
  • 4. Get Token Information
    • Instantiating the SDK object
    • Call tokens service
    • Token Information
  • 5. Register User
    • Create User
    • Response (User Object)
  • Next Steps
OST Platform
DocsSDKsAPI References
Join The Community
Copyright © 2019 OST.com Inc. All Rights Reserved.