Sha256: a4e2eb812587495a15192beaeda1d7fa6282574126a3f7a442d23c206cbffbef
Contents?: true
Size: 840 Bytes
Versions: 5
Compression:
Stored size: 840 Bytes
Contents
module Grendel class UserManager def initialize(client) @client = client end # return all Grendel users as Grendel::User objects def list response = @client.get("/users") response["users"].map {|u| User.new(@client, u) } end # retrieve a user, optionally setting the password def find(id, password = nil) response = @client.get("/users/#{id}") # need to escape this user = User.new(@client, response) user.password = password return user end # create a new user def create(id, password) params = {:id => id, :password => password} response = @client.post("/users", params) # TODO: strip protocol and host from uri User.new(@client, params.merge(:uri => response.headers['location'].first)) end end end
Version data entries
5 entries across 5 versions & 1 rubygems