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

#created ⇒ Date-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_id ⇒ Uuid

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_type ⇒ String

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.

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.



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

def event_type
  @event_type
end

#filter ⇒ String

Returns An optional Searchlight filter for this webhook rule. See Searchlight Query Language.

Returns:



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

def filter
  @filter
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.

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.



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

def group_key
  @group_key
end

#modified ⇒ Date-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_id ⇒ Uuid

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_key ⇒ String

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.

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.



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

def table_key
  @table_key
end

#webhook_id ⇒ Uuid

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_id ⇒ Uuid

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