yaleldap 1.0.6 → 1.0.7

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: 085e564098747fe02c8081c63e0bb948f512cf97
4
- data.tar.gz: e933f0d8a93036961a9d4aa0f9ecc3078d746485
3
+ metadata.gz: 266a897095f24d430477b8e2102ddca166d36690
4
+ data.tar.gz: 92930d2a050274ed5875518dc3ddcd26196f1309
5
5
  SHA512:
6
- metadata.gz: fd70cba221f0dcc68231ec5925745729e7abec850d82e04f4a26c9aaa2b86e3c831825873ea909f4b3d69fb163a91f5a18dd9429b2689bebe6bb76c61a50fea1
7
- data.tar.gz: 1664a0f29d805d0a2a95ea94def8664b40b88b6e30c1c3b6a318b86f3ce595d7ca274de732c5752363f9d11cdcb87f0003ab970fa45ba1b80533b01ef2733012
6
+ metadata.gz: 8c4904fd23614ad5461bf4fe3cd249a69e76b42c202b3f82e269875bd83db4f331f8a4c43127d655d1059a43d523ef76bbda1eb48996af031f8ae398959f9a7d
7
+ data.tar.gz: a9d1d6491b2dc918971d6087a339aede227e0e9dbd5b0813c893e491da60181489266c61aaf29b68588e1bc0a3a87263ad9bd932ce744adcf4e666774f3c9f4e
data/README.md CHANGED
@@ -25,34 +25,48 @@ Or install it yourself as:
25
25
 
26
26
  $ gem install yaleldap
27
27
 
28
- ## Usage
28
+ To play with it, open `irb` and try these:
29
29
 
30
- ###UPI
31
30
  ```
32
- YaleLDAP.lookup(upi: "12714662")
33
- => {: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"}
31
+ require 'yaleldap'
32
+ attributes = YaleLDAP.lookup(netid: "csw3")
33
+ attributes = YaleLDAP.lookup(email: "casey.watts@yale.edu")
34
+ attributes = YaleLDAP.lookup(upi: "12714662")
34
35
  ```
35
36
 
37
+
38
+ ## Usage
39
+
36
40
  ###NetID
37
41
  ```
38
42
  YaleLDAP.lookup(netid: "csw3")
39
- => {: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"}
43
+ => {:first_name=>"Casey", :nickname=>"", :last_name=>"Watts", :upi=>"12714662", :netid=>"csw3", :email=>"casey.watts@yale.edu", :title=>"Assistant Manager", :division=>"Information Technology Services", :school=>"Information Technology Services", :school_abbreviation=>"", :organization=>"ITSCCT Web Technologies", :major=>"", :curriculum=>"", :college_name=>"", :college_abbreviation=>"", :class_year=>"", :telephone=>"203-436-5986", :address=>"ITS Student Technology Collaborative\nPO BOX 208300\nNew Haven, CT 06520-8300"}
40
44
  ```
41
45
 
42
46
  ###Email
43
47
  ```
44
48
  YaleLDAP.lookup(email: "casey.watts@yale.edu")
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"}
49
+ => {:first_name=>"Casey", :nickname=>"", :last_name=>"Watts", :upi=>"12714662", :netid=>"csw3", :email=>"casey.watts@yale.edu", :title=>"Assistant Manager", :division=>"Information Technology Services", :school=>"Information Technology Services", :school_abbreviation=>"", :organization=>"ITSCCT Web Technologies", :major=>"", :curriculum=>"", :college_name=>"", :college_abbreviation=>"", :class_year=>"", :telephone=>"203-436-5986", :address=>"ITS Student Technology Collaborative\nPO BOX 208300\nNew Haven, CT 06520-8300"}
50
+ ```
51
+
52
+ ###UPI
53
+ ```
54
+ YaleLDAP.lookup(upi: "12714662")
55
+ => {:first_name=>"Casey", :nickname=>"", :last_name=>"Watts", :upi=>"12714662", :netid=>"csw3", :email=>"casey.watts@yale.edu", :title=>"Assistant Manager", :division=>"Information Technology Services", :school=>"Information Technology Services", :school_abbreviation=>"", :organization=>"ITSCCT Web Technologies", :major=>"", :curriculum=>"", :college_name=>"", :college_abbreviation=>"", :class_year=>"", :telephone=>"203-436-5986", :address=>"ITS Student Technology Collaborative\nPO BOX 208300\nNew Haven, CT 06520-8300"}
46
56
  ```
