mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
23 lines
524 B
Ruby
23 lines
524 B
Ruby
class Api::Admin::CustomerSerializer < ActiveModel::Serializer
|
|
attributes :id, :email, :enterprise_id, :user_id, :code, :tags, :tag_list, :name, :bill_address, :ship_address
|
|
|
|
def tag_list
|
|
object.tag_list.join(",")
|
|
end
|
|
|
|
def tags
|
|
object.tag_list.map do |tag|
|
|
tag_rule_map = options[:tag_rule_mapping][tag]
|
|
tag_rule_map || { text: tag, rules: nil }
|
|
end
|
|
end
|
|
|
|
def ship_address
|
|
object.ship_address.andand.address1
|
|
end
|
|
|
|
def bill_address
|
|
object.bill_address.andand.address1
|
|
end
|
|
end
|