Class: Github::Developer
- Inherits:
-
Object
- Object
- Github::Developer
- Defined in:
- lib/gitget/github_developer.rb
Overview
Main class to set up a Github User
Instance Attribute Summary collapse
-
#avatar_url ⇒ Object
readonly
Returns the value of attribute avatar_url.
-
#bio ⇒ Object
readonly
Returns the value of attribute bio.
-
#blog ⇒ Object
readonly
Returns the value of attribute blog.
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#followers ⇒ Object
readonly
Returns the value of attribute followers.
-
#following ⇒ Object
readonly
Returns the value of attribute following.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#public_repos ⇒ Object
readonly
Returns the value of attribute public_repos.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data: nil) ⇒ Developer
constructor
A new instance of Developer.
- #load_data(repo_data) ⇒ Object
- #repos ⇒ Object
- #starred ⇒ Object
Constructor Details
#initialize(data: nil) ⇒ Developer
Returns a new instance of Developer.
9 10 11 |
# File 'lib/gitget/github_developer.rb', line 9 def initialize(data: nil) load_data(data) end |
Instance Attribute Details
#avatar_url ⇒ Object (readonly)
Returns the value of attribute avatar_url.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def avatar_url @avatar_url end |
#bio ⇒ Object (readonly)
Returns the value of attribute bio.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def bio @bio end |
#blog ⇒ Object (readonly)
Returns the value of attribute blog.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def blog @blog end |
#company ⇒ Object (readonly)
Returns the value of attribute company.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def company @company end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def email @email end |
#followers ⇒ Object (readonly)
Returns the value of attribute followers.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def followers @followers end |
#following ⇒ Object (readonly)
Returns the value of attribute following.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def following @following end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def id @id end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def name @name end |
#public_repos ⇒ Object (readonly)
Returns the value of attribute public_repos.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def public_repos @public_repos end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/gitget/github_developer.rb', line 6 def username @username end |
Class Method Details
Instance Method Details
#load_data(repo_data) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/gitget/github_developer.rb', line 41 def load_data(repo_data) @username = repo_data['login'] @id = repo_data['id'] @public_repos = repo_data['public_repos'] @avatar_url = repo_data['avatar_url'] @name = repo_data['name'] @company = repo_data['company'] @blog = repo_data['blog'] @location = repo_data['location'] @email = repo_data['email'] @bio = repo_data['bio'] end |
#repos ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/gitget/github_developer.rb', line 13 def repos return @repos if @repos repos_promises = Github::API.user_repos(@username).map do |repo_data| Concurrent::Promise.execute {Github::Repository.new(data: repo_data)} end @repos = repos_promises.map(&:value) @repos end |
#starred ⇒ Object
35 36 37 38 39 |
# File 'lib/gitget/github_developer.rb', line 35 def starred return @starred if @starred @starred = Github::API.user_starred @username end |