class Gitomator::Service::Hosting
Public Class Methods
Gitomator::BaseService::new
# File lib/gitomator/service/hosting.rb, line 9 def initialize(provider, opts = {}) super(provider, opts) @name_resolver = Gitomator::Util::Repo::NameResolver.new( provider.respond_to?(:namespace) ? provider.namespace : nil) end
Public Instance Methods
# File lib/gitomator/service/hosting.rb, line 179 def close_pull_request(dst_repo, id) service_call(__callee__, dst_repo, id) end
——————- CRUD operations on pull-requests —————–
We assume that pull-requests have id's, and that id's are unique within a repo. That is, the pair (dest_repo, id) uniquely identifies a pull-request.
# File lib/gitomator/service/hosting.rb, line 157 def create_pull_request(src, dst, opts = {}) service_call(__callee__, src, dst, opts) end
———————– CRUD operations on repos ———————–
# File lib/gitomator/service/hosting.rb, line 31 def create_repo(name, opts={}) service_call(__callee__, name, opts) end
———————– CRUD operations on teams ———————
# File lib/gitomator/service/hosting.rb, line 53 def create_team(name, opts={}) service_call(__callee__, name, opts) end
@param team_name [String] @param user_name [String] @param role [String]
# File lib/gitomator/service/hosting.rb, line 87 def create_team_membership(team_name, user_name, role=nil) # The if/else block is here so that different providers can implement # the `create_team_membership` with a default value for the role argument. if role.nil? service_call(__callee__, team_name, user_name) else service_call(__callee__, team_name, user_name, role) end end
# File lib/gitomator/service/hosting.rb, line 197 def delete_pull_request(dst_repo, id) service_call(__callee__, dst_repo, id) end
# File lib/gitomator/service/hosting.rb, line 43 def delete_repo(name) service_call(__callee__, name) end
# File lib/gitomator/service/hosting.rb, line 65 def delete_team(name) service_call(__callee__, name) end
@param team_name [String] @param user_name [String]
# File lib/gitomator/service/hosting.rb, line 121 def delete_team_membership(team_name, user_name) service_call(__callee__, team_name, user_name) end
Pull-request update methods:
# File lib/gitomator/service/hosting.rb, line 175 def merge_pull_request(dst_repo, id, message='') service_call(__callee__, dst_repo, id, message) end
# File lib/gitomator/service/hosting.rb, line 183 def open_pull_request(dst_repo, id) service_call(__callee__, dst_repo, id) end
# File lib/gitomator/service/hosting.rb, line 163 def read_pull_request(dst_repo, id) service_call(__callee__, dst_repo, id) end
# File lib/gitomator/service/hosting.rb, line 167 def read_pull_requests(dst_repo, opts = {}) service_call(__callee__, dst_repo, opts) end
# File lib/gitomator/service/hosting.rb, line 35 def read_repo(name) service_call(__callee__, name) end
# File lib/gitomator/service/hosting.rb, line 57 def read_team(name) service_call(__callee__, name) end
@param team_name [String] @param user_name [String]
@return [String] The current role of `user_name` in `team_name`, or nil (if the user is not a member of the team)
# File lib/gitomator/service/hosting.rb, line 104 def read_team_membership(team_name, user_name) service_call(__callee__, team_name, user_name) end
# File lib/gitomator/service/hosting.rb, line 25 def resolve_branch(name) @name_resolver.branch(name) end
—————————- Name resolution —————————
# File lib/gitomator/service/hosting.rb, line 17 def resolve_namespace(name) @name_resolver.namespace(name) end
# File lib/gitomator/service/hosting.rb, line 21 def resolve_repo_name(name) @name_resolver.name_only(name) end
# File lib/gitomator/service/hosting.rb, line 47 def search_repos(query, opts={}) service_call(__callee__, query, opts) end
# File lib/gitomator/service/hosting.rb, line 69 def search_teams(query, opts={}) service_call(__callee__, query, opts) end
# File lib/gitomator/service/hosting.rb, line 75 def search_users(query, opts={}) service_call(__callee__, query, opts) end
@param user (String) username @param team (String) Team name @param permission (Symbol) Either :read or :write or nil
# File lib/gitomator/service/hosting.rb, line 141 def set_team_permission(team, repo, permission) service_call(__callee__, team, repo, permission) end
@param user (String) username @param repo (String) Repo name (full name, or repo-only) @param permission (Symbol) Either :read or :write or nil
# File lib/gitomator/service/hosting.rb, line 132 def set_user_permission(user, repo, permission) service_call(__callee__, user, repo, permission) end
A “general-purpose” update method for pull-requests.
# File lib/gitomator/service/hosting.rb, line 191 def update_pull_request(dst_repo, id, opts) service_call(__callee__, dst_repo, id) end
# File lib/gitomator/service/hosting.rb, line 39 def update_repo(name, opts={}) service_call(__callee__, name, opts) end
# File lib/gitomator/service/hosting.rb, line 61 def update_team(name, opts={}) service_call(__callee__, name, opts) end
@param team_name [String] @param user_name [String] @param role [String]
# File lib/gitomator/service/hosting.rb, line 113 def update_team_membership(team_name, user_name, role) service_call(__callee__, team_name, user_name, role) end