Class: Retailer::WalmartItemIdDiscovery::Result

Inherits:
Data
  • Object
show all
Defined in:
app/services/retailer/walmart_item_id_discovery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#already_setObject (readonly)

Returns the value of attribute already_set

Returns:

  • (Object)

    the current value of already_set



36
37
38
# File 'app/services/retailer/walmart_item_id_discovery.rb', line 36

def already_set
  @already_set
end

#conflictsObject (readonly)

Returns the value of attribute conflicts

Returns:

  • (Object)

    the current value of conflicts



36
37
38
# File 'app/services/retailer/walmart_item_id_discovery.rb', line 36

def conflicts
  @conflicts
end

#dry_runObject (readonly)

Returns the value of attribute dry_run

Returns:

  • (Object)

    the current value of dry_run



36
37
38
# File 'app/services/retailer/walmart_item_id_discovery.rb', line 36

def dry_run
  @dry_run
end

#unlistedObject (readonly)

Returns the value of attribute unlisted

Returns:

  • (Object)

    the current value of unlisted



36
37
38
# File 'app/services/retailer/walmart_item_id_discovery.rb', line 36

def unlisted
  @unlisted
end

#updatedObject (readonly)

Returns the value of attribute updated

Returns:

  • (Object)

    the current value of updated



36
37
38
# File 'app/services/retailer/walmart_item_id_discovery.rb', line 36

def updated
  @updated
end

Instance Method Details

#reportObject



37
38
39
40
41
42
43
44
45
# File 'app/services/retailer/walmart_item_id_discovery.rb', line 37

def report
  lines = ["#{'[DRY RUN] ' if dry_run}Walmart item ids: #{updated.size} to set, " \
           "#{already_set} already set, #{unlisted.size} not listed by Walmart, #{conflicts.size} UPC conflicts"]
  lines << "\nNot listed by Walmart (listing problem, not a URL problem):" if unlisted.any?
  unlisted.sort.each { |sku| lines << "  #{sku}" }
  lines << "\nUPC CONFLICTS — not written, investigate:" if conflicts.any?
  conflicts.each { |c| lines << "  #{c[:sku]}: ours=#{c[:ours]} walmart=#{c[:theirs]}" }
  lines.join("\n")
end