Class: ListingIssues::BaseAdapter

Inherits:
Object
  • Object
show all
Defined in:
app/services/listing_issues/base_adapter.rb

Overview

Interface every provider adapter implements. An adapter knows (a) which
catalog items to reconcile this run and (b) the current set of listing
issues for a given item — both derived from that provider's own data, with
no external API calls (the marketplace pulls already persist the signals).

Instance Method Summary collapse

Instance Method Details

#candidate_item_idsArray<Integer>

catalog_item ids to reconcile: every item that currently shows a signal,
plus every item with an open issue already recorded for this provider (so
cleared issues get auto-resolved on the next run).

Returns:

  • (Array<Integer>)

Raises:

  • (NotImplementedError)


18
19
20
# File 'app/services/listing_issues/base_adapter.rb', line 18

def candidate_item_ids
  raise NotImplementedError
end

#eager_loadArray

Associations the bulk Sync should eager-load on each
candidate before calling #issues_for, to avoid N+1s. Default none;
providers override with whatever their checks touch.

Returns:

  • (Array)

    arguments suitable for ActiveRecord::Relation#includes



32
33
34
# File 'app/services/listing_issues/base_adapter.rb', line 32

def eager_load
  []
end

#issues_for(_catalog_item) ⇒ Array<ListingIssues::Issue>

Returns current issues for the item.

Parameters:

Returns:

Raises:

  • (NotImplementedError)


24
25
26
# File 'app/services/listing_issues/base_adapter.rb', line 24

def issues_for(_catalog_item)
  raise NotImplementedError
end

#providerString

Returns provider key stored on ListingIssue#provider.

Returns:

  • (String)

    provider key stored on ListingIssue#provider

Raises:

  • (NotImplementedError)


10
11
12
# File 'app/services/listing_issues/base_adapter.rb', line 10

def provider
  raise NotImplementedError
end