@@ -32,105 +32,162 @@ require('ost-sdk-ruby')
32
32
Set variables for initializing SDK objects:
33
33
34
34
``` 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> })
37
36
```
38
37
39
- ### Transaction Kind Module
38
+ ### Users Module
40
39
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:
42
45
43
46
``` ruby
44
- ostTransactionKindObject = OSTSdk :: Saas :: TransactionKind . new (environment, credentials)
47
+ ost_users_object.create( name: ' Alice ' ).to_json
45
48
```
46
49
47
- Create new transaction kinds :
50
+ Edit an existing user :
48
51
49
52
``` 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
51
54
```
52
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
+
53
64
``` 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
55
66
```
56
67
68
+ ### Airdrops Module
69
+
57
70
``` 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
59
72
```
60
73
61
- Get a list of existing transaction kinds and other data :
74
+ Execute Airdrop :
62
75
63
76
``` ruby
64
- ostTransactionKindObject.list()
77
+ ost_airdrop_object.execute({ amount: 1 , user_ids: ' e55feef0-26e6-438a-9f1a-f348ce2e3c44 ' }).to_json
65
78
```
66
79
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
+ ```
68
84
85
+ List Airdrop
69
86
``` 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
71
88
```
72
89
73
- Execute a branded token transfer by transaction kind:
90
+
91
+ ### Token Module
74
92
75
93
``` 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
77
95
```
78
96
79
- Get the status of an executed transaction :
80
-
97
+ Get details :
98
+
81
99
``` ruby
82
- ostTransactionKindObject.status( transaction_uuids: [ ' 5f79063f-e22a-4d28-99d7-dd095f02c72e ' ])
100
+ ost_token_object.get({}).to_json
83
101
```
84
102
85
- ### Users Module
103
+ ### Actions Module
86
104
87
- Initialize a ` Users ` object to perform user specific actions:
88
105
89
106
``` ruby
90
- ostUsersObject = OSTSdk :: Saas :: Users . new (environment, credentials)
107
+ ost_action_object = ost_sdk.services.actions
91
108
```
92
109
93
- Create a new user :
110
+ Create a new action :
94
111
95
112
``` 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
97
115
```
98
116
99
- Get a list of users and other data :
117
+ Edit an action :
100
118
101
119
``` ruby
102
- ostUsersObject.list()
120
+ ost_action_object.edit({ id: 1234 , amount: 2 }).to_json
103
121
```
104
122
105
- Edit an existing user:
123
+ Get an action:
124
+
125
+ ``` ruby
126
+ ost_action_object.get(id: 1234 ).to_json
127
+ ```
106
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
107
153
``` ruby
108
- ostUsersObject.edit( uuid: ' 1234-1928-1081dsds-djhksjd ' , name: ' Bob ' )
154
+ ost_transaction_object.list({ page_no: 1 , limit: 50 }).to_json
109
155
```
110
156
111
- Airdrop branded tokens to users:
157
+ ### Transfer Module
112
158
113
159
``` ruby
114
- ostUsersObject.airdrop_tokens( amount: 100 , list_type: ' all ' )
160
+ ost_transfer_object = ost_sdk.services.transfers
115
161
```
116
162
117
- As airdropping tokens is an asynchronous task, you can check the airdrop's status :
163
+ Execute Transfer :
118
164
119
165
``` 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
121
177
```
122
178
123
179
### Request Specs
124
180
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:
126
182
127
183
``` 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
129
186
```
130
187
131
188
And then call a method:
132
189
133
190
``` 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