@@ -32,105 +32,162 @@ require('ost-sdk-ruby')
3232Set variables for initializing SDK objects:
3333
3434``` ruby
35- environment = ' sandbox'
36- credentials = OSTSdk ::Util ::APICredentials .new (< api_key> , < api_secret> )
35+ ost_sdk = OSTSdk ::Saas ::Services .new ({api_key: < api_key> , api_secret: < api_secret> , api_base_url: < api_base_url> })
3736```
3837
39- ### Transaction Kind Module
38+ ### Users Module
4039
41- Initialize a ` TransactionKind ` object to perform transaction-related actions:
40+ ``` ruby
41+ ost_users_object = ost_sdk.services.users
42+ ```
43+
44+ Create a new user:
4245
4346``` ruby
44- ostTransactionKindObject = OSTSdk :: Saas :: TransactionKind . new (environment, credentials)
47+ ost_users_object.create( name: ' Alice ' ).to_json
4548```
4649
47- Create new transaction kinds :
50+ Edit an existing user :
4851
4952``` ruby
50- ostTransactionKindObject.create( name : ' Like ' , kind : ' user_to_user ' , currency_type: ' usd ' , currency_value: ' 1.25 ' , commission_percent: ' 12 ' )
53+ ost_users_object.edit( id : ' e55feef0-26e6-438a-9f1a-f348ce2e3c44 ' , name : ' Bob ' ).to_json
5154```
5255
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+
5364``` ruby
54- ostTransactionKindObject.create( name: ' Grant ' , kind: ' company_to_user ' , currency_type: ' bt ' , currency_value: ' 12 ' , commission_percent: ' 0 ' )
65+ ost_users_object.list({ page_no: 1 , limit: 5 }).to_json
5566```
5667
68+ ### Airdrops Module
69+
5770``` ruby
58- ostTransactionKindObject.create( name: ' Buy ' , kind: ' user_to_company ' , currency_type: ' bt ' , currency_value: ' 100 ' , commission_percent: ' 0 ' )
71+ ost_airdrop_object = ost_sdk.services.airdrops
5972```
6073
61- Get a list of existing transaction kinds and other data :
74+ Execute Airdrop :
6275
6376``` ruby
64- ostTransactionKindObject.list()
77+ ost_airdrop_object.execute({ amount: 1 , user_ids: ' e55feef0-26e6-438a-9f1a-f348ce2e3c44 ' }).to_json
6578```
6679
67- Edit an existing transaction kind:
80+ Get Airdrop Status:
81+ ``` ruby
82+ ost_airdrop_object.get({id: ' ecd9b0b2-a0f4-422c-95a4-f25f8fc88334' }).to_json
83+ ```
6884
85+ List Airdrop
6986``` ruby
70- ostTransactionKindObject.edit( client_transaction_id: ' 12 ' , name: ' New Transaction Kind ' )
87+ ost_airdrop_object.list({ page_no: 1 , limit: 50 , current_status: ' processing,complete ' }).to_json
7188```
7289
73- Execute a branded token transfer by transaction kind:
90+
91+ ### Token Module
7492
7593``` ruby
76- ostTransactionKindObject.execute( from_uuid: ' 1234-1928-1081dsds-djhksjd ' , to_uuid: ' 1234-1928-1081-1223232 ' , transaction_kind: ' Purchase ' )
94+ ost_token_object = ost_sdk.services.token
7795```
7896
79- Get the status of an executed transaction :
80-
97+ Get details :
98+
8199``` ruby
82- ostTransactionKindObject.status( transaction_uuids: [ ' 5f79063f-e22a-4d28-99d7-dd095f02c72e ' ])
100+ ost_token_object.get({}).to_json
83101```
84102
85- ### Users Module
103+ ### Actions Module
86104
87- Initialize a ` Users ` object to perform user specific actions:
88105
89106``` ruby
90- ostUsersObject = OSTSdk :: Saas :: Users . new (environment, credentials)
107+ ost_action_object = ost_sdk.services.actions
91108```
92109
93- Create a new user :
110+ Create a new action :
94111
95112``` ruby
96- ostUsersObject.create(name: ' Alice' )
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
97115```
98116
99- Get a list of users and other data :
117+ Edit an action :
100118
101119``` ruby
102- ostUsersObject.list()
120+ ost_action_object.edit({ id: 1234 , amount: 2 }).to_json
103121```
104122
105- Edit an existing user:
123+ Get an action:
124+
125+ ``` ruby
126+ ost_action_object.get(id: 1234 ).to_json
127+ ```
106128
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
107153``` ruby
108- ostUsersObject.edit( uuid: ' 1234-1928-1081dsds-djhksjd ' , name: ' Bob ' )
154+ ost_transaction_object.list({ page_no: 1 , limit: 50 }).to_json
109155```
110156
111- Airdrop branded tokens to users:
157+ ### Transfer Module
112158
113159``` ruby
114- ostUsersObject.airdrop_tokens( amount: 100 , list_type: ' all ' )
160+ ost_transfer_object = ost_sdk.services.transfers
115161```
116162
117- As airdropping tokens is an asynchronous task, you can check the airdrop's status :
163+ Execute Transfer :
118164
119165``` ruby
120- ostUsersObject.get_airdrop_status(airdrop_uuid: ' 1234-1928-1081dsds-djhksjd' )
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
121177```
122178
123179### Request Specs
124180
125- To obtain request/API specification, pass in ` true ` for the optional ` api_spec ` parameter when initializing a ` TransactionKind ` or ` Users ` module object:
181+ To obtain request/API specification, pass in ` true ` for the optional ` api_spec ` parameter when initializing SDK object:
126182
127183``` ruby
128- ostTransactionKindObject = OSTSdk ::Saas ::TransactionKind .new (environment, credentials, true )
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
129186```
130187
131188And then call a method:
132189
133190``` ruby
134- > ostTransactionKindObject .list()
135- => # <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>"}>
136- ```
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+ ```
0 commit comments