fortytwo 0.0.17 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +65 -32
- data/lib/fortytwo/responses/base.rb +7 -1
- data/lib/fortytwo/responses/models/achievement.rb +12 -0
- data/lib/fortytwo/responses/models/user.rb +2 -0
- data/lib/fortytwo/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abd620c14ed354ce605b6343943e871f7869dd74
|
4
|
+
data.tar.gz: 8ecd25b3b5c19d098543cb6100e1a9e73dc8b50b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47273245d672620abe80beb1640a37d12553d7d489589f2bb43c6615984bc8ad70986063fc54732b88f7340e3e9e5e07eaa86773c6b9f42f175a80dcc0be087b
|
7
|
+
data.tar.gz: 9328df0ccd0066c74d66d6cb09267adc35a395e8a5f6a5ea2e76a01b7b5170fb4de6abfa5e5e48462a00bd041abea3781d8618d1616f3ec639e8a17d8b7fbe58
|
data/README.md
CHANGED
@@ -68,38 +68,71 @@ user.location #=> nil
|
|
68
68
|
user.wallet #=> 0
|
69
69
|
user.groups #=> []
|
70
70
|
|
71
|
-
user.cursus_users.
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
user.projects_users.
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
user.expertises_users.
|
101
|
-
|
102
|
-
|
71
|
+
user.cursus_users.each do |user_cursus|
|
72
|
+
user_cursus.id #=> 14121
|
73
|
+
user_cursus.begin_at #=> "2016-09-19T22:00:00.000Z"
|
74
|
+
user_cursus.end_at #=> nil
|
75
|
+
user_cursus.grade #=> "Midshipman"
|
76
|
+
user_cursus.level #=> 3.91
|
77
|
+
user_cursus.skills #=> nil
|
78
|
+
user_cursus.cursus_id #=> 1
|
79
|
+
|
80
|
+
user_cursus.cursus.id #=> 1
|
81
|
+
user_cursus.cursus.created_at #=> "2014-11-02T16:43:38.480Z"
|
82
|
+
user_cursus.cursus.name #=> "42"
|
83
|
+
user_cursus.cursus.slug #=> "42"
|
84
|
+
end
|
85
|
+
|
86
|
+
user.projects_users.each do |user_project|
|
87
|
+
user_project.id #=> 405588
|
88
|
+
user_project.occurence #=> nil
|
89
|
+
user_project.final_mark #=> 115
|
90
|
+
user_project.status #=> "finished"
|
91
|
+
user_project.validated #=> true
|
92
|
+
user_project.current_team_id #=> 1434665
|
93
|
+
user_project.cursus_ids #=> [1]
|
94
|
+
|
95
|
+
user_project.project.id #=> 1
|
96
|
+
user_project.project.name #=> "Libft"
|
97
|
+
user_project.project.slug #=> "libft"
|
98
|
+
end
|
99
|
+
|
100
|
+
user.expertises_users.each do |expertise|
|
101
|
+
expertise.id #=> 7696
|
102
|
+
expertise.expertise_id #=> 29
|
103
|
+
expertise.interested #=> true
|
104
|
+
expertise.value #=> 2
|
105
|
+
expertise.contact_me #=> false
|
106
|
+
expertise.created_at #=> "2016-10-15T02:05:37.861Z"
|
107
|
+
expertise.user_id #=> 19619
|
108
|
+
end
|
109
|
+
|
110
|
+
user.achievements.each do |achievement|
|
111
|
+
achievement.id #=> 41
|
112
|
+
achievement.name #=> "In the name of Nicolas"
|
113
|
+
achievement.description #=> "Etre logué 90h sur une semaine. (à bosser, comme Nicolas vous l'a conseillé !)"
|
114
|
+
achievement.tier #=> "easy"
|
115
|
+
achievement.kind #=> "scolarity"
|
116
|
+
achievement.visible #=> true
|
117
|
+
achievement.image #=> "/uploads/achievement/image/41/SCO001.svg"
|
118
|
+
achievement.nbr_of_success #=> nil
|
119
|
+
achievement.users_url #=> "https://api.intra.42.fr/v2/achievements/41/users"
|
120
|
+
end
|
121
|
+
|
122
|
+
response = client.user_sessions("mfernand")
|
123
|
+
user_sessions = response.user_sessions
|
124
|
+
|
125
|
+
user_sessions.each do |session|
|
126
|
+
session.id #=> 5017063
|
127
|
+
session.begin_at #=> "2016-11-14T09:57:19"
|
128
|
+
session.end_at #=> "2016-11-14T10:07:19"
|
129
|
+
session.primary #-> true
|
130
|
+
session.floor #=> nil
|
131
|
+
session.row #=> nil
|
132
|
+
session.post #=> nil
|
133
|
+
session.host #=> "e1z2r7p18"
|
134
|
+
session.campus_id #=> 7
|
135
|
+
end
|
103
136
|
|
104
137
|
```
|
105
138
|
|
@@ -1,9 +1,11 @@
|
|
1
|
+
require "active_support/all"
|
2
|
+
|
1
3
|
module FortyTwo
|
2
4
|
module Response
|
3
5
|
class Base
|
4
6
|
def initialize(json)
|
5
7
|
return if json.nil?
|
6
|
-
return instance_variable_set(
|
8
|
+
return instance_variable_set(instance_variable_name, json) if json.is_a?(Array)
|
7
9
|
|
8
10
|
json.each do |key, value|
|
9
11
|
key = key.chomp('?') if key.end_with?('?')
|
@@ -18,6 +20,10 @@ module FortyTwo
|
|
18
20
|
return klass.new(json) if json
|
19
21
|
nil
|
20
22
|
end
|
23
|
+
|
24
|
+
def instance_variable_name
|
25
|
+
"@#{self.class.name.demodulize.underscore}"
|
26
|
+
end
|
21
27
|
end
|
22
28
|
end
|
23
29
|
end
|
@@ -3,6 +3,7 @@ require 'fortytwo/responses/models/cursus_user'
|
|
3
3
|
require 'fortytwo/responses/models/project_user'
|
4
4
|
require 'fortytwo/responses/models/expertise_user'
|
5
5
|
require 'fortytwo/responses/models/campus'
|
6
|
+
require 'fortytwo/responses/models/achievement'
|
6
7
|
|
7
8
|
module FortyTwo
|
8
9
|
module Response
|
@@ -22,6 +23,7 @@ module FortyTwo
|
|
22
23
|
@projects_users = parse(@projects_users, ProjectUser)
|
23
24
|
@expertises_users = parse(@expertises_users, ExpertiseUser)
|
24
25
|
@campus = parse(@campus, Campus)
|
26
|
+
@achievements = parse(@achievements, Achievement)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
data/lib/fortytwo/version.rb
CHANGED
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.0
|
4
|
+
version: 0.1.0
|
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-
|
11
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/fortytwo/endpoints/user.rb
|
140
140
|
- lib/fortytwo/endpoints/user_sessions.rb
|
141
141
|
- lib/fortytwo/responses/base.rb
|
142
|
+
- lib/fortytwo/responses/models/achievement.rb
|
142
143
|
- lib/fortytwo/responses/models/campus.rb
|
143
144
|
- lib/fortytwo/responses/models/cursus.rb
|
144
145
|
- lib/fortytwo/responses/models/cursus_user.rb
|