lib/github_api/users.rb in github_api-0.9.0 vs lib/github_api/users.rb in github_api-0.9.1
- old
+ new
@@ -45,14 +45,14 @@
#
# = Examples
# users = Github::Users.new
# users.list
#
- def list(params={})
- normalize! params
+ def list(*args)
+ arguments(args)
- response = get_request("/users", params)
+ response = get_request("/users", arguments.params)
return response unless block_given?
response.each { |el| yield el }
end
alias :all :list
@@ -67,12 +67,12 @@
# = Examples
# github = Github.new oauth_token: '...'
# github.users.get
#
def get(*args)
- params = args.extract_options!
- normalize! params
+ params = arguments(args).params
+
if user_name = params.delete('user')
get_request("/users/#{user_name}", params)
else
get_request("/user", params)
end
@@ -100,13 +100,14 @@
# "location" => "San Francisco",
# "hireable" => true,
# "bio" => "There once..."
#
def update(*args)
- params = args.extract_options!
- normalize! params
- filter! VALID_USER_PARAMS_NAMES, params
- patch_request("/user", params)
+ arguments(args) do
+ sift VALID_USER_PARAMS_NAMES
+ end
+
+ patch_request("/user", arguments.params)
end
end # Users
end # Github