class Gitomator::Service::Hosting

Public Class Methods

new(provider, opts = {}) click to toggle source
Calls superclass method 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

close_pull_request(dst_repo, id) click to toggle source
# File lib/gitomator/service/hosting.rb, line 179
def close_pull_request(dst_repo, id)
  service_call(__callee__, dst_repo, id)
end
create_pull_request(src, dst, opts = {}) click to toggle source

——————- 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
create_repo(name, opts={}) click to toggle source

———————– CRUD operations on repos ———————–

# File lib/gitomator/service/hosting.rb, line 31
def create_repo(name, opts={})
  service_call(__callee__, name, opts)
end
create_team(name, opts={}) click to toggle source

———————– CRUD operations on teams ———————

# File lib/gitomator/service/hosting.rb, line 53
def create_team(name, opts={})
  service_call(__callee__, name, opts)
end
create_team_membership(team_name, user_name, role=nil) click to toggle source

@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
delete_pull_request(dst_repo, id) click to toggle source
# File lib/gitomator/service/hosting.rb, line 197
def delete_pull_request(dst_repo, id)
  service_call(__callee__, dst_repo, id)
end
delete_repo(name) click to toggle source
# File lib/gitomator/service/hosting.rb, line 43
def delete_repo(name)
  service_call(__callee__, name)
end
delete_team(name) click to toggle source
# File lib/gitomator/service/hosting.rb, line 65
def delete_team(name)
  service_call(__callee__, name)
end
delete_team_membership(team_name, user_name) click to toggle source

@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
merge_pull_request(dst_repo, id, message='') click to toggle source

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
open_pull_request(dst_repo, id) click to toggle source
# File lib/gitomator/service/hosting.rb, line 183
def open_pull_request(dst_repo, id)
  service_call(__callee__, dst_repo, id)
end
read_pull_request(dst_repo, id) click to toggle source
# File lib/gitomator/service/hosting.rb, line 163
def read_pull_request(dst_repo, id)
  service_call(__callee__, dst_repo, id)
end
read_pull_requests(dst_repo, opts = {}) click to toggle source
# File lib/gitomator/service/hosting.rb, line 167
def read_pull_requests(dst_repo, opts = {})
  service_call(__callee__, dst_repo, opts)
end
read_repo(name) click to toggle source
# File lib/gitomator/service/hosting.rb, line 35
def read_repo(name)
  service_call(__callee__, name)
end
read_team(name) click to toggle source
# File lib/gitomator/service/hosting.rb, line 57
def read_team(name)
  service_call(__callee__, name)
end
read_team_membership(team_name, user_name) click to toggle source

@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
resolve_branch(name) click to toggle source
# File lib/gitomator/service/hosting.rb, line 25
def resolve_branch(name)
  @name_resolver.branch(name)
end
resolve_namespace(name) click to toggle source

—————————- Name resolution —————————

# File lib/gitomator/service/hosting.rb, line 17
def resolve_namespace(name)
  @name_resolver.namespace(name)
end
resolve_repo_name(name) click to toggle source
# File lib/gitomator/service/hosting.rb, line 21
def resolve_repo_name(name)
  @name_resolver.name_only(name)
end
search_repos(query, opts={}) click to toggle source
# File lib/gitomator/service/hosting.rb, line 47
def search_repos(query, opts={})
  service_call(__callee__, query, opts)
end
search_teams(query, opts={}) click to toggle source
# File lib/gitomator/service/hosting.rb, line 69
def search_teams(query, opts={})
  service_call(__callee__, query, opts)
end
search_users(query, opts={}) click to toggle source

# File lib/gitomator/service/hosting.rb, line 75
def search_users(query, opts={})
  service_call(__callee__, query, opts)
end
set_team_permission(team, repo, permission) click to toggle source

@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
set_user_permission(user, repo, permission) click to toggle source

@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
update_pull_request(dst_repo, id, opts) click to toggle source

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
update_repo(name, opts={}) click to toggle source
# File lib/gitomator/service/hosting.rb, line 39
def update_repo(name, opts={})
  service_call(__callee__, name, opts)
end
update_team(name, opts={}) click to toggle source
# File lib/gitomator/service/hosting.rb, line 61
def update_team(name, opts={})
  service_call(__callee__, name, opts)
end
update_team_membership(team_name, user_name, role) click to toggle source

@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