epitech_api 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67b007c5fab2d1b27993ab9a3668ede6f8dd09d1
4
- data.tar.gz: 46056b75fd7c547db05a7f07ab52c08c25345e23
3
+ metadata.gz: 473b0916bbb3c034adad18f6840495713350a67d
4
+ data.tar.gz: 265d65c55b8e9b0fe32a664c184daee1e7c08be1
5
5
  SHA512:
6
- metadata.gz: 2bf3f7b893a87873a95ec424abf428d7a7d25fa6f4eeb491c5abbe1965610f6d50e106889769286c0ce03f3428a9bd916f033bbd794b5d7d7ee5c569f931148d
7
- data.tar.gz: 032cb5fc1367bb5b589fa9882d61811cf2d09fa4a68d9cad40f3114a05c9b05ac15eddde99c72548885ea66e62432fe691c04d3717b528f783c9ad648a192cc3
6
+ metadata.gz: 3eb91217432c2d55a2678f28e96ee0aa5de5cb753cbc2c887561b1ccd481169a7f7b090b6f053316b75294def43e4545fbd1fc61149bfe8ef842d650aab3db87
7
+ data.tar.gz: 8ce06a46f7f313ba79b03d6b55d8ba847b4542fcc7510bf4a8859fe924b9c98e4d8c8a110a8c99deb864f9b1217f842f5faa6fa6fbfc43b7c38f487f1599b384
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <Settings><!--This file was automatically generated by Ruby plugin.
3
- You are allowed to:
4
- 1. Remove rake task
5
- 2. Add existing rake tasks
6
- To add existing rake tasks automatically delete this file and reload the project.
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
7
  --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
@@ -1,19 +1,13 @@
1
- require 'epitech_api/DataTypes/basic_student'
1
+ require_relative 'basic_student'
2
2
 
3
3
  module EpitechApi
4
4
  class Student < BasicStudent
5
5
 
6
- attr_accessor :closed, :time_active, :time_needed
6
+ attr_accessor :login, :first_name, :last_name, :picture, :location, :closed, :time_active, :time_needed, :gpa,
7
7
 
8
- def initialize(login, first_name, last_name, picture, location, time_active, time_needed, closed)
9
- @login = login
10
- @first_name = first_name
11
- @last_name = last_name
12
- @picture = picture
13
- @location = location
14
- @time_active = time_active
15
- @time_needed = time_needed
16
- @closed = closed
8
+ def initialize(infos)
9
+ @login, @first_name, @last_name, @picture, @location, @time_active, @time_needed, @closed, @gpa =
10
+ infos.values_at(:login, :first_name, :last_name, :picture, :location, :time_active, :time_needed, :closed, :gpa)
17
11
  end
18
12
 
19
13
  end
@@ -1,4 +1,4 @@
1
- require 'epitech_api/DataTypes/basic_student'
1
+ require_relative '../DataTypes/basic_student'
2
2
 
3
3
  module EpitechApi
4
4
  class PromoManager
@@ -1,4 +1,5 @@
1
- require 'epitech_api/DataTypes/student'
1
+ require 'net/http'
2
+ require_relative '../DataTypes/student'
2
3
 
3
4
  module EpitechApi
4
5
  class UserManager
@@ -20,7 +21,15 @@ module EpitechApi
20
21
 
21
22
  raise InvalidRights unless response.code.to_i == 200
22
23
  body = JSON.parse response.body
23
- Student.new body['login'], body['firstname'], body['lastname'], body['picture'], body['location'], body['nsstat']['active'], body['nsstat']['nslog_norm'], body['close']
24
+ Student.new(login: body['login'],
25
+ first_name: body['firstname'],
26
+ last_name: body['lastname'],
27
+ picture: body['picture'],
28
+ location: body['location'],
29
+ time_active: body.fetch('nsstat', {})['active'],
30
+ time_needed: body.fetch('nsstat', {})['nslog_norm'],
31
+ closed: body['close'],
32
+ gpa: body.fetch('gpa', []).fetch(0, {})['gpa'])
24
33
  end
25
34
 
26
35
  end
@@ -1,6 +1,6 @@
1
- require 'epitech_api/DataTypes/promo'
2
- require 'epitech_api/Managers/promo_manager'
3
- require 'epitech_api/Managers/user_manager'
1
+ require_relative 'DataTypes/promo'
2
+ require_relative 'Managers/promo_manager'
3
+ require_relative 'Managers/user_manager'
4
4
 
5
5
 
6
6
  module EpitechApi
@@ -1,2 +1,2 @@
1
- require 'epitech_api/Providers/intra_provider'
2
- require 'epitech_api/Providers/office_provider'
1
+ require_relative 'Providers/intra_provider'
2
+ require_relative 'Providers/office_provider'
@@ -0,0 +1,8 @@
1
+ require_relative 'providers'
2
+
3
+ user = EpitechApi::IntraProvider.auto_login('auth-749fdf3fb987eef189c058332a3c41b4712eb67a')
4
+ user_manager = user.gatherer.user_manager
5
+ promo_manager = user.gatherer.promo_manager
6
+ student = promo_manager.extract_students(promo_manager.get('tek4', 'FR/LIL', 2017))
7
+
8
+ puts student.map { |s| user_manager.get(s.login) }.inspect
@@ -1,3 +1,3 @@
1
1
  module EpitechApi
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epitech_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antoine FORET
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-26 00:00:00.000000000 Z
11
+ date: 2018-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -105,6 +105,7 @@ files:
105
105
  - lib/epitech_api/Providers/office_provider.rb
106
106
  - lib/epitech_api/gatherer.rb
107
107
  - lib/epitech_api/providers.rb
108
+ - lib/epitech_api/test.rb
108
109
  - lib/epitech_api/user.rb
109
110
  - lib/epitech_api/version.rb
110
111
  homepage: https://github.com/eliastre100/epitech-api-gem
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  version: '0'
129
130
  requirements: []
130
131
  rubyforge_project:
131
- rubygems_version: 2.5.1
132
+ rubygems_version: 2.5.2.1
132
133
  signing_key:
133
134
  specification_version: 4
134
135
  summary: Simply access to every epitech's intranet information!