Skip to content

Commit

Permalink
Merge pull request #52 from ostdotcom/develop
Browse files Browse the repository at this point in the history
Support for new API route - /base-tokens
  • Loading branch information
kedarchandrayan authored Jun 3, 2019
2 parents 75d3cf9 + 8c65ef7 commit 05ee976
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[OST JAVA SDK v2.1.0](https://github.com/ostdotcom/ost-sdk-java/tree/v2.1.0)
---

* Added base tokens module to V2 API's

[OST Ruby SDK v2.0.0](https://github.com/ostdotcom/ost-sdk-ruby/tree/v2.0.0)
---

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018 OST.com Ltd.
Copyright (c) 2019 OST.com Inc.

MIT License

Expand Down
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# OST Ruby SDK
[![Build Status](https://travis-ci.org/ostdotcom/ost-sdk-ruby.svg?branch=develop)](https://travis-ci.org/ostdotcom/ost-sdk-ruby)

The official [OST](https://dev.ost.com/) Ruby SDK.
[OST](https://dev.ost.com/) Platform SDK for Ruby.

## Introduction

OST is a complete technology solution enabling mainstream businesses
to easily launch blockchain-based economies without
requiring blockchain development.

At the core of OST is the concept of OST-powered Brand Tokens (BTs).
BTs are white-label cryptocurrency tokens with utility representations
Brand Tokens (BTs) are white-label cryptocurrency tokens with utility representations
running on highly-scalable Ethereum-based side blockchains,
backed by OST tokens staked on Ethereum mainnet. Within a business’s
backed by value token (such as OST, USDC) staked on Ethereum mainnet. Within a business’s
token economy, BTs can only be transferred to whitelisted user addresses.
This ensures that they stay within the token economy.

The OST technology stack is designed to give businesses everything they need
to integrate, test, and deploy BTs. Within the OST suite of products, developers
can use OST Platform to create, test, and launch Brand Tokens backed by OST.
can use OST Platform to create, test, and launch Brand Tokens backed by value token (such as OST, USDC).

OST APIs and server-side SDKs make it simple and easy for developers to
integrate blockchain tokens into their apps.
Expand Down Expand Up @@ -250,7 +249,7 @@ response = rules_service.get_list(get_params)

#### Price Points Module

To know the OST price point in USD and when it was last updated,
To know the value tokens (such as OST, USDC) price point in pay currency and when it was last updated,
use services provided by the Price Points module.

```ruby
Expand Down Expand Up @@ -426,3 +425,20 @@ get_params[:chain_id] = 2000
response = chains_service.get(get_params)
```


### Base Tokens Module

To get information about the value tokens (such as OST, USDC) available on the OST Platform interface, use services
provided by the Base Tokens module. You can use this service to obtain the value token details
on OST Platform interface.

```ruby
base_tokens_service = ost_sdk.services.base_tokens
```

Get Base Token Detail:

```ruby
get_params = {}
response = base_tokens_service.get(get_params)
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
2.1.0
1 change: 1 addition & 0 deletions lib/ost-sdk-ruby/saas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
require_relative 'saas/tokens'
require_relative 'saas/transactions'
require_relative 'saas/users'
require_relative 'saas/base_tokens'

module OSTSdk

Expand Down
35 changes: 35 additions & 0 deletions lib/ost-sdk-ruby/saas/base_tokens.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module OSTSdk

module Saas


class BaseTokens < OSTSdk::Saas::Base

# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
super
@url_prefix = '/base-tokens'
end

# Get token details
#
# Returns:
# response: (Hash)
#
def get(params = {})
http_helper.send_get_request("#{@url_prefix}", params)
end

end

end

end
3 changes: 2 additions & 1 deletion lib/ost-sdk-ruby/saas/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Saas
class Manifest

attr_reader :balance, :chains, :device_managers, :devices, :price_points, :recovery_owners, :rules,
:sessions, :tokens, :transactions, :users
:sessions, :tokens, :transactions, :users, :base_tokens

# Initialize
#
Expand All @@ -30,6 +30,7 @@ def initialize(params)
@tokens = OSTSdk::Saas::Tokens.new(params)
@transactions = OSTSdk::Saas::Transactions.new(params)
@users = OSTSdk::Saas::Users.new(params)
@base_tokens = OSTSdk::Saas::BaseTokens.new(params)

end

Expand Down
18 changes: 18 additions & 0 deletions lib/ost-sdk-ruby/test/base_tokens_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"

class BaseTokensTest < Test::Unit::TestCase

def base_tokens_service
@base_tokens_service ||= Config::OST_SDK.services.base_tokens
end

def test_base_tokens_get
result = base_tokens_service.get()
puts "result=>#{result}" unless result["success"]
assert_equal(result["success"], true )
end

end
4 changes: 4 additions & 0 deletions lib/ost-sdk-ruby/util/http_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ def perform_and_handle_exceptions(internal_id = 'swr', msg = 'Something Went Wro
begin
yield if block_given?
rescue Timeout::Error => ex
puts "TimeoutError::message #{ex.message}"
puts "TimeoutError::backtrace #{ex.backtrace}"
OSTSdk::Util::CustomErrorResponse.new({internal_id: internal_id, msg: msg}).timeout_error_response
rescue StandardError => se
puts "StandardError::message #{se.message}"
puts "StandardError::backtrace #{se.backtrace}"
OSTSdk::Util::CustomErrorResponse.new({internal_id: internal_id, msg: msg}).default_error_response
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ost-sdk-ruby/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module OSTSdk

VERSION = "2.0.0"
VERSION = "2.0.1.beta1"

end
6 changes: 3 additions & 3 deletions ost-sdk-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Gem::Specification.new do |spec|

spec.name = "ost-sdk-ruby"
spec.version = OSTSdk::VERSION
spec.authors = ['OST.COM LTD.']
spec.authors = ['OST.com Inc.']
spec.email = []
spec.summary = 'OST Ruby SDK'
spec.description = 'The official OST Ruby SDK'
spec.homepage = "https://kit.ost.com"
spec.description = 'OST Platform SDK for Ruby'
spec.homepage = "https://platform.ost.com"
spec.license = "MIT"
spec.metadata = {
"documentation_uri" => "https://dev.ost.com"
Expand Down

0 comments on commit 05ee976

Please sign in to comment.