Class: Superavatar::Sources::Github
- Inherits:
-
Object
- Object
- Superavatar::Sources::Github
- Defined in:
- lib/superavatar/sources/github.rb
Instance Method Summary collapse
- #api_profile_endpoint ⇒ Object
- #get_avatar_url ⇒ Object
-
#initialize(username) ⇒ Github
constructor
A new instance of Github.
- #web_profile ⇒ Object
Constructor Details
#initialize(username) ⇒ Github
6 7 8 9 |
# File 'lib/superavatar/sources/github.rb', line 6 def initialize(username) @username = username @avatar_url = nil end |
Instance Method Details
#api_profile_endpoint ⇒ Object
23 24 25 |
# File 'lib/superavatar/sources/github.rb', line 23 def api_profile_endpoint "https://api.github.com/users/#{@username}" end |
#get_avatar_url ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/superavatar/sources/github.rb', line 11 def get_avatar_url return @avatar_url unless @avatar_url.nil? url = api_profile_endpoint github_res = Superavatar::Utils::Apiclient.fetch_external_api(url) @avatar_url = github_res.fetch('avatar_url') end |
#web_profile ⇒ Object
19 20 21 |
# File 'lib/superavatar/sources/github.rb', line 19 def web_profile "https://github.com/#{@username}/" end |