mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
This class was originally built to flexibly accept paramters in any order. It also allowed you to specify multiple of the same type of parameter, with the later one overriding the earlier. This is too flexible and likely to cause mistakes. And besides, we don't use that feature!
18 lines
491 B
Ruby
18 lines
491 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Api
|
|
module Admin
|
|
# Used by admin subscription form
|
|
# Searches for a ship and bill addresses for the customer
|
|
# where they are not already explicitly set
|
|
class SubscriptionCustomerSerializer < CustomerSerializer
|
|
delegate :bill_address, to: :finder
|
|
delegate :ship_address, to: :finder
|
|
|
|
def finder
|
|
@finder ||= OpenFoodNetwork::AddressFinder.new(customer: object, email: object.email)
|
|
end
|
|
end
|
|
end
|
|
end
|