class Gitomator::GitHub::Model::HostedRepo

Public Class Methods

default_protocol() click to toggle source
# File lib/gitomator/github/model/hosted_repo.rb, line 8
def self.default_protocol
  @@default_protocol
end
default_protocol=(protocol) click to toggle source
# File lib/gitomator/github/model/hosted_repo.rb, line 12
def self.default_protocol=protocol
  protocol = protocol.to_sym
  raise "Invalid protocol #{protocol}" unless [:https, :ssh].include? protocol
  @@default_protocol = protocol
end
new(gh_repo) click to toggle source

@param gh_repo [Sawyer::Resource]

# File lib/gitomator/github/model/hosted_repo.rb, line 25
def initialize(gh_repo)
  @r = gh_repo
end

Public Instance Methods

full_name() click to toggle source
# File lib/gitomator/github/model/hosted_repo.rb, line 34
def full_name
  @r.full_name
end
name() click to toggle source
# File lib/gitomator/github/model/hosted_repo.rb, line 30
def name
  @r.name
end
properties() click to toggle source
# File lib/gitomator/github/model/hosted_repo.rb, line 47
def properties
  return {
    :description    => @r.description,
    :homepage       => @r.homepage,
    :private        => @r.private?,
    :has_issues     => @r.has_issues?,
    :has_wiki       => @r.has_wiki?,
    :has_downloads  => @r.has_downloads?,
    :default_branch => @r.default_branch
  }
end
url(protocol=nil) click to toggle source
# File lib/gitomator/github/model/hosted_repo.rb, line 38
def url(protocol=nil)
  protocol ||= HostedRepo::default_protocol()
  if protocol.to_sym == :ssh
    return @r.ssh_url
  else
    return @r.clone_url
  end
end