Class: LockstepSdk::WebhookModel
- Inherits:
-
Object
- Object
- LockstepSdk::WebhookModel
- Defined in:
- lib/lockstep_sdk/models/webhook_model.rb
Overview
A Webhook is a subscription to receive notifications automatically to the supplied callback url when changes are made to a supported object.
Currently supported objects:
* `SyncRequest` - Receive a notification when a new sync request has completed for the group key.
Instance Attribute Summary collapse
-
#callback_http_method ⇒ String
The HTTP Method to be used on the callback URL for use in notifications (GET, POST, PATCH, PUT).
-
#callback_url ⇒ Uri
The URL where the notification will be sent via the method set in CallbackHttpMethod.
-
#client_secret ⇒ String
An secret set during webhook creation that can be used to verify that the notification is coming from the Lockstep API.
-
#created ⇒ Date-time
The date this webhook was created.
-
#created_user_id ⇒ Uuid
The ID of the user who created this webhook.
-
#expiration_date ⇒ Date-time
The expiration date for the given webhook subscription.
-
#group_key ⇒ Uuid
The GroupKey uniquely identifies a single Lockstep Platform account.
-
#modified ⇒ Date-time
The date this webhook was last modified.
-
#modified_user_id ⇒ Uuid
The ID of the user who last modified this webhook.
-
#name ⇒ String
A name for the webhook subscription.
-
#partition_key ⇒ String
The partition key used for the webhook callback history.
-
#request_content_type ⇒ String
The format of the content to be returned in the webhook notifications.
-
#retry_count ⇒ Int32
The amount of times a notification should be retried before marking the webhook as errored.
-
#status_code ⇒ String
The status of the webhook (Active, Inactive, Errored).
-
#status_message ⇒ String
When the StatusCode is set to Errored a message is supplied for why it was errored.
-
#webhook_id ⇒ Uuid
The unique ID of this record, automatically assigned by Lockstep when this record is added to the Lockstep platform.
Instance Method Summary collapse
-
#as_json(options = {}) ⇒ object
This object as a JSON key-value structure.
-
#initialize(params = {}) ⇒ WebhookModel
constructor
Initialize the WebhookModel using the provided prototype.
-
#to_json(*options) ⇒ String
This object converted to a JSON string.
Constructor Details
#initialize(params = {}) ⇒ WebhookModel
Initialize the WebhookModel using the provided prototype
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 31 def initialize(params = {}) @webhook_id = params.dig(:webhook_id) @group_key = params.dig(:group_key) @name = params.dig(:name) @status_code = params.dig(:status_code) @status_message = params.dig(:status_message) @client_secret = params.dig(:client_secret) @request_content_type = params.dig(:request_content_type) @callback_http_method = params.dig(:callback_http_method) @callback_url = params.dig(:callback_url) @expiration_date = params.dig(:expiration_date) @retry_count = params.dig(:retry_count) @created = params.dig(:created) @created_user_id = params.dig(:created_user_id) @modified = params.dig(:modified) @modified_user_id = params.dig(:modified_user_id) @partition_key = params.dig(:partition_key) end |
Instance Attribute Details
#callback_http_method ⇒ String
Returns The HTTP Method to be used on the callback URL for use in notifications (GET, POST, PATCH, PUT).
80 81 82 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 80 def callback_http_method @callback_http_method end |
#callback_url ⇒ Uri
Returns The URL where the notification will be sent via the method set in CallbackHttpMethod. When creating a webhook, the Lockstep API will make a call to this url via the method set in the CallbackHttpMethod property with a query parameter of “code” set to an encoded string. To successfully create the webhook, the call must return a successful status code with the query parameter’s value as the plain text content.
84 85 86 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 84 def callback_url @callback_url end |
#client_secret ⇒ String
Returns An secret set during webhook creation that can be used to verify that the notification is coming from the Lockstep API.
72 73 74 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 72 def client_secret @client_secret end |
#created ⇒ Date-time
Returns The date this webhook was created.
96 97 98 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 96 def created @created end |
#created_user_id ⇒ Uuid
Returns The ID of the user who created this webhook.
100 101 102 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 100 def created_user_id @created_user_id end |
#expiration_date ⇒ Date-time
Returns The expiration date for the given webhook subscription. Once the expiration date passes, notifications will no longer be sent to the callback url.
88 89 90 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 88 def expiration_date @expiration_date end |
#group_key ⇒ Uuid
Returns The GroupKey uniquely identifies a single Lockstep Platform account. All records for this account will share the same GroupKey value. GroupKey values cannot be changed once created. For more information, see [Accounts and GroupKeys](developer.lockstep.io/docs/accounts-and-groupkeys).
56 57 58 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 56 def group_key @group_key end |
#modified ⇒ Date-time
Returns The date this webhook was last modified.
104 105 106 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 104 def modified @modified end |
#modified_user_id ⇒ Uuid
Returns The ID of the user who last modified this webhook.
108 109 110 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 108 def modified_user_id @modified_user_id end |
#name ⇒ String
Returns A name for the webhook subscription.
60 61 62 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 60 def name @name end |
#partition_key ⇒ String
Returns The partition key used for the webhook callback history.
112 113 114 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 112 def partition_key @partition_key end |
#request_content_type ⇒ String
Returns The format of the content to be returned in the webhook notifications. Options TBD.
76 77 78 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 76 def request_content_type @request_content_type end |
#retry_count ⇒ Int32
Returns The amount of times a notification should be retried before marking the webhook as errored.
92 93 94 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 92 def retry_count @retry_count end |
#status_code ⇒ String
Returns The status of the webhook (Active, Inactive, Errored).
64 65 66 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 64 def status_code @status_code end |
#status_message ⇒ String
Returns When the StatusCode is set to Errored a message is supplied for why it was errored.
68 69 70 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 68 def @status_message end |
#webhook_id ⇒ Uuid
Returns The unique ID of this record, automatically assigned by Lockstep when this record is added to the Lockstep platform.
52 53 54 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 52 def webhook_id @webhook_id end |
Instance Method Details
#as_json(options = {}) ⇒ object
Returns This object as a JSON key-value structure.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 116 def as_json(={}) { 'webhookId' => @webhook_id, 'groupKey' => @group_key, 'name' => @name, 'statusCode' => @status_code, 'statusMessage' => @status_message, 'clientSecret' => @client_secret, 'requestContentType' => @request_content_type, 'callbackHttpMethod' => @callback_http_method, 'callbackUrl' => @callback_url, 'expirationDate' => @expiration_date, 'retryCount' => @retry_count, 'created' => @created, 'createdUserId' => @created_user_id, 'modified' => @modified, 'modifiedUserId' => @modified_user_id, 'partitionKey' => @partition_key, } end |
#to_json(*options) ⇒ String
Returns This object converted to a JSON string.
139 140 141 |
# File 'lib/lockstep_sdk/models/webhook_model.rb', line 139 def to_json(*) "[#{as_json(*).to_json(*)}]" end |