Skip to content

Commit 825c477

Browse files
author
Puneet Khushwani
committed
added a readme file for V1 API's.
version change for self
1 parent e877c61 commit 825c477

3 files changed

Lines changed: 195 additions & 2 deletions

File tree

README_V1.md

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Ost::Sdk::Ruby
2+
3+
A Ruby wrapper for the [OST Developers API](https://dev.ost.com/).
4+
5+
## Requirements
6+
7+
To use this gem, developers will need to:
8+
1. Sign-up on [https://kit.ost.com](https://kit.ost.com).
9+
2. Launch a branded token economy with the OST KIT Economy Planner.
10+
3. Obtain an API Key and API Secret from [https://kit.ost.com/developer-api-console](https://kit.ost.com/developer-api-console).
11+
12+
## Documentation
13+
14+
[https://dev.ost.com/](https://dev.ost.com/)
15+
16+
## Installation
17+
18+
Install OST Ruby SDK
19+
20+
```bash
21+
> gem install ost-sdk-ruby
22+
```
23+
24+
## Example Usage
25+
26+
Require the OST Ruby SDK:
27+
28+
```ruby
29+
require('ost-sdk-ruby')
30+
```
31+
32+
Set variables for initializing SDK objects:
33+
34+
```ruby
35+
ost_sdk = OSTSdk::Saas::Services.new({api_key: <api_key>, api_secret: <api_secret>, api_base_url: <api_base_url>})
36+
```
37+
38+
### Users Module
39+
40+
```ruby
41+
ost_users_object = ost_sdk.services.users
42+
```
43+
44+
Create a new user:
45+
46+
```ruby
47+
ost_users_object.create(name: 'Alice').to_json
48+
```
49+
50+
Edit an existing user:
51+
52+
```ruby
53+
ost_users_object.edit(id: 'e55feef0-26e6-438a-9f1a-f348ce2e3c44', name: 'Bob').to_json
54+
```
55+
56+
Get an existing user:
57+
58+
```ruby
59+
ost_users_object.get(id: 'e55feef0-26e6-438a-9f1a-f348ce2e3c44').to_json
60+
```
61+
62+
Get a list of users and other data:
63+
64+
```ruby
65+
ost_users_object.list({page_no: 1, limit: 5}).to_json
66+
```
67+
68+
### Airdrops Module
69+
70+
```ruby
71+
ost_airdrop_object = ost_sdk.services.airdrops
72+
```
73+
74+
Execute Airdrop:
75+
76+
```ruby
77+
ost_airdrop_object.execute({amount: 1, user_ids: 'e55feef0-26e6-438a-9f1a-f348ce2e3c44'}).to_json
78+
```
79+
80+
Get Airdrop Status:
81+
```ruby
82+
ost_airdrop_object.get({id: 'ecd9b0b2-a0f4-422c-95a4-f25f8fc88334'}).to_json
83+
```
84+
85+
List Airdrop
86+
```ruby
87+
ost_airdrop_object.list({page_no: 1, limit: 50, current_status: 'processing,complete'}).to_json
88+
```
89+
90+
91+
### Token Module
92+
93+
```ruby
94+
ost_token_object = ost_sdk.services.token
95+
```
96+
97+
Get details:
98+
99+
```ruby
100+
ost_token_object.get({}).to_json
101+
```
102+
103+
### Actions Module
104+
105+
106+
```ruby
107+
ost_action_object = ost_sdk.services.actions
108+
```
109+
110+
Create a new action:
111+
112+
```ruby
113+
ost_action_object.create({name: 'Test', kind: 'user_to_user', currency: 'USD', arbitrary_amount: false, amount: 1.01,
114+
arbitrary_commission: true}).to_json
115+
```
116+
117+
Edit an action:
118+
119+
```ruby
120+
ost_action_object.edit({id: 1234, amount: 2}).to_json
121+
```
122+
123+
Get an action:
124+
125+
```ruby
126+
ost_action_object.get(id: 1234).to_json
127+
```
128+
129+
List actions:
130+
131+
```ruby
132+
ost_action_object.list(page_no: 1).to_json
133+
```
134+
135+
### Transaction Module
136+
137+
```ruby
138+
ost_transaction_object = ost_sdk.services.transactions
139+
```
140+
141+
Execute Transaction:
142+
143+
```ruby
144+
ost_transaction_object.execute({from_user_id:'f87346e4-61f6-4d55-8cb8-234c65437b01', to_user_id:'c07bd853-e893-4400-b7e8-c358cfa05d85', action_id:'20145'}).to_json
145+
```
146+
147+
Get Transaction Status:
148+
```ruby
149+
ost_transaction_object.get({id: '0ab712ec-dc41-4e31-ac31-c93bc148bbb9'}).to_json
150+
```
151+
152+
List Transactions
153+
```ruby
154+
ost_transaction_object.list({page_no: 1, limit: 50}).to_json
155+
```
156+
157+
### Transfer Module
158+
159+
```ruby
160+
ost_transfer_object = ost_sdk.services.transfers
161+
```
162+
163+
Execute Transfer:
164+
165+
```ruby
166+
ost_transfer_object.execute({to_address:'0xd2b789293674faEE51bEb2d0338d15401dEbfdE3', amount:1}).to_json
167+
```
168+
169+
Get Transfer Status:
170+
```ruby
171+
ost_transfer_object.get({id: 'd0589dc5-d0a0-4996-b9f8-847295fd2c3b'}).to_json
172+
```
173+
174+
List Transfers
175+
```ruby
176+
ost_transfer_object.list().to_json
177+
```
178+
179+
### Request Specs
180+
181+
To obtain request/API specification, pass in `true` for the optional `api_spec` parameter when initializing SDK object:
182+
183+
```ruby
184+
ost_sdk = OSTSdk::Saas::Services.new({api_key: <api_key>, api_secret: <api_secret>, api_base_url: <api_base_url>, api_spec: true})
185+
ost_action_object = ost_sdk.services.actions
186+
```
187+
188+
And then call a method:
189+
190+
```ruby
191+
ost_action_object.list().to_json
192+
{:success=>true, :data=>{:request_uri=>"https://playground2api.stagingost.com/v1/actions/", :request_type=>"GET", :request_params=>"request_timestamp=1526541627&signature=410f6fef1ab2ad34e74caef589a15b56490b63a316fc46509d31bb133bf11678&api_key=7cad25e082390a90114e"}}
193+
```

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0
1+
1.1.0.beta2

lib/ost-sdk-ruby/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module OSTSdk
22

3-
VERSION = "1.1.0"
3+
VERSION = "1.1.0.beta2"
44

55
end

0 commit comments

Comments
 (0)