Class: Webhookdb::Replicator::EmailOctopusContactV1::ContactBackfiller
Instance Method Summary
collapse
#conditional_upsert?, #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(contact_svc:, list_id:, api_key:) ⇒ ContactBackfiller
Returns a new instance of ContactBackfiller.
131
132
133
134
135
136
|
# File 'lib/webhookdb/replicator/email_octopus_contact_v1.rb', line 131
def initialize(contact_svc:, list_id:, api_key:)
@contact_svc = contact_svc
@list_id = list_id
@api_key = api_key
super()
end
|
Instance Method Details
#fetch_backfill_page(pagination_token, **_kwargs) ⇒ Object
145
146
147
148
149
150
151
152
153
154
155
156
157
|
# File 'lib/webhookdb/replicator/email_octopus_contact_v1.rb', line 145
def fetch_backfill_page(, **_kwargs)
limit = Webhookdb::EmailOctopus.page_size
base_url = "https://emailoctopus.com"
endpoint_path = || "/api/1.6/lists/#{@list_id}/contacts?api_key=#{@api_key}&limit=#{limit}"
response = Webhookdb::Http.get(
base_url + endpoint_path,
logger: @contact_svc.logger,
timeout: Webhookdb::EmailOctopus.http_timeout,
)
data = response.parsed_response
next_page_link = data.dig("paging", "next")
return data["data"], next_page_link
end
|
#prepare_body(body) ⇒ Object
141
142
143
|
# File 'lib/webhookdb/replicator/email_octopus_contact_v1.rb', line 141
def prepare_body(body)
body["list_id"] = @list_id
end
|
#upsert_page_size ⇒ Object
139
|
# File 'lib/webhookdb/replicator/email_octopus_contact_v1.rb', line 139
def upsert_page_size = 500
|
#upserting_replicator ⇒ Object
138
|
# File 'lib/webhookdb/replicator/email_octopus_contact_v1.rb', line 138
def upserting_replicator = @contact_svc
|