fortytwo 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48cc8a78ff6272711bb718150566dbecae564b82
4
- data.tar.gz: f24170785dfeec0afba650ff977a16123a326337
3
+ metadata.gz: 0333f20c80cbf473c5375c9e8d889dcccfad8882
4
+ data.tar.gz: 321bf68b6ec5dabfccdb0f530e9fca7138cced18
5
5
  SHA512:
6
- metadata.gz: c4f61dae46bafa4f010693c58dc34014474c1c0f71b8ff442768244ae100a86b99f109ac8756a51843703e90ca61bf5088e634dcb32291c03ed82c7855a5a5ac
7
- data.tar.gz: c18397ff8d90cdb5c18d9ef0cd36b1a64e7bced69e615479625852b856a8e536f0706848713fcd496a908aa6b32a1aaf93e096cbaf25f29c646919522242b177
6
+ metadata.gz: 57b66ff8593d57061e98349af1d417deb31bc56676d699d26130d19ad7ce5a886edbd361c6e0d8135b1eb574ac8ed0d8c88fd7af74acc73a176e6320886d22c4
7
+ data.tar.gz: b7c6bd81280de3bfcbe283f58a74a64e3d85333486c46b054e92ac63b5acae5a48c27c90e6be8feb2f9dc8ea92b5ede19eb3e076c409f9a73c35e68db6a7abc7
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.2.2
data/README.md CHANGED
@@ -74,9 +74,14 @@ user.cursus_users.each do |user_cursus|
74
74
  user_cursus.end_at #=> nil
75
75
  user_cursus.grade #=> "Midshipman"
76
76
  user_cursus.level #=> 3.91
77
- user_cursus.skills #=> nil
78
77
  user_cursus.cursus_id #=> 1
79
78
 
79
+ user_cursus.skills.each do |skill|
80
+ skill.id #=> 3
81
+ skill.name #=> "Rigor"
82
+ skill.level #=> 2.88
83
+ end
84
+
80
85
  user_cursus.cursus.id #=> 1
81
86
  user_cursus.cursus.created_at #=> "2014-11-02T16:43:38.480Z"
82
87
  user_cursus.cursus.name #=> "42"
@@ -2,12 +2,15 @@ require 'oauth2'
2
2
 
3
3
  require 'fortytwo/configuration'
4
4
  require 'fortytwo/endpoints/user'
5
+ require 'fortytwo/endpoints/users'
5
6
  require 'fortytwo/endpoints/user_sessions'
6
7
 
7
8
  module FortyTwo
8
9
  class Client
9
10
  API_HOST = 'https://api.intra.42.fr'
10
- REQUEST_CLASSES = [FortyTwo::Endpoint::User, FortyTwo::Endpoint::UserSessions]
11
+ REQUEST_CLASSES = [FortyTwo::Endpoint::User,
12
+ FortyTwo::Endpoint::Users,
13
+ FortyTwo::Endpoint::UserSessions]
11
14
 
12
15
  attr_reader :configuration
13
16
 
@@ -0,0 +1,34 @@
1
+ require 'fortytwo/responses/users'
2
+
3
+ module FortyTwo
4
+ module Endpoint
5
+ class Users
6
+
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ def users(campus = nil, pool_year = nil, pool_month = nil, params = { page: 1, per_page: 100 })
12
+ Response::Users.new(users_request(campus, pool_year, pool_month, params))
13
+ end
14
+
15
+ private
16
+
17
+ def users_request(campus, pool_year, pool_month, params)
18
+ @client.token.get("/v2#{campus_path(campus)}/users#{pool_year_filter(pool_year)}#{pool_month_filter(pool_month)}", params: params).parsed
19
+ end
20
+
21
+ def campus_path(campus)
22
+ "/campus/#{campus}" if campus
23
+ end
24
+
25
+ def pool_year_filter(pool_year)
26
+ "?filter[pool_year]=#{pool_year}" if pool_year
27
+ end
28
+
29
+ def pool_month_filter(pool_month)
30
+ "&filter[pool_month]=#{pool_month}" if pool_month
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,16 @@
1
+ require 'fortytwo/responses/base'
2
+ require 'fortytwo/responses/models/user'
3
+
4
+ module FortyTwo
5
+ module Response
6
+ class Users < Base
7
+ attr_reader :users
8
+
9
+ def initialize(json)
10
+ super(json)
11
+
12
+ @users = parse(@users, Model::User)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module FortyTwo
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fortytwo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Fernandez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-17 00:00:00.000000000 Z
11
+ date: 2017-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -138,6 +138,7 @@ files:
138
138
  - lib/fortytwo/configuration.rb
139
139
  - lib/fortytwo/endpoints/user.rb
140
140
  - lib/fortytwo/endpoints/user_sessions.rb
141
+ - lib/fortytwo/endpoints/users.rb
141
142
  - lib/fortytwo/responses/base.rb
142
143
  - lib/fortytwo/responses/models/achievement.rb
143
144
  - lib/fortytwo/responses/models/campus.rb
@@ -152,6 +153,7 @@ files:
152
153
  - lib/fortytwo/responses/models/user_session.rb
153
154
  - lib/fortytwo/responses/user.rb
154
155
  - lib/fortytwo/responses/user_sessions.rb
156
+ - lib/fortytwo/responses/users.rb
155
157
  - lib/fortytwo/version.rb
156
158
  - tasks/console.rake
157
159
  homepage: https://github.com/MatiasFMolinari/fortytwo
@@ -174,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
176
  version: '0'
175
177
  requirements: []
176
178
  rubyforge_project:
177
- rubygems_version: 2.0.14.1
179
+ rubygems_version: 2.4.5
178
180
  signing_key:
179
181
  specification_version: 4
180
182
  summary: Ruby client library for the 42 API