Octokit v0.1.0 Octokit.Parser
Functions to parse GitHub API responses into structs.
Summary
Types
List of fields to copy from the parsed data
Functions
Parses the information, copying the named fields into a struct
Types
field_list :: [atom, ...]
List of fields to copy from the parsed data.
Functions
Specs
parse(String.t | Map.t, field_list, struct) :: struct
Parses the information, copying the named fields into a struct.
It can parse either JSON or a Map
.
Examples
Parsing a JSON object
iex> foo = Octokit.Parser.parse("{\"test\": 1}", [:test], %Octokit.Repository{})
iex> foo.test
1
Parsing an equivalent Map
iex> foo = Octokit.Parser.parse(%{"test" => 1}, [:test], %Octokit.Repository{})
iex> foo.test
1