Class: Geet::Github::User
- Inherits:
-
Object
- Object
- Geet::Github::User
- Defined in:
- lib/geet/github/user.rb
Instance Attribute Summary collapse
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
- .authenticated(api_interface) ⇒ Object
-
.list_collaborators(api_interface) ⇒ Object
Returns an array of User instances.
Instance Method Summary collapse
-
#initialize(username) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(username) ⇒ User
Returns a new instance of User.
8 9 10 |
# File 'lib/geet/github/user.rb', line 8 def initialize(username) @username = username end |
Instance Attribute Details
#username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/geet/github/user.rb', line 6 def username @username end |
Class Method Details
.authenticated(api_interface) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/geet/github/user.rb', line 14 def self.authenticated(api_interface) api_path = '/user' response = api_interface.send_request(api_path) new(response.fetch('login')) end |
.list_collaborators(api_interface) ⇒ Object
Returns an array of User instances
24 25 26 27 28 29 |
# File 'lib/geet/github/user.rb', line 24 def self.list_collaborators(api_interface) api_path = 'collaborators' response = api_interface.send_request(api_path, multipage: true) response.map { |user_entry| new(user_entry.fetch('login')) } end |