Class: Gitwrap::Repo

Inherits:
GithubConnection show all
Defined in:
lib/gitwrap/repos.rb

Constant Summary

Constants inherited from GithubConnection

GithubConnection::BASE_URL

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Repo

Returns a new instance of Repo.



6
7
8
9
10
11
12
# File 'lib/gitwrap/repos.rb', line 6

def initialize(hash)
  @name = hash["name"]
  @url = hash["url"]
  @forks = hash["forks_count"]
  @language = hash["language"]
  @stars = hash["stargazers_count"]
end

Instance Attribute Details

#forks_countObject

Returns the value of attribute forks_count.



3
4
5
# File 'lib/gitwrap/repos.rb', line 3

def forks_count
  @forks_count
end

#languageObject

Returns the value of attribute language.



3
4
5
# File 'lib/gitwrap/repos.rb', line 3

def language
  @language
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/gitwrap/repos.rb', line 3

def name
  @name
end

#starsObject

Returns the value of attribute stars.



3
4
5
# File 'lib/gitwrap/repos.rb', line 3

def stars
  @stars
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/gitwrap/repos.rb', line 3

def url
  @url
end

Class Method Details

.fetch_all_reposObject



22
23
24
25
26
# File 'lib/gitwrap/repos.rb', line 22

def self.fetch_all_repos
  repos = Repo.new({}).create_many_repos("#{BASE_URL}repositories")
  $current_repo += repos.length-1
  repos
end

.fetch_org_repos(org) ⇒ Object



18
19
20
# File 'lib/gitwrap/repos.rb', line 18

def self.fetch_org_repos(org)
  repos = Repo.new({}).create_org_repos("#{BASE_URL}orgs/#{org}/repos")
end

.fetch_single_repo(username, repo) ⇒ Object



28
29
30
# File 'lib/gitwrap/repos.rb', line 28

def self.fetch_single_repo(username, repo)
  repo = Repo.new({}).create_single_repo("#{BASE_URL}repos/#{username}/#{repo}")
end

.fetch_user_repos(username) ⇒ Object



14
15
16
# File 'lib/gitwrap/repos.rb', line 14

def self.fetch_user_repos(username)
  repo = Repo.new({}).create_user_repos("#{BASE_URL}users/#{username}/repos")
end