class EpitechApi::User

Public Class Methods

new(token) click to toggle source
# File lib/epitech_api/user.rb, line 8
def initialize(token)
  @token = token
end

Public Instance Methods

gatherer() click to toggle source
# File lib/epitech_api/user.rb, line 12
def gatherer
  Gatherer.new @token
end
info() click to toggle source
# File lib/epitech_api/user.rb, line 16
def info
  uri = URI('https://intra.epitech.eu/user/?format=json')

  req = Net::HTTP::Get.new uri
  req['Cookie'] = "#{@token}"

  http = Net::HTTP.new(uri.hostname, uri.port)
  http.use_ssl = true

  response = http.request req

  raise InvalidRights unless response.code.to_i == 200
  JSON.parse response.body
end