lib/pupil/users.rb in pupil-0.2.2 vs lib/pupil/users.rb in pupil-0.3.0
- old
+ new
@@ -1,13 +1,18 @@
class Pupil
- def lookup param={}
- response = self.get("/users/lookup.json", param)
+ def user(target, option={})
+ response = self.get("/1/users/show.json", {guess_parameter(target) => target}.update(option))
+ return false unless response
+ user = User.new(response, @access_token)
+ return user
+ end
+
+ def search_user(keyword, option={})
+ response = self.get("/1/users/search.json", {:q => keyword}.update(option))
users = Array.new
response.each do |element|
- user = User.new element
+ user = User.new(element, @access_token)
users << user
end
return users
end
-
-
end
\ No newline at end of file