A Ruby wrapper for the OST Developers API.
To use this gem, developers will need to:
- Sign-up on https://kit.ost.com.
- Launch a branded token economy with the OST KIT Economy Planner.
- Obtain an API Key and API Secret from https://kit.ost.com/developer-api-console.
Install OST Ruby SDK
> gem install ost-sdk-rubyRequire 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>)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'])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')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>"}>