2017-04-11 21:33:54 -04:00
|
|
|
module Github
|
|
|
|
class User
|
2017-04-19 19:04:58 -04:00
|
|
|
attr_reader :username, :options
|
2017-04-11 21:33:54 -04:00
|
|
|
|
2017-04-19 19:04:58 -04:00
|
|
|
def initialize(username, options)
|
2017-04-11 21:33:54 -04:00
|
|
|
@username = username
|
2017-04-19 19:04:58 -04:00
|
|
|
@options = options
|
2017-04-11 21:33:54 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def get
|
|
|
|
client.get(user_url).body
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def client
|
2017-04-19 19:04:58 -04:00
|
|
|
@client ||= Github::Client.new(options)
|
2017-04-11 21:33:54 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def user_url
|
|
|
|
"/users/#{username}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|