Class: Webhookdb::Replicator::ConvertkitBroadcastV1
- Inherits:
-
Base
- Object
- Base
- Webhookdb::Replicator::ConvertkitBroadcastV1
show all
- Includes:
- Appydays::Loggable, ConvertkitV1Mixin
- Defined in:
- lib/webhookdb/replicator/convertkit_broadcast_v1.rb
Constant Summary
Webhookdb::Replicator::ConvertkitV1Mixin::CONV_FIND_CANCELED_AT
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
Constants inherited
from Base
Base::MAX_INDEX_NAME_LENGTH
Instance Attribute Summary
Attributes inherited from Base
#service_integration
Class Method Summary
collapse
Instance Method Summary
collapse
#_remote_key_column, #_verify_backfill_401_err_msg, #_verify_backfill_err_msg, #_webhook_response, #backfiller_server_error_backoff, #backfiller_server_error_retries, #calculate_backfill_state_machine
Methods inherited from Base
#_any_subscriptions_to_notify?, #_backfill_state_change_fields, #_backfillers, #_clear_backfill_information, #_clear_webook_information, #_coalesce_excluded_on_update, #_enqueue_backfill_jobs, #_extra_index_specs, #_find_dependency_candidate, #_notify_dependents, #_parallel_backfill, #_prepare_for_insert, #_publish_rowupsert, #_remote_key_column, #_resource_to_data, #_to_json, #_upsert_update_expr, #_upsert_webhook, #_verify_backfill_err_msg, #_webhook_response, #_webhook_state_change_fields, #admin_dataset, #backfill, #backfill_not_supported_message, #calculate_and_backfill_state_machine, #calculate_backfill_state_machine, #calculate_dependency_state_machine_step, #calculate_preferred_create_state_machine, #calculate_webhook_state_machine, chunked_row_update_bounds, #clear_backfill_information, #clear_webhook_information, #create_table, #create_table_modification, #data_column, #dbadapter_table, #denormalized_columns, #descriptor, #dispatch_request_to, #documentation_url, #enqueue_sync_targets, #enrichment_column, #ensure_all_columns, #ensure_all_columns_modification, #find_dependent, #find_dependent!, #indices, #initialize, #on_dependency_webhook_upsert, #preferred_create_state_machine_method, #preprocess_headers_for_logging, #primary_key_column, #process_state_change, #process_webhooks_synchronously?, #qualified_table_sequel_identifier, #readonly_dataset, #remote_key_column, #requires_sequence?, #resource_name_plural, #resource_name_singular, #schema_and_table_symbols, #storable_columns, #synchronous_processing_response_body, #timestamp_column, #upsert_has_deps?, #upsert_webhook, #upsert_webhook_body, #verify_backfill_credentials, #webhook_endpoint, #webhook_response
Class Method Details
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/webhookdb/replicator/convertkit_broadcast_v1.rb', line 12
def self.descriptor
return Webhookdb::Replicator::Descriptor.new(
name: "convertkit_broadcast_v1",
ctor: ->(sint) { Webhookdb::Replicator::ConvertkitBroadcastV1.new(sint) },
feature_roles: [],
resource_name_singular: "ConvertKit Broadcast",
supports_backfill: true,
api_docs_url: "https://developers.convertkit.com/#list-broadcasts",
)
end
|
Instance Method Details
#_denormalized_columns ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/webhookdb/replicator/convertkit_broadcast_v1.rb', line 23
def _denormalized_columns
return [
Webhookdb::Replicator::Column.new(:click_rate, DECIMAL, from_enrichment: true, optional: true),
Webhookdb::Replicator::Column.new(:created_at, TIMESTAMP, index: true),
Webhookdb::Replicator::Column.new(:open_rate, DECIMAL, from_enrichment: true, optional: true),
Webhookdb::Replicator::Column.new(:progress, DECIMAL, from_enrichment: true, optional: true),
Webhookdb::Replicator::Column.new(:recipients, INTEGER, from_enrichment: true, optional: true),
Webhookdb::Replicator::Column.new(:show_total_clicks, BOOLEAN, from_enrichment: true, optional: true),
Webhookdb::Replicator::Column.new(:status, TEXT, from_enrichment: true, optional: true),
Webhookdb::Replicator::Column.new(:subject, TEXT),
Webhookdb::Replicator::Column.new(:total_clicks, INTEGER, from_enrichment: true, optional: true),
Webhookdb::Replicator::Column.new(:unsubscribes, INTEGER, from_enrichment: true, optional: true),
]
end
|
#_fetch_backfill_page(_pagination_token, **_kwargs) ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/webhookdb/replicator/convertkit_broadcast_v1.rb', line 62
def _fetch_backfill_page(, **_kwargs)
url = "https://api.convertkit.com/v3/broadcasts?api_secret=#{self.service_integration.backfill_secret}"
response = Webhookdb::Http.get(url, logger: self.logger, timeout: Webhookdb::Convertkit.http_timeout)
data = response.parsed_response
return data["broadcasts"], nil
end
|
#_fetch_enrichment(resource, _event, _request) ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/webhookdb/replicator/convertkit_broadcast_v1.rb', line 54
def _fetch_enrichment(resource, _event, _request)
broadcast_id = resource.fetch("id")
url = "https://api.convertkit.com/v3/broadcasts/#{broadcast_id}/stats?api_secret=#{self.service_integration.backfill_secret}"
response = Webhookdb::Http.get(url, logger: self.logger, timeout: Webhookdb::Convertkit.http_timeout)
data = response.parsed_response
return data.dig("broadcast", "stats") || {}
end
|
#_resource_and_event(request) ⇒ Object
38
39
40
|
# File 'lib/webhookdb/replicator/convertkit_broadcast_v1.rb', line 38
def _resource_and_event(request)
return request.body, nil
end
|
#_store_enrichment_body? ⇒ Boolean
50
51
52
|
# File 'lib/webhookdb/replicator/convertkit_broadcast_v1.rb', line 50
def _store_enrichment_body?
return true
end
|
#_timestamp_column_name ⇒ Object
42
43
44
|
# File 'lib/webhookdb/replicator/convertkit_broadcast_v1.rb', line 42
def _timestamp_column_name
return :created_at
end
|
#_update_where_expr ⇒ Object
46
47
48
|
# File 'lib/webhookdb/replicator/convertkit_broadcast_v1.rb', line 46
def _update_where_expr
return self.qualified_table_sequel_identifier[:data] !~ Sequel[:excluded][:data]
end
|