mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
19 lines
419 B
Ruby
19 lines
419 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Api::AddressSerializer < ActiveModel::Serializer
|
|
# cached
|
|
# delegate :cache_key, to: :object
|
|
|
|
attributes :id, :zipcode, :city, :state_name, :state_id,
|
|
:phone, :firstname, :lastname, :address1, :address2, :city, :country_id,
|
|
:zipcode, :country_name
|
|
|
|
def country_name
|
|
object.country&.name
|
|
end
|
|
|
|
def state_name
|
|
object.state&.abbr
|
|
end
|
|
end
|