Created
September 6, 2014 23:00
-
-
Save j-mcnally/403812350dd02623857e to your computer and use it in GitHub Desktop.
GithubOrg serializer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Koncur.Api.V1.OrganizationController do | |
use Phoenix.Controller | |
alias OAuth2Ex.Provider.Github, as: Github | |
plug Koncur.AuthenticationPlug | |
plug Koncur.GithubClientPlug | |
def index(conn, _params) do | |
github_token = conn.assigns[:github_token] | |
orgs = Github.organizations(github_token) | |
orgs = for o <- orgs do | |
%{ | |
id: o["id"], | |
name: o["login"] | |
} | |
end | |
IO.inspect orgs | |
json conn, JSON.encode!(%{organizations: orgs}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment