lib/freeagent_api.rb in freeagent_api-0.2.0 vs lib/freeagent_api.rb in freeagent_api-0.3.0

- old
+ new

@@ -1,7 +1,7 @@ require 'rubygems' -require 'activeresource' +require 'active_resource' module Freeagent class << self def authenticate(options) @@ -109,7 +109,20 @@ when :one then find_one(options) else find_single(scope, options) end end end - + + # Users + + class User < Base + self.prefix = '/company/' + def self.find_by_email(email) + users = User.find :all + users.each do |u| + u.email == email ? (return u) : next + end + raise Error, "No user matches that email!" + end + end + end \ No newline at end of file