Class: Gitfave::Client
- Inherits:
-
Object
- Object
- Gitfave::Client
- Defined in:
- lib/gitfave/client.rb
Instance Attribute Summary collapse
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #fetch_repositories ⇒ Object
-
#initialize(username) ⇒ Client
constructor
A new instance of Client.
- #user_repositories ⇒ Object
Constructor Details
#initialize(username) ⇒ Client
Returns a new instance of Client.
8 9 10 |
# File 'lib/gitfave/client.rb', line 8 def initialize(username) @username = username end |
Instance Attribute Details
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/gitfave/client.rb', line 6 def username @username end |
Instance Method Details
#fetch_repositories ⇒ Object
12 13 14 |
# File 'lib/gitfave/client.rb', line 12 def fetch_repositories Net::HTTP.get(URI "https://api.github.com/users/#{@username}/repos") end |
#user_repositories ⇒ Object
16 17 18 |
# File 'lib/gitfave/client.rb', line 16 def user_repositories JSON.parse fetch_repositories end |