Sha256: 7ae1923223a070433b2639db748df7b8541a938d56f63b54c0035d2165f23acf
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module Heft class Users require File.join '.', 'adapters', 'internet' class << self def add(opts={}) reply = add_core opts fail "Failed => #{reply.body}" if reply.code > 299 end def delete(email) reply = hoist.delete :uri => "https://auth.hoi.io/user/#{URI.escape(email)}" fail "Failed to delete user. #{reply}" if reply.code > 299 end def contain?(email) reply = add_core :email => email, :password => "******" json = JSON.parse reply.body error_message = json['message'] reply.code === 400 and error_message.match /already a user with that email address/ end private def hoist Heft::Internal::HoistConnection.new :internet => internet, :api_key => ENV['APIKEY'] end def internet; Adapters::Internet.new; end def add_core(opts={}) hoist.post( :uri => 'https://auth.hoi.io/user', :body => opts ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
heft-0.0.2 | lib/heft/users.rb |