yaleldap 1.0.5 → 1.0.6

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: f2f3a5dcf5ce99f299cd810d910e3087cd8aed55
4
- data.tar.gz: 90f06e97db95d4688d89956ae460c2f62d32a287
3
+ metadata.gz: 085e564098747fe02c8081c63e0bb948f512cf97
4
+ data.tar.gz: e933f0d8a93036961a9d4aa0f9ecc3078d746485
5
5
  SHA512:
6
- metadata.gz: 31a0b9825aa6ad45eacf390f87db240d229915a28c466e0720a1f73cb6ac0ad9850afe579c36241dde3390dabda012fb6f8713f9fabaf8ceedec8750061ebc59
7
- data.tar.gz: 636b4204a56d0858306d4ff39eba0b9c07d0431c35a1795b7ed3937686ee5fda6ae56c3d54250df954dcec8cb69406be5d1760f3d44102a099ccdd15dbf16464
6
+ metadata.gz: fd70cba221f0dcc68231ec5925745729e7abec850d82e04f4a26c9aaa2b86e3c831825873ea909f4b3d69fb163a91f5a18dd9429b2689bebe6bb76c61a50fea1
7
+ data.tar.gz: 1664a0f29d805d0a2a95ea94def8664b40b88b6e30c1c3b6a318b86f3ce595d7ca274de732c5752363f9d11cdcb87f0003ab970fa45ba1b80533b01ef2733012
data/README.md CHANGED
@@ -45,6 +45,51 @@ YaleLDAP.lookup(email: "casey.watts@yale.edu")
45
45
  => {:first_name=>"Casey", :nickname=>"", :last_name=>"Watts", :upi=>"12714662", :netid=>"csw3", :email=>"casey.watts@yale.edu", :college_name=>"", :college_abbreviation=>"", :class_year=>"", :school=>"", :telephone=>"", :address=>"ITS Student Technology Collaborative\nPO BOX 208300\nNew Haven, CT 06520-8300"}
46
46
  ```
47
47
 
48
+ ## Return Data
49
+ - Yale's list of LDAP attributes are listed by their LDAP names [here](http://directory.yale.edu/phonebook/help.htm).
50
+ - Our set of nicknames for Yale's attributes are in `lib/yaleldap.rb`
51
+ - If you think there is a commonly used field we missed, file a github issue! :D
52
+ - If you'd like more control over your YaleLDAP connection, you could do this all manually. [Here is a gist](https://gist.github.com/caseywatts/ddea3996853050d1e5ad) of how to use the 'net-ldap' gem to access Yale's LDAP.
53
+ - Here are some examples of what the more vague LDAP terms contain:
54
+ ```
55
+ Division (general, most people have this)
56
+ Yale College
57
+ Graduate School of Arts & Sci
58
+ Architecture School
59
+ Pharmacology
60
+ MYSM School Of Medicine
61
+ Information Technology Services
62
+
63
+ Organization (more specific, staff tend to have these)
64
+ MPHARM Administration
65
+ ITSCCT Web Technologies
66
+
67
+ Curriculum/Major (more specific, students tend to have these)
68
+ Pharmacology
69
+ Architecture School
70
+ Physics
71
+
72
+ Curriculum Code (seems to be abbreviation of division if they are a school?)
73
+ YC
74
+ GS
75
+ AC
76
+ ```
77
+
78
+ ## Use in Rails
79
+ You can use an "after_create" filter to have these attributes filled out after the user is created (maybe after first login if that's how your app works). `.slice(:first_name, :last_name, :netid)` will extract only the attributes you want to save to ActiveRecord. If your database uses diferent names you will have to rename the appropriate attributes manually, or just extract what you want.
80
+ ```
81
+ class User < ActiveRecord::Base
82
+ after_create :get_ldap_attributes
83
+
84
+ def get_ldap_attributes
85
+ attributes = YaleLDAP.lookup(netid: netid)
86
+ .slice(:first_name, :last_name, :netid)
87
+ self.update_attributes(attributes)
88
+ rescue
89
+ false # don't actually save it if LDAP lookup fails
90
+ end
91
+ end
92
+ ```
48
93
 
49
94
  ## Documentation
50
95
  The source code is documented thoroughly, view it on [rdoc.info](http://rdoc.info/github/YaleSTC/yaleldap/master/frames)
@@ -1,5 +1,5 @@
1
1
  #Version Goes Here
2
2
  module YaleLDAP
3
3
  #Version Number
4
- VERSION = "1.0.5"
4
+ VERSION = "1.0.6"
5
5
  end
data/lib/yaleldap.rb CHANGED
@@ -63,8 +63,13 @@ private
63
63
  "upi" => "UPI",
64
64
  "netid" => "uid",
65
65
  "email" => "mail",
66
+ "title" => "title",
67
+ "division" => "o",
66
68
  "school" => "o",
67
69
  "school_abbreviation" => "curriculumshortname",
70
+ "organization" => "ou",
71
+ "major" => "curriculum",
72
+ "curriculum" => "curriculum",
68
73
  "college_name" => "collegename",
69
74
  "college_abbreviation" => "college",
70
75
  "class_year" => "class",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaleldap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - caseywatts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-22 00:00:00.000000000 Z
11
+ date: 2014-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler