lib/github_api/repos/watching.rb in github_api-0.6.0 vs lib/github_api/repos/watching.rb in github_api-0.6.1
- old
+ new
@@ -11,11 +11,11 @@
# github.repos.watching.watchers { |watcher| ... }
#
def watchers(user_name, repo_name, params={})
_update_user_repo_params(user_name, repo_name)
_validate_user_repo_params(user, repo) unless user? && repo?
- _normalize_params_keys(params)
+ normalize! params
response = get_request("/repos/#{user}/#{repo}/watchers", params)
return response unless block_given?
response.each { |el| yield el }
end
@@ -32,11 +32,11 @@
# github = Github.new :oauth_token => '...'
# github.repos.watching.watched
#
def watched(*args)
params = args.extract_options!
- _normalize_params_keys(params)
+ normalize! params
_merge_user_into_params!(params) unless params.has_key?('user')
response = if (user_name = params.delete('user'))
get_request("/users/#{user_name}/watched", params)
else
@@ -53,11 +53,11 @@
# github = Github.new
# github.repos.watching.watching? 'user-name', 'repo-name'
#
def watching?(user_name, repo_name, params={})
_validate_presence_of user_name, repo_name
- _normalize_params_keys(params)
+ normalize! params
get_request("/user/watched/#{user_name}/#{repo_name}", params)
true
rescue Github::Error::NotFound
false
end
@@ -70,11 +70,11 @@
# github = Github.new
# github.repos.watching.start_watching 'user-name', 'repo-name'
#
def start_watching(user_name, repo_name, params={})
_validate_presence_of user_name, repo_name
- _normalize_params_keys(params)
+ normalize! params
put_request("/user/watched/#{user_name}/#{repo_name}", params)
end
# Stop watching a repository
#
@@ -83,10 +83,10 @@
# github = Github.new
# github.repos.watching.start_watching 'user-name', 'repo-name'
#
def stop_watching(user_name, repo_name, params={})
_validate_presence_of user_name, repo_name
- _normalize_params_keys(params)
+ normalize! params
delete_request("/user/watched/#{user_name}/#{repo_name}", params)
end
end # Repos::Watching
end # Github