Files
openfoodnetwork/app/serializers/api/admin/subscription_customer_serializer.rb
2020-10-30 16:14:34 +00:00

18 lines
474 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(object, object.email)
end
end
end
end