Skip to content

Instantly share code, notes, and snippets.

@adkron
Created September 13, 2017 14:52
Show Gist options
  • Save adkron/3d658f6f17b1e2313fcd55f5210bba50 to your computer and use it in GitHub Desktop.
Save adkron/3d658f6f17b1e2313fcd55f5210bba50 to your computer and use it in GitHub Desktop.
defmodule Zipato.Sessions.Hub.Impl do
alias Zipato.Sessions.Behaviour
use Behaviour
@moduledoc """
Implementation for hub session
See `Zipato.Sessions.Hub` for more information.
"""
alias Zipato.Commands.{Authentication}
@doc """
Connects a hub session
"""
@impl Behaviour
def connect(%{serial: serial} = state, config) do
{:ok, session_id} = Authentication.connect_box_session(serial, config.credentials, config.api)
%{state | id: session_id}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment