class Forward::API::User

Public Class Methods

authenticate(email, password, &block) click to toggle source
# File lib/forward/api/user.rb, line 5
def self.authenticate(email, password, &block)
  resource = new
  options  = {
    path: "#{API.base_path}/user/token",
    params: { email: email, password: password }
  }

  resource.post(options) do |response, status|
    if status != 200
      exit_with_error "Unable to authenticate `#{email}' on forwardhq.com"
    else
      block.call(response[:subdomain], response[:token])
    end
  end
end