October 2014
Intermediate to advanced
280 pages
7h 20m
English
Add the dependency to your project and install it.
So, back to our problem. We have to write the function GithubIssues.fetch, which transforms a user name and project into a data structure containing that project’s issues. The HTTPoison page on GitHub gives us a clue,[21] and we write a new module, Issues.GithubIssues:
| project/1/issues/lib/issues/github_issues.ex | |
| | defmodule Issues.GithubIssues do |
| | @user_agent [ {"User-agent", "Elixir dave@pragprog.com"} ] |
| | |
| | def fetch(user, project) do |
| | issues_url(user, project) |
| | |> HTTPoison.get(@user_agent) |
| | |> handle_response |
| | end |
| | def issues_url(user, project) do |
| | "https://api.github.com/repos/#{user}/#{project}/issues" ... |
Read now
Unlock full access