Module: Webhookdb::Replicator::ConvertkitV1Mixin
Constant Summary
collapse
- CONV_FIND_CANCELED_AT =
Converter for use with the denormalized columns
Webhookdb::Replicator::Column::IsomorphicProc.new(
ruby: lambda do |_, resource:, **_|
resource.fetch("state") == "active" ? nil : Time.now
end,
sql: nil,
)
DBAdapter::ColumnTypes::BIGINT, DBAdapter::ColumnTypes::BIGINT_ARRAY, DBAdapter::ColumnTypes::BOOLEAN, DBAdapter::ColumnTypes::COLUMN_TYPES, DBAdapter::ColumnTypes::DATE, DBAdapter::ColumnTypes::DECIMAL, DBAdapter::ColumnTypes::DOUBLE, DBAdapter::ColumnTypes::FLOAT, DBAdapter::ColumnTypes::INTEGER, DBAdapter::ColumnTypes::INTEGER_ARRAY, DBAdapter::ColumnTypes::OBJECT, DBAdapter::ColumnTypes::TEXT, DBAdapter::ColumnTypes::TEXT_ARRAY, DBAdapter::ColumnTypes::TIMESTAMP, DBAdapter::ColumnTypes::UUID
Instance Method Summary
collapse
Instance Method Details
#_remote_key_column ⇒ Object
16
17
18
|
# File 'lib/webhookdb/replicator/convertkit_v1_mixin.rb', line 16
def _remote_key_column
return Webhookdb::Replicator::Column.new(:convertkit_id, BIGINT, data_key: "id")
end
|
#_verify_backfill_401_err_msg ⇒ Object
45
46
47
|
# File 'lib/webhookdb/replicator/convertkit_v1_mixin.rb', line 45
def _verify_backfill_401_err_msg
return "It looks like that API Secret is invalid. Please reenter the API Secret:"
end
|
#_verify_backfill_err_msg ⇒ Object
49
50
51
|
# File 'lib/webhookdb/replicator/convertkit_v1_mixin.rb', line 49
def _verify_backfill_err_msg
return "An error occurred. Please reenter the API Secret:"
end
|
#_webhook_response(_request) ⇒ Object
11
12
13
14
|
# File 'lib/webhookdb/replicator/convertkit_v1_mixin.rb', line 11
def _webhook_response(_request)
return Webhookdb::WebhookResponse.ok
end
|
#backfiller_server_error_backoff ⇒ Object
9
|
# File 'lib/webhookdb/replicator/convertkit_v1_mixin.rb', line 9
def backfiller_server_error_backoff = 121.seconds
|
#backfiller_server_error_retries ⇒ Object
ConvertKit gets a decent number of 5xx responses. Wait for about 20 minutes before the job dies.
8
|
# File 'lib/webhookdb/replicator/convertkit_v1_mixin.rb', line 8
def backfiller_server_error_retries = 10
|
#calculate_backfill_state_machine ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/webhookdb/replicator/convertkit_v1_mixin.rb', line 20
def calculate_backfill_state_machine
step = Webhookdb::Replicator::StateMachineStep.new
if self.service_integration.backfill_secret.blank?
step.output = %(Great! We've created your #{self.resource_name_plural} integration.
#{self.resource_name_singular} webhooks are not designed to mirror data, so to fill your database,
we need to use the API to make requests, which requires your API Secret.
#{Webhookdb::Convertkit::FIND_API_SECRET_HELP}
)
return step.secret_prompt("API Secret").backfill_secret(self.service_integration)
end
unless (result = self.verify_backfill_credentials).verified
self.service_integration.replicator.clear_backfill_information
step.output = result.message
return step.secret_prompt("API Secret").backfill_secret(self.service_integration)
end
step.output = %(We'll start backfilling your #{self.resource_name_plural} now,
and they will show up in your database momentarily.
#{self._query_help_output}
)
return step.completed
end
|