identity_linker 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/identity_linker/error.rb +15 -0
- data/lib/identity_linker/linker.rb +75 -55
- data/lib/identity_linker/version.rb +1 -1
- metadata +3 -1
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'savon'
|
2
|
+
require 'identity_linker/error'
|
2
3
|
|
3
4
|
module IdentityLinker
|
4
5
|
class Linker
|
@@ -15,21 +16,25 @@ module IdentityLinker
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def find_linked_identity(id_type, id_value, target)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
begin
|
20
|
+
response = client.request(:wsdl, :find_linked_identity) do
|
21
|
+
xml = <<-END
|
22
|
+
<serverId>#{server_id}</serverId>
|
23
|
+
<serverSecret>#{server_secret}</serverSecret>
|
24
|
+
<identity>
|
25
|
+
<idType>#{id_type}</idType>
|
26
|
+
<idValue>#{id_value}</idValue>
|
27
|
+
</identity>
|
28
|
+
<target>#{target}</target>
|
29
|
+
END
|
30
|
+
soap.body = xml
|
31
|
+
end
|
32
|
+
|
33
|
+
if response.success?
|
34
|
+
return response.to_hash[:find_linked_identity_response][:linked_identity]
|
35
|
+
end
|
36
|
+
rescue Savon::SOAP::Fault => e
|
37
|
+
raise Error.new(e)
|
33
38
|
end
|
34
39
|
|
35
40
|
nil
|
@@ -40,23 +45,26 @@ module IdentityLinker
|
|
40
45
|
end
|
41
46
|
|
42
47
|
def find_linked_identity_with_details(id_type, id_value, target)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
begin
|
49
|
+
response = client.request(:wsdl, :find_linked_identity_with_details) do
|
50
|
+
xml = <<-END
|
51
|
+
<serverId>#{server_id}</serverId>
|
52
|
+
<serverSecret>#{server_secret}</serverSecret>
|
53
|
+
<identity>
|
54
|
+
<idType>#{id_type}</idType>
|
55
|
+
<idValue>#{id_value}</idValue>
|
56
|
+
</identity>
|
57
|
+
<target>#{target}</target>
|
58
|
+
END
|
59
|
+
soap.body = xml
|
60
|
+
end
|
61
|
+
|
62
|
+
if response.success?
|
63
|
+
return response.to_hash[:find_linked_identity_with_details_response][:linked_identity]
|
64
|
+
end
|
65
|
+
rescue Savon::SOAP::Fault => e
|
66
|
+
raise Error.new(e)
|
54
67
|
end
|
55
|
-
|
56
|
-
if response.success?
|
57
|
-
return response.to_hash[:find_linked_identity_with_details_response][:linked_identity]
|
58
|
-
end
|
59
|
-
|
60
68
|
nil
|
61
69
|
end
|
62
70
|
|
@@ -65,20 +73,24 @@ module IdentityLinker
|
|
65
73
|
end
|
66
74
|
|
67
75
|
def find_all_linked_identities(id_type, id_value)
|
68
|
-
|
69
|
-
|
76
|
+
begin
|
77
|
+
response = client.request(:wsdl, :find_all_linked_identities) do
|
78
|
+
xml = <<-END
|
70
79
|
<serverId>#{server_id}</serverId>
|
71
80
|
<serverSecret>#{server_secret}</serverSecret>
|
72
81
|
<identity>
|
73
82
|
<idType>#{id_type}</idType>
|
74
83
|
<idValue>#{id_value}</idValue>
|
75
84
|
</identity>
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
85
|
+
END
|
86
|
+
soap.body = xml
|
87
|
+
end
|
88
|
+
|
89
|
+
if response.success?
|
90
|
+
return response.to_hash[:find_all_linked_identities_response][:linked_identity]
|
91
|
+
end
|
92
|
+
rescue Savon::SOAP::Fault => e
|
93
|
+
raise Error.new(e)
|
82
94
|
end
|
83
95
|
|
84
96
|
nil
|
@@ -89,20 +101,24 @@ module IdentityLinker
|
|
89
101
|
end
|
90
102
|
|
91
103
|
def find_all_linked_identities_with_details(id_type, id_value)
|
92
|
-
|
93
|
-
|
104
|
+
begin
|
105
|
+
response = client.request(:wsdl, :find_all_linked_identities_with_details) do
|
106
|
+
xml = <<-END
|
94
107
|
<serverId>#{server_id}</serverId>
|
95
108
|
<serverSecret>#{server_secret}</serverSecret>
|
96
109
|
<identity>
|
97
110
|
<idType>#{id_type}</idType>
|
98
111
|
<idValue>#{id_value}</idValue>
|
99
112
|
</identity>
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
113
|
+
END
|
114
|
+
soap.body = xml
|
115
|
+
end
|
116
|
+
|
117
|
+
if response.success?
|
118
|
+
return response.to_hash[:find_all_linked_identities_with_details_response][:linked_identity]
|
119
|
+
end
|
120
|
+
rescue Savon::SOAP::Fault => e
|
121
|
+
raise Error.new(e)
|
106
122
|
end
|
107
123
|
|
108
124
|
nil
|
@@ -113,8 +129,9 @@ module IdentityLinker
|
|
113
129
|
end
|
114
130
|
|
115
131
|
def find_linked_identities_of_type(id_type, id_value, target)
|
116
|
-
|
117
|
-
|
132
|
+
begin
|
133
|
+
response = client.request(:wsdl, :find_linked_identities_of_type) do
|
134
|
+
xml = <<-END
|
118
135
|
<serverId>#{server_id}</serverId>
|
119
136
|
<serverSecret>#{server_secret}</serverSecret>
|
120
137
|
<identity>
|
@@ -122,12 +139,15 @@ module IdentityLinker
|
|
122
139
|
<idValue>#{id_value}</idValue>
|
123
140
|
</identity>
|
124
141
|
<target>#{target}</target>
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
142
|
+
END
|
143
|
+
soap.body = xml
|
144
|
+
end
|
145
|
+
|
146
|
+
if response.success?
|
147
|
+
return [response.to_hash[:find_linked_identities_of_type_response][:linked_identity]].flatten.compact
|
148
|
+
end
|
149
|
+
rescue Savon::SOAP::Fault => e
|
150
|
+
raise Error.new(e)
|
131
151
|
end
|
132
152
|
|
133
153
|
nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: identity_linker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- identity_linker.gemspec
|
43
43
|
- lib/identity_linker.rb
|
44
44
|
- lib/identity_linker/config.rb
|
45
|
+
- lib/identity_linker/error.rb
|
45
46
|
- lib/identity_linker/linker.rb
|
46
47
|
- lib/identity_linker/version.rb
|
47
48
|
- spec/spec_helper.rb
|
@@ -71,3 +72,4 @@ specification_version: 3
|
|
71
72
|
summary: Ruby library for accessing Cru's Identity Linking system
|
72
73
|
test_files:
|
73
74
|
- spec/spec_helper.rb
|
75
|
+
has_rdoc:
|