47
57
 
58
+
48
59
  ## 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:
60
+ ###What data is returned?
61
+ >"What does the returned data look like? Where does it come from?"
62
+
63
+ We map a memorable nickname to each of the less memorable formal LDAP names.
64
+ - The easiest way to see what attributes are available is to test it out.
65
+ - Our full list of nicknames is in `lib/yaleldap.rb` under `self.nicknames`
66
+ - Yale's list of formal LDAP attribute names are listed [here](http://directory.yale.edu/phonebook/help.htm).
67
+ - Here are some examples of what the more vague LDAP terms contain. We've included multiple aliases for some of these.
54
68
  ```
55
- Division (general, most people have this)
69
+ Division [listed as division, school] - general category, most people have this. For students, this is their school)
56
70
  Yale College
57
71
  Graduate School of Arts & Sci
58
72
  Architecture School
@@ -60,23 +74,30 @@ Division (general, most people have this)
60
74
  MYSM School Of Medicine
61
75
  Information Technology Services
62
76
 
63
- Organization (more specific, staff tend to have these)
77
+ Curriculum Code [listed as school_abbreviation] - seems to be abbreviation of division if they are a school?)
78
+ YC
79
+ GS
80
+ AC
81
+
82
+ Organization [listed as organization] - more specific, staff tend to have these
64
83
  MPHARM Administration
65
84
  ITSCCT Web Technologies
66
85
 
67
- Curriculum/Major (more specific, students tend to have these)
86
+ Curriculum/Major [listed as curriculum, major] - more specific, students tend to have these
68
87
  Pharmacology
69
88
  Architecture School
70
89
  Physics
71
-
72
- Curriculum Code (seems to be abbreviation of division if they are a school?)
73
- YC
74
- GS
75
- AC
76
90
  ```
77
91
 
92
+ ### Something's Missing?
93
+ >"I want some data that's in the [Yale Phonebook](http://directory.yale.edu/phonebook/index.htm) but it's not in the `YaleLDAP` gem."
94
+
95
+ - If you think there is a commonly used field we missed, file a github issue! :D
96
+ - 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.
97
+
98
+
78
99
  ## 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.
100
+ 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 using your own ruby code.
80
101
  ```
81
102
  class User < ActiveRecord::Base
82
103
  after_create :get_ldap_attributes
@@ -1,5 +1,5 @@
1
1
  #Version Goes Here
2
2
  module YaleLDAP
3
3
  #Version Number
4
- VERSION = "1.0.6"
4
+ VERSION = "1.0.7"
5
5
  end
data/lib/yaleldap.rb CHANGED
@@ -68,8 +68,8 @@ private
68
68
  "school" => "o",
69
69
  "school_abbreviation" => "curriculumshortname",
70
70
  "organization" => "ou",
71
- "major" => "curriculum",
72
- "curriculum" => "curriculum",
71
+ "major" => "major",
72
+ "curriculum" => "major",
73
73
  "college_name" => "collegename",
74
74
  "college_abbreviation" => "college",
75
75
  "class_year" => "class",
@@ -110,6 +110,7 @@ private
110
110
 
111
111
  def self.extract_attributes(ldap_response)
112
112
  attributes = {}
113
+ binding.pry
113
114
  nicknames.each do |nickname, ldapname|
114
115
  attribute = extract_attribute(ldap_response, ldapname)
115
116
  attribute = attribute.gsub(/\$/,"\n") #for address
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.6
4
+ version: 1.0.7
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-27 00:00:00.000000000 Z
11
+ date: 2014-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler