uaeds 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +4 -1
- data/lib/uaeds/eds.rb +35 -6
- data/lib/uaeds/eds_dsml.rb +12 -0
- data/lib/uaeds/eds_json.rb +14 -3
- data/lib/uaeds/version.rb +1 -1
- data/spec/uaeds_spec.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 360c26e4e040f658fcb0bdc374c0a75aa231e571
|
4
|
+
data.tar.gz: 77b9e3273861c6eba3765e8492394151b9c4fb1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faa6d09b2927831efcb6c39cc27d3ec4247fdb26280314dbff86d7091a547793894570aae2b808dcf29800f373e429c084fd975e51aa33833678478bd0e85ade
|
7
|
+
data.tar.gz: 5053b713ee6cce2ee4949841064aad2aa0a1cf706e5cbfbd786bb960206b7175ff0b6d66219e0960abf9e4699cdb6e893f8c36f8cdb03fa347cf46e6b9f71233
|
data/README.md
CHANGED
@@ -15,7 +15,10 @@ You have a choice between `EdsDSML` and `EdsJSON`. The difference is that DSML r
|
|
15
15
|
|
16
16
|
Either way, you need to provide an endpoint, EDS user, and access key for library to use.
|
17
17
|
```ruby
|
18
|
-
|
18
|
+
EdsDSML.eds_user = <user>
|
19
|
+
EdsDSML.eds_key = <key>
|
20
|
+
EdsDSML.eds_endpoint = "https://<endpoint>"
|
21
|
+
eds = EdsDSML.instance
|
19
22
|
person = eds.person_by_netid(<netid>)
|
20
23
|
person.uaid
|
21
24
|
person.uid
|
data/lib/uaeds/eds.rb
CHANGED
@@ -2,15 +2,28 @@
|
|
2
2
|
|
3
3
|
module Uaeds
|
4
4
|
class Eds
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
@@eds_user = nil
|
6
|
+
@@eds_key = nil
|
7
|
+
|
8
|
+
def initialize(url=nil, user=nil, password=nil)
|
9
|
+
if(url == nil)
|
10
|
+
raise ArgumentError, "EDS URL required." unless (self.class.eds_endpoint && self.class.eds_endpoint.strip != "")
|
11
|
+
if(@@eds_user && @@eds_key)
|
12
|
+
@user = @@eds_user
|
13
|
+
@password = @@eds_key
|
14
|
+
end
|
15
|
+
@url = self.class.eds_endpoint
|
16
|
+
else
|
17
|
+
raise ArgumentError, "EDS URL required." unless (url && url.strip != "")
|
18
|
+
if(user && password)
|
19
|
+
@user = user
|
20
|
+
@password = password
|
21
|
+
end
|
22
|
+
@url = url
|
10
23
|
end
|
11
|
-
@url = url
|
12
24
|
end
|
13
25
|
|
26
|
+
|
14
27
|
def person_by_uaid(uaid)
|
15
28
|
return open_person(uaid)
|
16
29
|
end
|
@@ -27,6 +40,22 @@ module Uaeds
|
|
27
40
|
return open_person(identifier)
|
28
41
|
end
|
29
42
|
|
43
|
+
def self.eds_user=(user=nil)
|
44
|
+
@@eds_user = user
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.eds_key=(key=nil)
|
48
|
+
@@eds_key = key
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.eds_user
|
52
|
+
@@eds_user
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.eds_key
|
56
|
+
@@eds_key
|
57
|
+
end
|
58
|
+
|
30
59
|
private
|
31
60
|
|
32
61
|
def open_persion(idenfifier)
|
data/lib/uaeds/eds_dsml.rb
CHANGED
@@ -3,9 +3,21 @@ require 'open-uri'
|
|
3
3
|
require 'nokogiri'
|
4
4
|
require 'uaeds/eds'
|
5
5
|
require 'uaeds/dsml_person'
|
6
|
+
require 'singleton'
|
6
7
|
|
7
8
|
module Uaeds
|
8
9
|
class EdsDSML < Eds
|
10
|
+
include Singleton
|
11
|
+
|
12
|
+
@@eds_dsml_endpoint = nil
|
13
|
+
|
14
|
+
def self.eds_endpoint=(endpoint=nil)
|
15
|
+
@@eds_dsml_endpoint = endpoint
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.eds_endpoint
|
19
|
+
@@eds_dsml_endpoint
|
20
|
+
end
|
9
21
|
|
10
22
|
private
|
11
23
|
|
data/lib/uaeds/eds_json.rb
CHANGED
@@ -3,11 +3,14 @@ require 'open-uri'
|
|
3
3
|
require 'json'
|
4
4
|
require 'uaeds/eds'
|
5
5
|
require 'uaeds/json_person'
|
6
|
-
|
6
|
+
require 'singleton'
|
7
7
|
|
8
8
|
module Uaeds
|
9
9
|
class EdsJSON < Eds
|
10
|
-
|
10
|
+
include Singleton
|
11
|
+
|
12
|
+
@@eds_json_endpoint = nil
|
13
|
+
|
11
14
|
def person_by_uaid(uaid)
|
12
15
|
return open_person('uaId', uaid)
|
13
16
|
end
|
@@ -23,7 +26,15 @@ module Uaeds
|
|
23
26
|
def person(identifier)
|
24
27
|
return open_person(nil, identifier)
|
25
28
|
end
|
26
|
-
|
29
|
+
|
30
|
+
def self.eds_endpoint=(endpoint=nil)
|
31
|
+
@@eds_json_endpoint = endpoint
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.eds_endpoint
|
35
|
+
@@eds_json_endpoint
|
36
|
+
end
|
37
|
+
|
27
38
|
private
|
28
39
|
|
29
40
|
def open_person(attribute=nil, value)
|
data/lib/uaeds/version.rb
CHANGED
data/spec/uaeds_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'uaeds/eds'
|
1
2
|
require 'uaeds/eds_dsml'
|
2
3
|
require 'uaeds/eds_json'
|
3
4
|
require 'highline/import'
|
@@ -74,13 +75,18 @@ module Uaeds
|
|
74
75
|
expect(eds_json_ep).not_to be_empty
|
75
76
|
end
|
76
77
|
|
78
|
+
Eds.eds_user = eds_user
|
79
|
+
Eds.eds_key = eds_key
|
80
|
+
EdsDSML.eds_endpoint = "https://#{eds_dsml_ep}"
|
81
|
+
EdsJSON.eds_endpoint = "https://#{eds_json_ep}"
|
82
|
+
|
77
83
|
end
|
78
84
|
|
79
85
|
|
80
86
|
describe 'EdsDSML and EdsJSON retrieve the same results' do
|
81
87
|
|
82
|
-
eds0 = EdsDSML.
|
83
|
-
eds1 = EdsJSON.
|
88
|
+
eds0 = EdsDSML.instance
|
89
|
+
eds1 = EdsJSON.instance
|
84
90
|
|
85
91
|
describe 'EdsDSML and EdsJSON should match when retrieved by NetId' do
|
86
92
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uaeds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dgsan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|