1
0
Fork 0
discourse-custom-wizard-unl.../serializers/api/api_serializer.rb
2019-05-31 17:54:11 +10:00

19 Zeilen
465 B
Ruby

class CustomWizard::ApiSerializer < ApplicationSerializer
attributes :service,
:authorization,
:endpoints
def authorization
CustomWizard::Api::AuthorizationSerializer.new(
CustomWizard::Api::Authorization.get(object.service),
root: false
)
end
def endpoints
ActiveModel::ArraySerializer.new(
CustomWizard::Api::Endpoint.list,
each_serializer: CustomWizard::Api::EndpointSerializer
)
end
end