Class: Webhookdb::Replicator::SponsyCustomerV1::Backfiller
- Inherits:
-
Backfiller
- Object
- Backfiller
- Webhookdb::Replicator::SponsyCustomerV1::Backfiller
- Defined in:
- lib/webhookdb/replicator/sponsy_customer_v1.rb
Instance Method Summary collapse
- #fetch_backfill_page(_pagination_token, last_backfilled:) ⇒ Object
- #handle_item(body) ⇒ Object
-
#initialize(service:) ⇒ Backfiller
constructor
A new instance of Backfiller.
Methods inherited from Backfiller
#_fetch_backfill_page_with_retry, #backfill, do_retry_wait, #max_backfill_retry_attempts, #wait_for_retry_attempt
Constructor Details
#initialize(service:) ⇒ Backfiller
Returns a new instance of Backfiller.
36 37 38 39 40 |
# File 'lib/webhookdb/replicator/sponsy_customer_v1.rb', line 36 def initialize(service:) @service = service @slot_service = service.service_integration.depends_on.replicator super() end |
Instance Method Details
#fetch_backfill_page(_pagination_token, last_backfilled:) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/webhookdb/replicator/sponsy_customer_v1.rb', line 46 def fetch_backfill_page(_pagination_token, last_backfilled:) customers = @slot_service.admin_dataset do |ds| (ds = ds.where { updated_at > last_backfilled }) if last_backfilled ds.select_map(Sequel.pg_json(:data)["customer"].as(:customer)) end return customers, nil end |
#handle_item(body) ⇒ Object
42 43 44 |
# File 'lib/webhookdb/replicator/sponsy_customer_v1.rb', line 42 def handle_item(body) @service.upsert_webhook_body(body) end |