Skip to content

Instantly share code, notes, and snippets.

@olivermt
Created August 28, 2015 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olivermt/ccea618ca92d5224343c to your computer and use it in GitHub Desktop.
Save olivermt/ccea618ca92d5224343c to your computer and use it in GitHub Desktop.
defmodule Core.OpensipsClusterView do
use Core.Web, :view
def render("index.json", %{opensips_clusters: opensips_clusters}) do
%{data: render_many(opensips_clusters, Core.OpensipsClusterView, "opensips_cluster.json")}
end
def render("show.json", %{opensips_cluster: opensips_cluster}) do
%{data: render_one(opensips_cluster, Core.OpensipsClusterView, "opensips_cluster.json")}
end
def render("opensips_cluster.json", %{opensips_cluster: opensips_cluster}) do
%{id: opensips_cluster.id
name: opensips_cluster.name
description: opensips_cluster.description
controller_url: opensips_cluster.controller_url
proxy_url: opensips_cluster.proxy_url}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment