Class: XCPretty::GitHubInteractor
- Inherits:
-
Object
- Object
- XCPretty::GitHubInteractor
- Defined in:
- lib/xcpretty/reporters/learn.rb
Instance Attribute Summary collapse
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #get_user_id ⇒ Object
-
#initialize(username) ⇒ GitHubInteractor
constructor
A new instance of GitHubInteractor.
Constructor Details
#initialize(username) ⇒ GitHubInteractor
Returns a new instance of GitHubInteractor.
110 111 112 |
# File 'lib/xcpretty/reporters/learn.rb', line 110 def initialize(username) @username = username end |
Instance Attribute Details
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
104 105 106 |
# File 'lib/xcpretty/reporters/learn.rb', line 104 def user_id @user_id end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
104 105 106 |
# File 'lib/xcpretty/reporters/learn.rb', line 104 def username @username end |
Class Method Details
.get_user_id_for(username) ⇒ Object
106 107 108 |
# File 'lib/xcpretty/reporters/learn.rb', line 106 def self.get_user_id_for(username) new(username).get_user_id end |
Instance Method Details
#get_user_id ⇒ Object
114 115 116 117 118 119 |
# File 'lib/xcpretty/reporters/learn.rb', line 114 def get_user_id @user_id ||= Oj.load( open("https://api.github.com/users/#{username}").read, symbol_keys: true )[:id] end |