Class: Webhookdb::Replicator::SponsyV1Mixin::PublicationChildBackfiller

Inherits:
Backfiller
  • Object
show all
Includes:
Backfiller::Bulk
Defined in:
lib/webhookdb/replicator/sponsy_v1_mixin.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Backfiller::Bulk

#dry_run?, #flush_pending_inserts, #handle_item, #pending_inserts, #remote_key_column_name

Methods inherited from Backfiller

#_fetch_backfill_page_with_retry, #backfill, do_retry_wait, #handle_item, #max_backfill_retry_attempts, #wait_for_retry_attempt

Constructor Details

#initialize(service:, publication_id:, tail:) ⇒ PublicationChildBackfiller

Returns a new instance of PublicationChildBackfiller.



143
144
145
146
147
148
149
# File 'lib/webhookdb/replicator/sponsy_v1_mixin.rb', line 143

def initialize(service:, publication_id:, tail:)
  @service = service
  @upserting_replicator = @service
  @publication_id = publication_id
  @tail = tail
  super()
end

Instance Attribute Details

#upserting_replicatorObject (readonly)

Returns the value of attribute upserting_replicator.



141
142
143
# File 'lib/webhookdb/replicator/sponsy_v1_mixin.rb', line 141

def upserting_replicator
  @upserting_replicator
end

Instance Method Details

#conditional_upsert?Boolean

Returns:

  • (Boolean)


152
# File 'lib/webhookdb/replicator/sponsy_v1_mixin.rb', line 152

def conditional_upsert? = true

#fetch_backfill_page(pagination_token, last_backfilled:) ⇒ Object



159
160
161
162
163
# File 'lib/webhookdb/replicator/sponsy_v1_mixin.rb', line 159

def fetch_backfill_page(pagination_token, last_backfilled:)
  return @service.fetch_sponsy_page(
    "/v1/publications/#{@publication_id}#{@tail}", pagination_token, last_backfilled,
  )
end

#prepare_body(body) ⇒ Object



154
155
156
157
# File 'lib/webhookdb/replicator/sponsy_v1_mixin.rb', line 154

def prepare_body(body)
  body["publication_id"] = @publication_id
  body
end

#upsert_page_sizeObject



151
# File 'lib/webhookdb/replicator/sponsy_v1_mixin.rb', line 151

def upsert_page_size = 500