Skip to content

PANDR-Berlin/ost-sdk-ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ost::Sdk::Ruby

A Ruby wrapper for the OST Developers API.

Requirements

To use this gem, developers will need to:

  1. Sign-up on https://kit.ost.com.
  2. Launch a branded token economy with the OST KIT Economy Planner.
  3. Obtain an API Key and API Secret from https://kit.ost.com/developer-api-console.

Documentation

https://dev.ost.com/

Installation

Install OST Ruby SDK

> gem install ost-sdk-ruby

Example Usage

Require the OST Ruby SDK:

require('ost-sdk-ruby')

Set variables for initializing SDK objects:

environment = 'sandbox'
credentials = OSTSdk::Util::APICredentials.new(<api_key>, <api_secret>)

Transaction Kind Module

Initialize a TransactionKind object to perform transaction-related actions:

ostTransactionKindObject = OSTSdk::Saas::TransactionKind.new(environment, credentials)

Create new transaction kinds:

ostTransactionKindObject.create(name: 'Like', kind: 'user_to_user', currency_type: 'usd', currency_value: '1.25', commission_percent: '12')
ostTransactionKindObject.create(name: 'Grant', kind: 'company_to_user', currency_type: 'bt', currency_value: '12', commission_percent: '0')
ostTransactionKindObject.create(name: 'Buy', kind: 'user_to_company', currency_type: 'bt', currency_value: '100', commission_percent: '0')

Get a list of existing transaction kinds and other data:

ostTransactionKindObject.list()

Edit an existing transaction kind:

ostTransactionKindObject.edit(client_transaction_id: '12', name: 'New Transaction Kind')

Execute a branded token transfer by transaction kind:

ostTransactionKindObject.execute(from_uuid: '1234-1928-1081dsds-djhksjd', to_uuid: '1234-1928-1081-1223232', transaction_kind: 'Purchase')

Get the status of an executed transaction:

ostTransactionKindObject.status(transaction_uuids: ['5f79063f-e22a-4d28-99d7-dd095f02c72e'])

Users Module

Initialize a Users object to perform user specific actions:

ostUsersObject = OSTSdk::Saas::Users.new(environment, credentials)

Create a new user:

ostUsersObject.create(name: 'Alice')

Get a list of users and other data:

ostUsersObject.list()

Edit an existing user:

ostUsersObject.edit(uuid: '1234-1928-1081dsds-djhksjd', name: 'Bob')

Airdrop branded tokens to users:

ostUsersObject.airdrop_tokens(amount: 100, list_type: 'all')

As airdropping tokens is an asynchronous task, you can check the airdrop's status:

ostUsersObject.get_airdrop_status(airdrop_uuid: '1234-1928-1081dsds-djhksjd')

Request Specs

To obtain request/API specification, pass in true for the optional api_spec parameter when initializing a TransactionKind or Users module object:

ostTransactionKindObject = OSTSdk::Saas::TransactionKind.new(environment, credentials, true)

And then call a method:

> ostTransactionKindObject.list()
=> #<OSTSdk::Util::Result:0x007ffccab36c98 @error=nil, @error_message=nil, @error_data=nil, @error_display_text=nil, @error_display_heading=nil, @message=nil, @http_code=200, @data={:request_uri=>"https://sandboxapi.ost.com/transaction-types/list", :request_type=>"GET", :request_params=>"request_timestamp=<request_epoch_timestamp>&signature=<signature>&api_key=<api_key>"}>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%