travis.ex
travis.ex copied to clipboard
Simple Elixir wrapper for the Travis API
travis.ex
Simple Elixir wrapper for the Travis API.
Quickstart
First, add travis to your mix.exs dependencies:
def deps do
[{:travis, "~> 0.0.1"}]
end
Ensure that travis is added as an application in your mix.exs:
def application do
[applications: [:travis]]
end
Fetching dependencies and running on elixir console:
mix deps.get
iex -S mix
Examples
Every call to Travis needs a client. It can optionally have a travis token associated with it, which is necessary for private repositories. If you don't provide one a client is created. Below are some examples:
Describe a public repo
iex> Travis.Repos.show("elixir-lang", "elixir")
%{"repo" => %{...}}
Describe a private repo
iex> client = Travis.Client.new(token)
%Travis.Client{endpoint: "https://api.travis-ci.com/",
token: "..."}
iex> Travis.Repos.show("kddeisz", "travis.ex", client)
%{"repo" => %{...}}
List builds for a repo
iex> Travis.Repos.Builds.list("elixir-lang", "elixir")
%{"builds" => [...]}
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/kddeisz/travis.ex.
License
The code is available as open source under the terms of the MIT License.