Class: EpitechApi::OfficeProvider
- Inherits:
-
Object
- Object
- EpitechApi::OfficeProvider
- Defined in:
- lib/epitech_api/Providers/office_provider.rb
Class Method Summary collapse
Class Method Details
.login(code) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/epitech_api/Providers/office_provider.rb', line 9 def self.login(code) uri = URI("https://intra.epitech.eu/auth/office365?code=#{code}&state=%2f") response = Net::HTTP.get_response(uri) raise InvalidCredentials unless response.code.to_i == 302 = CGI::Cookie::parse(response['Set-Cookie']) token = ['user'] User.new token end |