mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Simplify serialiser with delegate
This commit is contained in:
@@ -6,13 +6,8 @@ module Api
|
||||
# Searches for a ship and bill addresses for the customer
|
||||
# where they are not already explicitly set
|
||||
class SubscriptionCustomerSerializer < CustomerSerializer
|
||||
def bill_address
|
||||
finder.bill_address
|
||||
end
|
||||
|
||||
def ship_address
|
||||
finder.ship_address
|
||||
end
|
||||
delegate :bill_address, to: :finder
|
||||
delegate :ship_address, to: :finder
|
||||
|
||||
def finder
|
||||
@finder ||= OpenFoodNetwork::AddressFinder.new(object, object.email)
|
||||
|
||||
Reference in New Issue
Block a user