Skip to content

Commit

Permalink
add Consul.Event endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
reset committed Jan 21, 2015
1 parent 46d3206 commit 7b68527
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/consul/event.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# The MIT License (MIT)
#
# Copyright (c) 2014-2015 Undead Labs, LLC
#

defmodule Consul.Event do
alias Consul.Endpoint
use Consul.Endpoint, handler: Consul.Handler.Base

@event "event"
@fire "fire"
@list "list"

@spec list(Keyword.t) :: Endpoint.response
def list(opts \\ []) do
build_url([@event, @list], opts)
|> req_get()
end

@spec fire(binary, binary, Keyword.t) :: Endpoint.response
def fire(name, payload \\ "", opts \\ []) when is_binary(payload) do
build_url([@event, @fire, name], opts)
|> req_put(payload)
end
end

0 comments on commit 7b68527

Please sign in to comment.