Method: Webhookdb::Replicator::Descriptor#initialize

Defined in:
lib/webhookdb/replicator.rb

#initialize(name:, ctor:, resource_name_singular:, feature_roles:, supports_webhooks: false, supports_backfill: false, resource_name_plural: nil, dependency_descriptor: nil, api_docs_url: "", description: nil, enterprise: false, documentation_url: nil, install_url: nil, documentable: nil) ⇒ Descriptor

Returns a new instance of Descriptor.

Raises:

  • (ArgumentError)


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/webhookdb/replicator.rb', line 93

def initialize(
  name:,
  ctor:,
  resource_name_singular:,
  feature_roles:,
  supports_webhooks: false,
  supports_backfill: false,
  resource_name_plural: nil,
  dependency_descriptor: nil,
  api_docs_url: "",
  description: nil,
  enterprise: false,
  documentation_url: nil,
  install_url: nil,
  documentable: nil
)
  raise ArgumentError, "must support one or both of webhooks and backfill" unless
    supports_webhooks || supports_backfill
  super(
    name:,
    resource_name_singular:,
    feature_roles:,
    supports_webhooks:,
    supports_backfill:,
    dependency_descriptor:,
    documentation_url:,
    api_docs_url:,
    install_url:,
    enterprise:
  )
  @ctor = ctor.is_a?(Class) ? ctor.method(:new) : ctor
  @resource_name_plural = resource_name_plural || "#{self.resource_name_singular}s"
  @description = description || "Replicate #{self.resource_name_plural} into your database."
  @documentable = documentable.nil? ? !self.name.start_with?("webhookdb_", "fake_", "theranest_") : documentable
end