rename qwaiter to mozo
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
module Mozo::SupplierBaseSerializer
|
||||
extend ActiveSupport::Concern
|
||||
include JSONAPI::Serializer
|
||||
included do
|
||||
class_attribute :related_link_for_attributes
|
||||
timestamp_attribute :created_at
|
||||
timestamp_attribute :updated_at
|
||||
end
|
||||
|
||||
def base_url
|
||||
"/supplier/api/v1" # no api here, should be, but result from refacoring in steps, future update
|
||||
end
|
||||
|
||||
#def format_name(attribute_name)
|
||||
# attribute_name.to_s.dasherize
|
||||
#end
|
||||
|
||||
#def unformat_name(attribute_name)
|
||||
# attribute_name.to_s.underscore
|
||||
#end
|
||||
|
||||
#alias_method :default_relationship_related_link, :relationship_related_link
|
||||
def relationship_related_link(attribute_name)
|
||||
return super if related_link_for_attributes.include?(attribute_name)
|
||||
nil
|
||||
end
|
||||
|
||||
|
||||
def relationship_self_link(attribute_name)
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def attributes(*attrs)
|
||||
attrs.each do |attr|
|
||||
attribute attr
|
||||
end
|
||||
end
|
||||
|
||||
def timestamp_attribute(attr)
|
||||
attribute attr do
|
||||
object.public_send(attr).try(:iso8601)
|
||||
end
|
||||
end
|
||||
|
||||
def related_link_for(*attributes)
|
||||
self.related_link_for_attributes = attributes
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user