Skip to content

Commit

Permalink
Fix typespecs spotted by dialyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
edgurgel committed Jul 19, 2014
1 parent 466bd91 commit 00ba574
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/poxa/authorization_helper.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Poxa.AuthorizationHelper do
alias Poxa.Authentication

@spec is_authorized(:cowboy.req, any) :: {true, :cowboy.req, any} | {{false, binary}, :cowboy.req, nil}
@spec is_authorized(:cowboy_req.req, any) :: {true, :cowboy_req.req, any} | {{false, binary}, :cowboy_req.req, nil}
def is_authorized(req, state) do
{:ok, body, req} = :cowboy_req.body(req)
{method, req} = :cowboy_req.method(req)
Expand Down
1 change: 1 addition & 0 deletions lib/poxa/presence_subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ defmodule Poxa.PresenceSubscription do
More info at: http://pusher.com/docs/client_api_guide/client_presence_channels
"""
@type user_id :: integer | binary # Maybe a json_term too?
@type user_info :: :jsx.json_term # Not sure

alias Poxa.PusherEvent
alias Poxa.Subscription
Expand Down
4 changes: 3 additions & 1 deletion lib/poxa/pusher_event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ defmodule Poxa.PusherEvent do
Take a look at http://pusher.com/docs/pusher_protocol#events for more info
"""

alias Poxa.PresenceSubscription

def valid?(event) do
Enum.all?(["name", "data"], &Dict.has_key?(event, &1))
end
Expand Down Expand Up @@ -152,7 +154,7 @@ defmodule Poxa.PusherEvent do
{%{"socket_id" => "to_exclude123"},["a-channel"],"to_exclude123"}
"""
@spec parse_channels(Map.t) :: {:jsx.json_term,
@spec parse_channels(map) :: {:jsx.json_term,
[binary] | :undefined,
:undefined | binary}
def parse_channels(message) do
Expand Down
5 changes: 3 additions & 2 deletions lib/poxa/subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ defmodule Poxa.Subscription do
Returns :ok to public and private channels and
{:presence, channel, channel_data} to presence channel
"""
@spec subscribe!(:jsx.json_term, binary) :: :ok | {:presence, binary, {PresenceSubscription.user_id,
:jsx.json_term}} | :error
@spec subscribe!(:jsx.json_term, binary) :: {:ok, binary}
| {:presence, binary, {PresenceSubscription.user_id, :jsx.json_term}}
| :error
def subscribe!(data, socket_id) do
channel = data["channel"]
case channel do
Expand Down

0 comments on commit 00ba574

Please sign in to comment.