fortytwo 0.0.3 → 0.0.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: 6952833d0651aa41b4fec55e1e642e2b0c1f69c6
4
- data.tar.gz: b7043903d72e39385f6e48cf6b127f63987c17cd
3
+ metadata.gz: f6abbbceb4da8a60b40ba1d75fd220034b273261
4
+ data.tar.gz: ba51dce948dd36f78025847037a026c562ab3f35
5
5
  SHA512:
6
- metadata.gz: cf7bdef762b93f1ec6359d90426f64e585ec2116df4de82823511c71aed2cc6d33c17dc36d51ccaca090b715a3182d5526174d82e3538fd3a87a3b94aa944c88
7
- data.tar.gz: 033e1f170801bfbb8806b7ad9ac607ff891eb68fb9fd12901ce057747a03be9c1e7ecccb7b065653b6af0a566268f78b59189d9aa478a2ebdff5fa0ed15e6cfa
6
+ metadata.gz: a762879b2330d8383afa7645d7538130a29bf6ffbd586db494b159e75e21d0fc7d169d018c05fa6e46a7698f918864e82a467ca5cc39d1f8ef5275d6a9dc9284
7
+ data.tar.gz: 1eaaa12909726e39e30a02b1e760c57c38411ca525b7e1b5c76624884cba6a8e37af07e13d25f599f12bbf728bbddcf4418471e8c713fbc5418dd86723dbe901
data/README.md CHANGED
@@ -0,0 +1,79 @@
1
+ # fortytwo
2
+
3
+ This ruby gem provides a simple interface to the 42 API. Consuming data from the API is now easier and more readable.
4
+
5
+
6
+ ## Install
7
+
8
+ Add this to your application's Gemifle:
9
+
10
+ ```ruby
11
+ gem 'fortytwo'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ ```ruby
17
+ bundle install
18
+ ```
19
+
20
+ Or install it yourself as:
21
+ ```ruby
22
+ gem install fortytwo
23
+ ```
24
+ NOTE: IF YOU'RE INSTALLING IN THE CLUSTER'S MACS, SETUP LOCALLY LIKE THIS:
25
+ ```ruby
26
+ gem install --user-install fortytwo
27
+ ```
28
+
29
+ ### Get your API key and secret
30
+
31
+ This gem uses a client model to query against the API. You need to create and configure a 42 App containing your API key and API secret and make requests through that. Go here (https://profile.intra.42.fr/oauth/applications/new) to create the app and get the keys. You can name it whatever you want and redirect it wherever you want.
32
+
33
+ ## Usage
34
+
35
+ ### Initialize
36
+
37
+ Once you have you're key's you can initialize it like this:
38
+
39
+ ```ruby
40
+ require 'fortytwo'
41
+
42
+ client = FortyTwo::Client.new({ api_key: YOUR_API_KEY, api_secret: YOUR_API_SECRET })
43
+ ```
44
+
45
+ ### Responses
46
+
47
+ Responses from the API are all parsed and converted into Ruby objects. This way, you're able to access information using dot notation.
48
+
49
+ ```ruby
50
+ response = client.user("bsaget")
51
+ user = response.user
52
+
53
+ user.id #=>
54
+ user.first_name #=> Bob
55
+ user.last_name #=> Saget
56
+ user.cursus_users.first.level #=> 12.3
57
+
58
+ user.instance_variables
59
+ # [:@id, :@email, :@login, :@first_name, :@last_name, :@url, :@phone, :@displayname, :@image_url,
60
+ # :@staff, :@correction_point, :@pool_month, :@pool_year, :@location, :@wallet, :@groups,
61
+ # :@cursus_users, :@projects_users, :@achievements, :@titles, :@partnerships, :@patroned,
62
+ # :@patroning, :@expertises_users, :@campus]
63
+
64
+ user.cursus_users.first.instance_variables
65
+ # [:@id, :@begin_at, :@end_at, :@grade, :@level, :@skills, :@cursus_id, :@user, :@cursus]
66
+
67
+ user.projects_users.first.instance_variables
68
+ # [:@id, :@occurrence, :@final_mark, :@status, :@validated, :@current_team_id, :@project, :@cursus_ids]
69
+
70
+ user.expertises_users.first.instance_variables
71
+ # [:@id, :@expertise_id, :@interested, :@value, :@contact_me, :@created_at, :@user_id]
72
+
73
+ user.campus.first.instance_variables
74
+ # [:@id, :@name, :@time_zone, :@language, :@users_count, :@vogsphere_id]
75
+
76
+
77
+ ```
78
+
79
+ That's it! You have access to all the info obtained from a User request to the 42 API.
@@ -5,7 +5,7 @@ module FortyTwo
5
5
  module Response
6
6
  module Model
7
7
  class ProjectUser < Response::Base
8
- attr_reader :id, :occurence, :final_mark, :status,
8
+ attr_reader :id, :occurence, :final_mark, :status, :validated,
9
9
  :current_team_id, :project, :cursus_ids
10
10
 
11
11
  def initialize(json)
@@ -11,7 +11,9 @@ module FortyTwo
11
11
  attr_reader :id, :email, :login, :first_name, :last_name, :url, :phone,
12
12
  :displayname, :image_url, :correction_point, :staff,
13
13
  :pool_month, :pool_year, :location, :wallet, :cursus_users,
14
- :projects_users, :expertises_users, :campus
14
+ :projects_users, :expertises_users, :campus, :groups,
15
+ :achievements, :titles, :partnerships, :patroned,
16
+ :patroning, :expertises_users
15
17
 
16
18
  def initialize(json)
17
19
  super(json)
@@ -1,3 +1,3 @@
1
1
  module FortyTwo
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fortytwo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Fernandez