lib/epitech_api/gatherer.rb in epitech_api-0.1.2 vs lib/epitech_api/gatherer.rb in epitech_api-0.1.3
- old
+ new
@@ -1,26 +1,19 @@
+require 'epitech_api/DataTypes/promo'
+require 'epitech_api/Managers/promo_manager'
+require 'epitech_api/Managers/user_manager'
+
+
module EpitechApi
class Gatherer
+ attr_accessor :promo_manager, :user_manager
+
def initialize(token)
@token = token
+ @promo_manager = PromoManager.new @token
+ @user_manager = UserManager.new @token
end
- def promos(location, year)
- uri = URI("https://intra.epitech.eu/user/filter/promo?format=json&location=#{location}&year=#{year}&active=true")
- puts uri
-
- 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
-
- puts response
- raise InvalidRights unless response.code.to_i == 200
- JSON.parse response.body
- end
end
end
\ No newline at end of file