Class: LockstepSdk::WebhookRuleModel

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/models/webhook_rule_model.rb

Overview

A Webhook Rule is a subscription to receive notifications whenever a specific event occurs.

With the rule, you specify the Table and event you want to subscribe to. You can also optionally specify a filter to further refine the updates you want to receive.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ WebhookRuleModel

Initialize the WebhookRuleModel using the provided prototype



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 28

def initialize(params = {})
    @webhook_rule_id = params.dig(:webhook_rule_id)
    @webhook_id = params.dig(:webhook_id)
    @group_key = params.dig(:group_key)
    @table_key = params.dig(:table_key)
    @event_type = params.dig(:event_type)
    @filter = params.dig(:filter)
    @created = params.dig(:created)
    @created_user_id = params.dig(:created_user_id)
    @modified = params.dig(:modified)
    @modified_user_id = params.dig(:modified_user_id)
end

Instance Attribute Details

#createdDate-time

Returns The date this webhook rule was created.

Returns:

  • (Date-time)

    The date this webhook rule was created



67
68
69
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 67

def created
  @created
end

#created_user_idUuid

Returns The ID of the user who created this webhook rule.

Returns:

  • (Uuid)

    The ID of the user who created this webhook rule



71
72
73
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 71

def created_user_id
  @created_user_id
end

#event_typeString

Returns A Webhook rule is setup to be fired based on ‘TableKey` and `EventType`. For example, a Webhook setup for when an Invoice is Created would have a `TableKey` value of `Invoice` and an `EventType` value of `I` (Insert). The `EventType` value is one of the following: - I (Insert) - D (Delete) - U (Update) For more information, see [linking metadata to an object](developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).

Returns:

  • (String)

    A Webhook rule is setup to be fired based on ‘TableKey` and `EventType`. For example, a Webhook setup for when an Invoice is Created would have a `TableKey` value of `Invoice` and an `EventType` value of `I` (Insert). The `EventType` value is one of the following: - I (Insert) - D (Delete) - U (Update) For more information, see [linking metadata to an object](developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).



59
60
61
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 59

def event_type
  @event_type
end

#filterString

Returns An optional Searchlight filter for this webhook rule. See [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight).

Returns:



63
64
65
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 63

def filter
  @filter
end

#group_keyUuid

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).

Returns:

  • (Uuid)

    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).



51
52
53
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 51

def group_key
  @group_key
end

#modifiedDate-time

Returns The date this webhook rule was last modified.

Returns:

  • (Date-time)

    The date this webhook rule was last modified



75
76
77
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 75

def modified
  @modified
end

#modified_user_idUuid

Returns The ID of the user who last modified this webhook rule.

Returns:

  • (Uuid)

    The ID of the user who last modified this webhook rule



79
80
81
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 79

def modified_user_id
  @modified_user_id
end

#table_keyString

Returns A Webhook rule is setup to be fired based on ‘TableKey` and `EventType`. For example, a Webhook setup for when an Invoice is Created would have a `TableKey` value of `Invoice` and an `EventType` value of `I` (Insert). The `TableKey` value contains the name of the table within the Lockstep Platform to which this metadata is connected. For more information, see [linking metadata to an object](developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).

Returns:

  • (String)

    A Webhook rule is setup to be fired based on ‘TableKey` and `EventType`. For example, a Webhook setup for when an Invoice is Created would have a `TableKey` value of `Invoice` and an `EventType` value of `I` (Insert). The `TableKey` value contains the name of the table within the Lockstep Platform to which this metadata is connected. For more information, see [linking metadata to an object](developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).



55
56
57
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 55

def table_key
  @table_key
end

#webhook_idUuid

Returns The unique Webhook ID that will be used to fire the webhook for this rule.

Returns:

  • (Uuid)

    The unique Webhook ID that will be used to fire the webhook for this rule.



47
48
49
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 47

def webhook_id
  @webhook_id
end

#webhook_rule_idUuid

Returns The unique ID of this record, automatically assigned by Lockstep when this record is added to the Lockstep platform.

Returns:

  • (Uuid)

    The unique ID of this record, automatically assigned by Lockstep when this record is added to the Lockstep platform.



43
44
45
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 43

def webhook_rule_id
  @webhook_rule_id
end

Instance Method Details

#as_json(options = {}) ⇒ object

Returns This object as a JSON key-value structure.

Returns:

  • (object)

    This object as a JSON key-value structure



83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 83

def as_json(options={})
    {
        'webhookRuleId' => @webhook_rule_id,
        'webhookId' => @webhook_id,
        'groupKey' => @group_key,
        'tableKey' => @table_key,
        'eventType' => @event_type,
        'filter' => @filter,
        'created' => @created,
        'createdUserId' => @created_user_id,
        'modified' => @modified,
        'modifiedUserId' => @modified_user_id,
    }
end

#to_json(*options) ⇒ String

Returns This object converted to a JSON string.

Returns:

  • (String)

    This object converted to a JSON string



100
101
102
# File 'lib/lockstep_sdk/models/webhook_rule_model.rb', line 100

def to_json(*options)
    "[#{as_json(*options).to_json(*options)}]"
end