Class: Gitwrap::Repo
- Inherits:
-
GithubConnection
- Object
- GithubConnection
- Gitwrap::Repo
- Defined in:
- lib/gitwrap/repos.rb
Constant Summary
Constants inherited from GithubConnection
Instance Attribute Summary collapse
-
#forks_count ⇒ Object
Returns the value of attribute forks_count.
-
#language ⇒ Object
Returns the value of attribute language.
-
#name ⇒ Object
Returns the value of attribute name.
-
#stars ⇒ Object
Returns the value of attribute stars.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
- .fetch_all_repos ⇒ Object
- .fetch_org_repos(org) ⇒ Object
- .fetch_single_repo(username, repo) ⇒ Object
- .fetch_user_repos(username) ⇒ Object
Instance Method Summary collapse
-
#initialize(hash) ⇒ Repo
constructor
A new instance of Repo.
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_count ⇒ Object
Returns the value of attribute forks_count.
3 4 5 |
# File 'lib/gitwrap/repos.rb', line 3 def forks_count @forks_count end |
#language ⇒ Object
Returns the value of attribute language.
3 4 5 |
# File 'lib/gitwrap/repos.rb', line 3 def language @language end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/gitwrap/repos.rb', line 3 def name @name end |
#stars ⇒ Object
Returns the value of attribute stars.
3 4 5 |
# File 'lib/gitwrap/repos.rb', line 3 def stars @stars end |
#url ⇒ Object
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_repos ⇒ Object
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 |