@@ -149,7 +149,6 @@ response = devices_service.get_list(get_params)
149149```
150150
151151
152-
153152### Device Managers Module
154153
155154
@@ -181,7 +180,6 @@ response = device_managers_service.get(get_params)
181180```
182181
183182
184-
185183### Sessions Module
186184
187185In order to create a more seamless user experience, so that users don't have to
@@ -224,6 +222,7 @@ response = sessions_service.get_list(get_params)
224222
225223For executing transactions, you need to understand the 4 modules described below.
226224
225+
227226#### Rules Module
228227
229228When executing a token transfer, a user's TokenHolder contract
@@ -247,6 +246,7 @@ get_params = {}
247246response = rules_service.get_list(get_params)
248247```
249248
249+
250250#### Price Points Module
251251
252252To know the value tokens (such as OST, USDC) price point in pay currency and when it was last updated,
@@ -264,6 +264,7 @@ get_params[:chain_id] = 2000
264264response = price_points_service.get(get_params)
265265```
266266
267+
267268#### Transactions Module
268269
269270After reviewing the rules information received using services in the Rules
@@ -407,7 +408,6 @@ response = tokens_service.get(get_params)
407408```
408409
409410
410-
411411### Chains Module
412412
413413To get information about the auxiliary chain on which the token economy is running, use services
@@ -441,4 +441,79 @@ Get Base Token Detail:
441441``` ruby
442442get_params = {}
443443response = base_tokens_service.get(get_params)
444+ ```
445+
446+
447+ ### Webhooks Module
448+
449+ To manage webhooks on the OST Platform Interface, use services provided by the Webhooks module. You can
450+ use this service to create new webhooks and manage existing webhooks.
451+
452+ ``` ruby
453+ webhooks_service = ost_sdk.services.webhooks
454+ ```
455+
456+ Create Webhook:
457+
458+ ``` ruby
459+ create_params = {}
460+ create_params[:topics ] = [' transactions/initiate' , ' transactions/success' ]
461+ create_params[:url ] = ' https://testingWebhooks.com'
462+ # create_params[:status] = 'inactive'
463+ response = webhooks_service.create(create_params)
464+ ```
465+
466+ Update Webhook:
467+
468+ ``` ruby
469+ update_params = {}
470+ update_params[:webhook_id ] = ' b036aff5-75a3-466d-a20c-a956b198fd14'
471+ update_params[:topics ] = [' transactions/initiate' , ' transactions/success' , ' transactions/failure' ]
472+ update_params[:status ] = ' inactive'
473+ response = webhooks_service.update(update_params)
474+ ```
475+
476+ Get Webhook:
477+
478+ ``` ruby
479+ get_params = {}
480+ get_params[:webhook_id ] = ' b036aff5-75a3-466d-a20c-a956b198fd14'
481+ response = webhooks_service.get(get_params)
482+ ```
483+
484+ Get Webhook List:
485+
486+ ``` ruby
487+ get_params = {}
488+ # get_params[:limit] = 1
489+ # get_params[:pagination_identifier] = 'eyJwYWdlIjoyLCJsaW1pdCI6MX0='
490+ response = webhooks_service.get_list(get_params)
491+ ```
492+
493+ Delete Webhook:
494+
495+ ``` ruby
496+ delete_params = {}
497+ delete_params[:webhook_id ] = ' b036aff5-75a3-466d-a20c-a956b198fd14'
498+ response = webhooks_service.delete(delete_params)
499+ ```
500+
501+ Verify webhook request signature:
502+
503+ ``` ruby
504+ signature_params = {}
505+ webhook_event_data = {" id" :"54e3cd1c-afd7-4dcf-9c78-137c56a53582" ," topic" :"transactions/success" ," created_at" :1560838772 ," webhook_id" :"0823a4ea-5d87-44cf-8ca8-1e5a31bf8e46" ," version" :"v2" ," data" :{" result_type" :"transaction" ," transaction" :{" id" :"ddebe817-b94f-4b51-9227-f543fae4715a" ," transaction_hash" :"0x7ee737db22b58dc4da3f4ea4830ca709b388d84f31e77106cb79ee09fc6448f9" ," from" :"0x69a581096dbddf6d1e0fff7ebc1254bb7a2647c6" ," to" :"0xc2f0dde92f6f3a3cb13bfff43e2bd136f7dcfe47" ," nonce" :3 ," value" :"0" ," gas_price" :"1000000000" ," gas_used" :120558 ," transaction_fee" :"120558000000000" ," block_confirmation" :24 ," status" :"SUCCESS" ," updated_timestamp" :1560838699 ," block_timestamp" :1560838698 ," block_number" :1554246 ," rule_name" :"Pricer" ," meta_property" :{}," transfers" :[{" from" :"0xc2f0dde92f6f3a3cb13bfff43e2bd136f7dcfe47" ," from_user_id" :"acfdea7d-278e-4ffc-aacb-4a21398a280c" ," to" :"0x0a754aaab96d634337aac6556312de396a0ca46a" ," to_user_id" :"7bc8e0bd-6761-4604-8f8e-e33f86f81309" ," amount" :"112325386" ," kind" :"transfer" }]}}}
506+ signature_params[:stringified_data ] = webhook_event_data.to_json
507+
508+ # Get webhoook version from webhook events data.
509+ signature_params[:version ] = " v2"
510+
511+ # Get ost-timestamp from the response received in event.
512+ signature_params[:request_timestamp ] = ' 1559902637'
513+
514+ # Get signature from the response received in event.
515+ signature_params[:signature ] = ' 2c56c143550c603a6ff47054803f03ee4755c9c707986ae27f7ca1dd1c92a824'
516+
517+ signature_params[:webhook_secret ] = ' mySecret'
518+ response = webhooks_service.verify_signature(signature_params)
444519```
0 commit comments