Class: 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

Methods included from DataCreator

#create_many_orgs, #create_many_repos, #create_many_users, #create_org, #create_org_repos, #create_single_repo, #create_user, #create_user_repos, #parse_data

Constructor Details

#initialize(hash) ⇒ Repo

Returns a new instance of Repo.



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

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.



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

def forks_count
  @forks_count
end

#languageObject

Returns the value of attribute language.



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

def language
  @language
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#starsObject

Returns the value of attribute stars.



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

def stars
  @stars
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.fetch_all_reposObject



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

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



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

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

.fetch_single_repo(username, repo) ⇒ Object



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

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

.fetch_user_repos(username) ⇒ Object



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

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