identity_linker 0.0.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,5 +14,5 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "identity_linker"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = IdentityLinker::VERSION
17
- gem.add_dependency('savon', '~> 0.9.14')
17
+ gem.add_dependency('savon', '~> 2.1.0')
18
18
  end
@@ -1,8 +1,9 @@
1
1
  module IdentityLinker
2
- Config = Struct.new(:server_id, :server_secret) do
2
+ Config = Struct.new(:server_id, :server_secret, :wsdl) do
3
3
 
4
4
  def self.default
5
5
  config = new
6
+ config.wsdl = 'https://signin.ccci.org/ws-identity-linking/idlinking?wsdl'
6
7
  config
7
8
  end
8
9
 
@@ -5,36 +5,33 @@ module IdentityLinker
5
5
  class Linker
6
6
  extend Savon::Model
7
7
 
8
- endpoint "https://signin.ccci.org/ws-identity-linking/idlinking"
9
- namespace "http://webservice.linking.idm.ccci.org/"
8
+ #endpoint "https://signin.ccci.org/ws-identity-linking/idlinking"
9
+ #namespace "http://webservice.linking.idm.ccci.org/"
10
10
 
11
11
  attr_reader :server_id, :server_secret
12
12
 
13
+ def self.client
14
+ @client ||= Savon.client(wsdl: IdentityLinker.config.wsdl)
15
+ end
16
+
13
17
  def initialize(server_id = nil, server_secret = nil)
14
18
  @server_id = server_id || IdentityLinker.config.server_id
15
19
  @server_secret = server_secret || IdentityLinker.config.server_secret
16
20
  end
17
21
 
18
22
  def find_linked_identity(id_type, id_value, target)
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)
23
+ response = client.call(:find_linked_identity, message: {
24
+ server_id: server_id,
25
+ server_secret: server_secret,
26
+ identity: {
27
+ id_type: id_type,
28
+ id_value: id_value
29
+ },
30
+ target: target
31
+ })
32
+
33
+ if response.success?
34
+ return response.to_hash[:find_linked_identity_response][:linked_identity]
38
35
  end
39
36
 
40
37
  nil
@@ -45,26 +42,20 @@ module IdentityLinker
45
42
  end
46
43
 
47
44
  def find_linked_identity_with_details(id_type, id_value, target)
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)
45
+ response = client.call(:find_linked_identity_with_details, message: {
46
+ server_id: server_id,
47
+ server_secret: server_secret,
48
+ identity: {
49
+ id_type: id_type,
50
+ id_value: id_value
51
+ },
52
+ target: target
53
+ })
54
+
55
+ if response.success?
56
+ return response.to_hash[:find_linked_identity_with_details_response][:linked_identity]
67
57
  end
58
+
68
59
  nil
69
60
  end
70
61
 
@@ -73,24 +64,17 @@ module IdentityLinker
73
64
  end
74
65
 
75
66
  def find_all_linked_identities(id_type, id_value)
76
- begin
77
- response = client.request(:wsdl, :find_all_linked_identities) do
78
- xml = <<-END
79
- <serverId>#{server_id}</serverId>
80
- <serverSecret>#{server_secret}</serverSecret>
81
- <identity>
82
- <idType>#{id_type}</idType>
83
- <idValue>#{id_value}</idValue>
84
- </identity>
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)
67
+ response = client.call(:find_all_linked_identities, message: {
68
+ server_id: server_id,
69
+ server_secret: server_secret,
70
+ identity: {
71
+ id_type: id_type,
72
+ id_value: id_value
73
+ }
74
+ })
75
+
76
+ if response.success?
77
+ return response.to_hash[:find_all_linked_identities_response][:linked_identity]
94
78
  end
95
79
 
96
80
  nil
@@ -101,24 +85,17 @@ module IdentityLinker
101
85
  end
102
86
 
103
87
  def find_all_linked_identities_with_details(id_type, id_value)
104
- begin
105
- response = client.request(:wsdl, :find_all_linked_identities_with_details) do
106
- xml = <<-END
107
- <serverId>#{server_id}</serverId>
108
- <serverSecret>#{server_secret}</serverSecret>
109
- <identity>
110
- <idType>#{id_type}</idType>
111
- <idValue>#{id_value}</idValue>
112
- </identity>
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)
88
+ response = client.call(:find_all_linked_identities_with_details, message: {
89
+ server_id: server_id,
90
+ server_secret: server_secret,
91
+ identity: {
92
+ id_type: id_type,
93
+ id_value: id_value
94
+ }
95
+ })
96
+
97
+ if response.success?
98
+ return response.to_hash[:find_all_linked_identities_with_details_response][:linked_identity]
122
99
  end
123
100
 
124
101
  nil
@@ -129,25 +106,18 @@ module IdentityLinker
129
106
  end
130
107
 
131
108
  def find_linked_identities_of_type(id_type, id_value, target)
132
- begin
133
- response = client.request(:wsdl, :find_linked_identities_of_type) do
134
- xml = <<-END
135
- <serverId>#{server_id}</serverId>
136
- <serverSecret>#{server_secret}</serverSecret>
137
- <identity>
138
- <idType>#{id_type}</idType>
139
- <idValue>#{id_value}</idValue>
140
- </identity>
141
- <target>#{target}</target>
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)
109
+ response = client.call(:find_linked_identities_of_type, message: {
110
+ server_id: server_id,
111
+ server_secret: server_secret,
112
+ identity: {
113
+ id_type: id_type,
114
+ id_value: id_value
115
+ },
116
+ target: target
117
+ })
118
+
119
+ if response.success?
120
+ return [response.to_hash[:find_linked_identities_of_type_response][:linked_identity]].flatten.compact
151
121
  end
152
122
 
153
123
  nil
@@ -1,3 +1,3 @@
1
1
  module IdentityLinker
2
- VERSION = "0.0.3"
2
+ VERSION = "1.0.0"
3
3
  end
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.3
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-07 00:00:00.000000000 Z
12
+ date: 2013-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.9.14
21
+ version: 2.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 0.9.14
29
+ version: 2.1.0
30
30
  description: Ruby library for accessing Cru's Identity Linking system
31
31
  email:
32
32
  - josh.starcher@gmail.com
@@ -58,18 +58,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
58
  - - ! '>='
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
+ segments:
62
+ - 0
63
+ hash: -11102958888312575
61
64
  required_rubygems_version: !ruby/object:Gem::Requirement
62
65
  none: false
63
66
  requirements:
64
67
  - - ! '>='
65
68
  - !ruby/object:Gem::Version
66
69
  version: '0'
70
+ segments:
71
+ - 0
72
+ hash: -11102958888312575
67
73
  requirements: []
68
74
  rubyforge_project:
69
- rubygems_version: 1.8.24
75
+ rubygems_version: 1.8.23
70
76
  signing_key:
71
77
  specification_version: 3
72
78
  summary: Ruby library for accessing Cru's Identity Linking system
73
79
  test_files:
74
80
  - spec/spec_helper.rb
75
- has_rdoc: