postini 0.0.1
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.
- data/History.txt +8 -0
- data/License.txt +29 -0
- data/Manifest.txt +42 -0
- data/PostInstall.txt +7 -0
- data/README.txt +62 -0
- data/Rakefile +4 -0
- data/config/hoe.rb +76 -0
- data/config/requirements.rb +15 -0
- data/lib/postini/api/automatedbatch/AutomatedBatch.rb +1244 -0
- data/lib/postini/api/automatedbatch/AutomatedBatchDriver.rb +216 -0
- data/lib/postini/api/automatedbatch/AutomatedBatchMappingRegistry.rb +1883 -0
- data/lib/postini/api/automatedbatch/AutomatedBatchServiceClient.rb +523 -0
- data/lib/postini/api/endpointresolver/EndpointResolver.rb +121 -0
- data/lib/postini/api/endpointresolver/EndpointResolverDriver.rb +51 -0
- data/lib/postini/api/endpointresolver/EndpointResolverMappingRegistry.rb +268 -0
- data/lib/postini/api/endpointresolver/EndpointResolverServiceClient.rb +38 -0
- data/lib/postini/api.rb +8 -0
- data/lib/postini/domain.rb +65 -0
- data/lib/postini/user.rb +125 -0
- data/lib/postini/version.rb +9 -0
- data/lib/postini.rb +100 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/spec/domain_spec.rb +36 -0
- data/spec/postini_spec.rb +30 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/user_spec.rb +12 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- data/tasks/website.rake +17 -0
- data/vendor/automatedbatch.wsdl +1721 -0
- data/vendor/endpointresolver.wsdl +214 -0
- data/website/index.html +88 -0
- data/website/index.txt +60 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.html.erb +55 -0
- metadata +117 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/EndpointResolver.rb'
|
|
2
|
+
require File.dirname(__FILE__) + '/EndpointResolverMappingRegistry.rb'
|
|
3
|
+
require 'soap/rpc/driver'
|
|
4
|
+
|
|
5
|
+
module Postini::API::EndpointResolver #:nodoc: all
|
|
6
|
+
|
|
7
|
+
class EndpointResolverPort < ::SOAP::RPC::Driver
|
|
8
|
+
DefaultEndpointUrl = "https://api-meta.postini.com/api2/endpointresolver"
|
|
9
|
+
|
|
10
|
+
Methods = [
|
|
11
|
+
[ "",
|
|
12
|
+
"getServiceEndpoint",
|
|
13
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://postini.com/PSTN/SOAPAPI/v2/endpointresolver", "GetServiceEndpoint"]],
|
|
14
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://postini.com/PSTN/SOAPAPI/v2/endpointresolver", "GetServiceEndpointResponse"]] ],
|
|
15
|
+
{ :request_style => :document, :request_use => :literal,
|
|
16
|
+
:response_style => :document, :response_use => :literal,
|
|
17
|
+
:faults => {"Postini::API::EndpointResolver::UnknownInternalException"=>{:use=>"literal", :namespace=>nil, :name=>"UnknownInternalException", :encodingstyle=>"document", :ns=>"http://postini.com/PSTN/SOAPAPI/v2/endpointresolver"}, "Postini::API::EndpointResolver::AdminBlockException"=>{:use=>"literal", :namespace=>nil, :name=>"AdminBlockException", :encodingstyle=>"document", :ns=>"http://postini.com/PSTN/SOAPAPI/v2/endpointresolver"}, "Postini::API::EndpointResolver::MissingElementException"=>{:use=>"literal", :namespace=>nil, :name=>"MissingElementException", :encodingstyle=>"document", :ns=>"http://postini.com/PSTN/SOAPAPI/v2/endpointresolver"}, "Postini::API::EndpointResolver::InvalidValueException"=>{:use=>"literal", :namespace=>nil, :name=>"InvalidValueException", :encodingstyle=>"document", :ns=>"http://postini.com/PSTN/SOAPAPI/v2/endpointresolver"}, "Postini::API::EndpointResolver::UnknownEmailException"=>{:use=>"literal", :namespace=>nil, :name=>"UnknownEmailException", :encodingstyle=>"document", :ns=>"http://postini.com/PSTN/SOAPAPI/v2/endpointresolver"}, "Postini::API::EndpointResolver::MalformedKeyException"=>{:use=>"literal", :namespace=>nil, :name=>"MalformedKeyException", :encodingstyle=>"document", :ns=>"http://postini.com/PSTN/SOAPAPI/v2/endpointresolver"}, "Postini::API::EndpointResolver::InternalException"=>{:use=>"literal", :namespace=>nil, :name=>"InternalException", :encodingstyle=>"document", :ns=>"http://postini.com/PSTN/SOAPAPI/v2/endpointresolver"}, "Postini::API::EndpointResolver::NoSuchKeyException"=>{:use=>"literal", :namespace=>nil, :name=>"NoSuchKeyException", :encodingstyle=>"document", :ns=>"http://postini.com/PSTN/SOAPAPI/v2/endpointresolver"}} }
|
|
18
|
+
]
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
def initialize(endpoint_url = nil)
|
|
22
|
+
endpoint_url ||= DefaultEndpointUrl
|
|
23
|
+
super(endpoint_url, nil)
|
|
24
|
+
self.mapping_registry = EndpointResolverMappingRegistry::EncodedRegistry
|
|
25
|
+
self.literal_mapping_registry = EndpointResolverMappingRegistry::LiteralRegistry
|
|
26
|
+
init_methods
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def init_methods
|
|
32
|
+
Methods.each do |definitions|
|
|
33
|
+
opt = definitions.last
|
|
34
|
+
if opt[:request_style] == :document
|
|
35
|
+
add_document_operation(*definitions)
|
|
36
|
+
else
|
|
37
|
+
add_rpc_operation(*definitions)
|
|
38
|
+
qname = definitions[0]
|
|
39
|
+
name = definitions[2]
|
|
40
|
+
if qname.name != name and qname.name.capitalize == name.capitalize
|
|
41
|
+
::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
|
|
42
|
+
__send__(name, *arg)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
end
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/EndpointResolver.rb'
|
|
2
|
+
require 'soap/mapping'
|
|
3
|
+
|
|
4
|
+
module Postini; module API; module EndpointResolver
|
|
5
|
+
|
|
6
|
+
module EndpointResolverMappingRegistry
|
|
7
|
+
EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new
|
|
8
|
+
LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new
|
|
9
|
+
NsEndpointresolver = "http://postini.com/PSTN/SOAPAPI/v2/endpointresolver"
|
|
10
|
+
|
|
11
|
+
EncodedRegistry.register(
|
|
12
|
+
:class => Postini::API::EndpointResolver::AdminBlockException,
|
|
13
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "AdminBlockException"),
|
|
14
|
+
:schema_element => [
|
|
15
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
16
|
+
]
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
EncodedRegistry.register(
|
|
20
|
+
:class => Postini::API::EndpointResolver::GetServiceEndpoint,
|
|
21
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "GetServiceEndpoint"),
|
|
22
|
+
:schema_element => [
|
|
23
|
+
["apiKey", ["SOAP::SOAPString", XSD::QName.new(nil, "apiKey")]],
|
|
24
|
+
["email", ["SOAP::SOAPString", XSD::QName.new(nil, "email")]],
|
|
25
|
+
["service", ["Postini::API::EndpointResolver::Service", XSD::QName.new(nil, "service")]]
|
|
26
|
+
]
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
EncodedRegistry.register(
|
|
30
|
+
:class => Postini::API::EndpointResolver::GetServiceEndpointResponse,
|
|
31
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "GetServiceEndpointResponse"),
|
|
32
|
+
:schema_element => [
|
|
33
|
+
["endpointURI", ["SOAP::SOAPString", XSD::QName.new(nil, "EndpointURI")], [0, 1]]
|
|
34
|
+
]
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
EncodedRegistry.register(
|
|
38
|
+
:class => Postini::API::EndpointResolver::InternalException,
|
|
39
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "InternalException"),
|
|
40
|
+
:schema_element => [
|
|
41
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
42
|
+
]
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
EncodedRegistry.register(
|
|
46
|
+
:class => Postini::API::EndpointResolver::InvalidValueException,
|
|
47
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "InvalidValueException"),
|
|
48
|
+
:schema_element => [
|
|
49
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
50
|
+
]
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
EncodedRegistry.register(
|
|
54
|
+
:class => Postini::API::EndpointResolver::MalformedKeyException,
|
|
55
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "MalformedKeyException"),
|
|
56
|
+
:schema_element => [
|
|
57
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
58
|
+
]
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
EncodedRegistry.register(
|
|
62
|
+
:class => Postini::API::EndpointResolver::MissingElementException,
|
|
63
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "MissingElementException"),
|
|
64
|
+
:schema_element => [
|
|
65
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
66
|
+
]
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
EncodedRegistry.register(
|
|
70
|
+
:class => Postini::API::EndpointResolver::NoSuchKeyException,
|
|
71
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "NoSuchKeyException"),
|
|
72
|
+
:schema_element => [
|
|
73
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
74
|
+
]
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
EncodedRegistry.register(
|
|
78
|
+
:class => Postini::API::EndpointResolver::UnknownEmailException,
|
|
79
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "UnknownEmailException"),
|
|
80
|
+
:schema_element => [
|
|
81
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
82
|
+
]
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
EncodedRegistry.register(
|
|
86
|
+
:class => Postini::API::EndpointResolver::UnknownInternalException,
|
|
87
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "UnknownInternalException"),
|
|
88
|
+
:schema_element => [
|
|
89
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
90
|
+
]
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
EncodedRegistry.register(
|
|
94
|
+
:class => Postini::API::EndpointResolver::Service,
|
|
95
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "service")
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
LiteralRegistry.register(
|
|
99
|
+
:class => Postini::API::EndpointResolver::AdminBlockException,
|
|
100
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "AdminBlockException"),
|
|
101
|
+
:schema_element => [
|
|
102
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
103
|
+
]
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
LiteralRegistry.register(
|
|
107
|
+
:class => Postini::API::EndpointResolver::GetServiceEndpoint,
|
|
108
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "GetServiceEndpoint"),
|
|
109
|
+
:schema_element => [
|
|
110
|
+
["apiKey", ["SOAP::SOAPString", XSD::QName.new(nil, "apiKey")]],
|
|
111
|
+
["email", ["SOAP::SOAPString", XSD::QName.new(nil, "email")]],
|
|
112
|
+
["service", ["Postini::API::EndpointResolver::Service", XSD::QName.new(nil, "service")]]
|
|
113
|
+
]
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
LiteralRegistry.register(
|
|
117
|
+
:class => Postini::API::EndpointResolver::GetServiceEndpointResponse,
|
|
118
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "GetServiceEndpointResponse"),
|
|
119
|
+
:schema_element => [
|
|
120
|
+
["endpointURI", ["SOAP::SOAPString", XSD::QName.new(nil, "EndpointURI")], [0, 1]]
|
|
121
|
+
]
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
LiteralRegistry.register(
|
|
125
|
+
:class => Postini::API::EndpointResolver::InternalException,
|
|
126
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "InternalException"),
|
|
127
|
+
:schema_element => [
|
|
128
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
129
|
+
]
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
LiteralRegistry.register(
|
|
133
|
+
:class => Postini::API::EndpointResolver::InvalidValueException,
|
|
134
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "InvalidValueException"),
|
|
135
|
+
:schema_element => [
|
|
136
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
137
|
+
]
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
LiteralRegistry.register(
|
|
141
|
+
:class => Postini::API::EndpointResolver::MalformedKeyException,
|
|
142
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "MalformedKeyException"),
|
|
143
|
+
:schema_element => [
|
|
144
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
145
|
+
]
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
LiteralRegistry.register(
|
|
149
|
+
:class => Postini::API::EndpointResolver::MissingElementException,
|
|
150
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "MissingElementException"),
|
|
151
|
+
:schema_element => [
|
|
152
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
153
|
+
]
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
LiteralRegistry.register(
|
|
157
|
+
:class => Postini::API::EndpointResolver::NoSuchKeyException,
|
|
158
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "NoSuchKeyException"),
|
|
159
|
+
:schema_element => [
|
|
160
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
161
|
+
]
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
LiteralRegistry.register(
|
|
165
|
+
:class => Postini::API::EndpointResolver::UnknownEmailException,
|
|
166
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "UnknownEmailException"),
|
|
167
|
+
:schema_element => [
|
|
168
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
169
|
+
]
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
LiteralRegistry.register(
|
|
173
|
+
:class => Postini::API::EndpointResolver::UnknownInternalException,
|
|
174
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "UnknownInternalException"),
|
|
175
|
+
:schema_element => [
|
|
176
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
177
|
+
]
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
LiteralRegistry.register(
|
|
181
|
+
:class => Postini::API::EndpointResolver::Service,
|
|
182
|
+
:schema_type => XSD::QName.new(NsEndpointresolver, "service")
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
LiteralRegistry.register(
|
|
186
|
+
:class => Postini::API::EndpointResolver::AdminBlockException,
|
|
187
|
+
:schema_name => XSD::QName.new(NsEndpointresolver, "AdminBlockException"),
|
|
188
|
+
:schema_element => [
|
|
189
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
190
|
+
]
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
LiteralRegistry.register(
|
|
194
|
+
:class => Postini::API::EndpointResolver::GetServiceEndpoint,
|
|
195
|
+
:schema_name => XSD::QName.new(NsEndpointresolver, "GetServiceEndpoint"),
|
|
196
|
+
:schema_element => [
|
|
197
|
+
["apiKey", ["SOAP::SOAPString", XSD::QName.new(nil, "apiKey")]],
|
|
198
|
+
["email", ["SOAP::SOAPString", XSD::QName.new(nil, "email")]],
|
|
199
|
+
["service", ["Postini::API::EndpointResolver::Service", XSD::QName.new(nil, "service")]]
|
|
200
|
+
]
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
LiteralRegistry.register(
|
|
204
|
+
:class => Postini::API::EndpointResolver::GetServiceEndpointResponse,
|
|
205
|
+
:schema_name => XSD::QName.new(NsEndpointresolver, "GetServiceEndpointResponse"),
|
|
206
|
+
:schema_element => [
|
|
207
|
+
["endpointURI", ["SOAP::SOAPString", XSD::QName.new(nil, "EndpointURI")], [0, 1]]
|
|
208
|
+
]
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
LiteralRegistry.register(
|
|
212
|
+
:class => Postini::API::EndpointResolver::InternalException,
|
|
213
|
+
:schema_name => XSD::QName.new(NsEndpointresolver, "InternalException"),
|
|
214
|
+
:schema_element => [
|
|
215
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
216
|
+
]
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
LiteralRegistry.register(
|
|
220
|
+
:class => Postini::API::EndpointResolver::InvalidValueException,
|
|
221
|
+
:schema_name => XSD::QName.new(NsEndpointresolver, "InvalidValueException"),
|
|
222
|
+
:schema_element => [
|
|
223
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
224
|
+
]
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
LiteralRegistry.register(
|
|
228
|
+
:class => Postini::API::EndpointResolver::MalformedKeyException,
|
|
229
|
+
:schema_name => XSD::QName.new(NsEndpointresolver, "MalformedKeyException"),
|
|
230
|
+
:schema_element => [
|
|
231
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
232
|
+
]
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
LiteralRegistry.register(
|
|
236
|
+
:class => Postini::API::EndpointResolver::MissingElementException,
|
|
237
|
+
:schema_name => XSD::QName.new(NsEndpointresolver, "MissingElementException"),
|
|
238
|
+
:schema_element => [
|
|
239
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
240
|
+
]
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
LiteralRegistry.register(
|
|
244
|
+
:class => Postini::API::EndpointResolver::NoSuchKeyException,
|
|
245
|
+
:schema_name => XSD::QName.new(NsEndpointresolver, "NoSuchKeyException"),
|
|
246
|
+
:schema_element => [
|
|
247
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
248
|
+
]
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
LiteralRegistry.register(
|
|
252
|
+
:class => Postini::API::EndpointResolver::UnknownEmailException,
|
|
253
|
+
:schema_name => XSD::QName.new(NsEndpointresolver, "UnknownEmailException"),
|
|
254
|
+
:schema_element => [
|
|
255
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
256
|
+
]
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
LiteralRegistry.register(
|
|
260
|
+
:class => Postini::API::EndpointResolver::UnknownInternalException,
|
|
261
|
+
:schema_name => XSD::QName.new(NsEndpointresolver, "UnknownInternalException"),
|
|
262
|
+
:schema_element => [
|
|
263
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(nil, "message")]]
|
|
264
|
+
]
|
|
265
|
+
)
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
end; end; end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require File.dirname(__FILE__) + '/EndpointResolverDriver.rb'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
module Postini::API::EndpointResolver
|
|
6
|
+
|
|
7
|
+
endpoint_url = ARGV.shift
|
|
8
|
+
obj = EndpointResolverPort.new(endpoint_url)
|
|
9
|
+
|
|
10
|
+
# run ruby with -d to see SOAP wiredumps.
|
|
11
|
+
obj.wiredump_dev = STDERR if $DEBUG
|
|
12
|
+
|
|
13
|
+
# SYNOPSIS
|
|
14
|
+
# GetServiceEndpoint(parameters)
|
|
15
|
+
#
|
|
16
|
+
# ARGS
|
|
17
|
+
# parameters GetServiceEndpoint - {http://postini.com/PSTN/SOAPAPI/v2/endpointresolver}GetServiceEndpoint
|
|
18
|
+
#
|
|
19
|
+
# RETURNS
|
|
20
|
+
# parameters GetServiceEndpointResponse - {http://postini.com/PSTN/SOAPAPI/v2/endpointresolver}GetServiceEndpointResponse
|
|
21
|
+
#
|
|
22
|
+
# RAISES
|
|
23
|
+
# fault AdminBlockException - {http://postini.com/PSTN/SOAPAPI/v2/endpointresolver}AdminBlockException
|
|
24
|
+
# fault InternalException - {http://postini.com/PSTN/SOAPAPI/v2/endpointresolver}InternalException
|
|
25
|
+
# fault InvalidValueException - {http://postini.com/PSTN/SOAPAPI/v2/endpointresolver}InvalidValueException
|
|
26
|
+
# fault MalformedKeyException - {http://postini.com/PSTN/SOAPAPI/v2/endpointresolver}MalformedKeyException
|
|
27
|
+
# fault MissingElementException - {http://postini.com/PSTN/SOAPAPI/v2/endpointresolver}MissingElementException
|
|
28
|
+
# fault NoSuchKeyException - {http://postini.com/PSTN/SOAPAPI/v2/endpointresolver}NoSuchKeyException
|
|
29
|
+
# fault UnknownEmailException - {http://postini.com/PSTN/SOAPAPI/v2/endpointresolver}UnknownEmailException
|
|
30
|
+
# fault UnknownInternalException - {http://postini.com/PSTN/SOAPAPI/v2/endpointresolver}UnknownInternalException
|
|
31
|
+
#
|
|
32
|
+
parameters = nil
|
|
33
|
+
puts obj.getServiceEndpoint(parameters)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
end
|
data/lib/postini/api.rb
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require 'postini/api/automatedbatch/AutomatedBatchDriver'
|
|
2
|
+
|
|
3
|
+
module Postini
|
|
4
|
+
|
|
5
|
+
# Represents the functions to perform on a domain
|
|
6
|
+
#
|
|
7
|
+
# TODO: Definitely improve this documentation
|
|
8
|
+
class Domain
|
|
9
|
+
|
|
10
|
+
attr_accessor :id, :name, :org, :substrip
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
|
|
14
|
+
# Return an instance of #Domain with all the attributes populated
|
|
15
|
+
def find( domain )
|
|
16
|
+
remote = Postini::API::AutomatedBatch::AutomatedBatchPort.new( Postini.endpoint_uri )
|
|
17
|
+
request = Postini::API::AutomatedBatch::Displaydomain.new( Postini.auth, domain )
|
|
18
|
+
response = remote.displaydomain( request )
|
|
19
|
+
domain_record = response.domainRecord
|
|
20
|
+
|
|
21
|
+
# Don't give back false positives
|
|
22
|
+
if domain_record.domainid == ""
|
|
23
|
+
return nil
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
new(
|
|
27
|
+
:name => domain_record.domainname,
|
|
28
|
+
:id => domain_record.domainid,
|
|
29
|
+
:org => domain_record.org,
|
|
30
|
+
:substrip => domain_record.substrip
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Setup a new instance with the combination of attributes set
|
|
37
|
+
def initialize( attributes = {} )
|
|
38
|
+
attributes.each_pair do |k,v|
|
|
39
|
+
instance_variable_set "@#{k.to_s}", v
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def new?
|
|
44
|
+
@id.nil?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Create a new domain in the system. Requires +name+ and +org+ to be set.
|
|
48
|
+
# This method will through a SOAP exception if the domain could not be
|
|
49
|
+
# added.
|
|
50
|
+
def create
|
|
51
|
+
return false unless new?
|
|
52
|
+
|
|
53
|
+
# TODO: Add missing validations here
|
|
54
|
+
|
|
55
|
+
remote = Postini::API::AutomatedBatch::AutomatedBatchPort.new( Postini.endpoint_uri )
|
|
56
|
+
args = Postini::API::AutomatedBatch::Adddomainargs.new( @name )
|
|
57
|
+
request = Postini::API::AutomatedBatch::Adddomain.new(
|
|
58
|
+
Postini.auth, @org, args
|
|
59
|
+
)
|
|
60
|
+
remote.adddomain( request )
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
data/lib/postini/user.rb
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
require 'postini/api/automatedbatch/AutomatedBatchDriver'
|
|
2
|
+
|
|
3
|
+
module Postini
|
|
4
|
+
|
|
5
|
+
# This class represents a user in the Postini systems.
|
|
6
|
+
#
|
|
7
|
+
# TODO: Expand documentation
|
|
8
|
+
class User
|
|
9
|
+
|
|
10
|
+
attr_accessor :id, :active, :address, :approved_recipients,
|
|
11
|
+
:approved_senders, :blocked_senders, :create_method, :created_date,
|
|
12
|
+
:filter_adult, :filter_bulk, :filter_getrich, :filter_offers,
|
|
13
|
+
:filter_racial, :initial_password, :junkmail_filter, :lang_locale,
|
|
14
|
+
:lastmod_date, :message_encryption, :message_limit, :message_limited,
|
|
15
|
+
:message_count, :notice_address, :orgid, :password, :timezone,
|
|
16
|
+
:virus_notify, :virus_state, :weblocked, :welcome_count, :wireless_state
|
|
17
|
+
|
|
18
|
+
class << self
|
|
19
|
+
|
|
20
|
+
# Return a new instance of the user
|
|
21
|
+
# TODO: Make this take various options just like ActiveRecord
|
|
22
|
+
def find( user )
|
|
23
|
+
remote = Postini::API::AutomatedBatch::AutomatedBatchPort.new( Postini.endpoint_uri( user ) )
|
|
24
|
+
request = Postini::API::AutomatedBatch::Displayuser.new( Postini.auth, user )
|
|
25
|
+
response = remote.displayuser( request )
|
|
26
|
+
user_record = response.userRecord
|
|
27
|
+
|
|
28
|
+
attributes = {}
|
|
29
|
+
user_record.instance_variables.each do |var|
|
|
30
|
+
attributes[ var.sub('@','').to_sym ] = user_record.instance_variable_get(var)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# fix id
|
|
34
|
+
attributes[:id] = attributes.delete(:user_id)
|
|
35
|
+
|
|
36
|
+
new( attributes )
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Permanently remove the user from Postini
|
|
40
|
+
def destroy( address )
|
|
41
|
+
remote = Postini::API::AutomatedBatch::AutomatedBatchPort.new( Potini.endpoint_uri( address ) )
|
|
42
|
+
request = Postini::API::AutmatedBatch::Deleteuser.new( Postini.auth, address )
|
|
43
|
+
remote.deleteuser( request )
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Setup a new instance with the combination of attributes set
|
|
49
|
+
def initialize( attributes = {} )
|
|
50
|
+
attributes.each_pair do |k,v|
|
|
51
|
+
instance_variable_set "@#{k.to_s}", v
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def new?
|
|
56
|
+
@id.nil?
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Create the new user.
|
|
60
|
+
# TODO: Add support for sending a welcome message and assigning to an org
|
|
61
|
+
def create
|
|
62
|
+
return false unless new?
|
|
63
|
+
|
|
64
|
+
# TODO: Add missing validations here
|
|
65
|
+
|
|
66
|
+
remote = Postini::API::AutomatedBatch::AutomatedBatchPort.new( Postini.endpoint_uri )
|
|
67
|
+
request = Postini::API::AutomatedBatch::Adduser.new( Postini.auth, @address )
|
|
68
|
+
remote.adduser( request )
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Remove the user from Postini
|
|
72
|
+
def destroy
|
|
73
|
+
return false if new?
|
|
74
|
+
|
|
75
|
+
self.class.destroy( @address )
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Return the list of aliases for the mailbox
|
|
79
|
+
def aliases
|
|
80
|
+
if @aliases.nil?
|
|
81
|
+
remote = Postini::API::AutomatedBatch::AutomatedBatchPort.new( Postini.endpoint_uri( @address ) )
|
|
82
|
+
query = Postini::API::AutomatedBatch::ListusersqueryParams.new
|
|
83
|
+
query.aliases = 1
|
|
84
|
+
query.childorgs = 1
|
|
85
|
+
query.primaryqs = @address
|
|
86
|
+
query.targetOrg = @orgid
|
|
87
|
+
request = Postini::API::AutomatedBatch::Listusers.new(
|
|
88
|
+
Postini.auth,
|
|
89
|
+
"ALL",
|
|
90
|
+
query
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
response = remote.listusers( request )
|
|
94
|
+
|
|
95
|
+
@aliases = []
|
|
96
|
+
response.each { |user_record| @aliases << user_record.address }
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
@aliases
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Add an alias to this user
|
|
103
|
+
def add_alias( address )
|
|
104
|
+
@aliases = nil # clear our cache
|
|
105
|
+
remote = Postini::API::AutomatedBatch::AutomatedBatchPort.new( Postini.endpoint_uri( @address ) )
|
|
106
|
+
request = Postini::API::AutomatedBatch::Addalias.new( Postini.auth, @address, address )
|
|
107
|
+
remote.addalias( request )
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Removes the specified alias
|
|
111
|
+
def remove_alias( address )
|
|
112
|
+
@aliases = nil # clear our cache
|
|
113
|
+
remote = Postini::API::AutomatedBatch::AutomatedBatchPort.new( Postini.endpoint_uri( @address ) )
|
|
114
|
+
request = Postini::API::AutomatedBatch::Deletealias.new( Postini.auth, address )
|
|
115
|
+
remote.deletealias( request )
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Removes all aliases from the user
|
|
119
|
+
def clear_aliases
|
|
120
|
+
aliases.each do |address|
|
|
121
|
+
remove_alias( address )
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
data/lib/postini.rb
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
|
3
|
+
|
|
4
|
+
# requirements
|
|
5
|
+
gem 'soap4r'
|
|
6
|
+
require 'postini/user'
|
|
7
|
+
require 'postini/domain'
|
|
8
|
+
|
|
9
|
+
require 'postini/api/endpointresolver/EndpointResolverDriver'
|
|
10
|
+
|
|
11
|
+
# This module just provides access to configuration details used by the rest of
|
|
12
|
+
# the gem.
|
|
13
|
+
#
|
|
14
|
+
# Current configuration values are:
|
|
15
|
+
# * api_key
|
|
16
|
+
# * system_number
|
|
17
|
+
# * username
|
|
18
|
+
# * password
|
|
19
|
+
# * xauth
|
|
20
|
+
#
|
|
21
|
+
# The +api_key+ is your unique API keys obtained from Postini via their Early
|
|
22
|
+
# Access program.
|
|
23
|
+
#
|
|
24
|
+
# Postini.api_key = "your48characterkey"
|
|
25
|
+
#
|
|
26
|
+
# The +system_number+ can be any known system number (known to your account).
|
|
27
|
+
# The gem uses the Postini Endpoint Resolver service, but in some cases needs a
|
|
28
|
+
# known system to work from. Refer to the "Locating Your System" section of the
|
|
29
|
+
# Early Access documentation for more information.
|
|
30
|
+
#
|
|
31
|
+
# Postini.system_number = 8
|
|
32
|
+
#
|
|
33
|
+
# The +username+ parameter is required if:
|
|
34
|
+
# 1. Your org is using POP authentication, and thus needs the admin user's
|
|
35
|
+
# authentication details, not the end-user's.
|
|
36
|
+
# 2. You omit the optional username and password/xauth string for the request
|
|
37
|
+
#
|
|
38
|
+
# Postini.username = 'administrat@jumboinc.com'
|
|
39
|
+
#
|
|
40
|
+
# The +password+ and +xauth+ parameters are mutually exclusive, and cannot be
|
|
41
|
+
# used together. This library will use the +password+ if present, ignoring the
|
|
42
|
+
# +xauth+ string alltogether.
|
|
43
|
+
#
|
|
44
|
+
# Postini.password = 'secret'
|
|
45
|
+
# Postini.xauth = 'format_unknown_to_author'
|
|
46
|
+
#
|
|
47
|
+
module Postini
|
|
48
|
+
|
|
49
|
+
# On the fly class variable, getter and setter generation...
|
|
50
|
+
%w{ api_key system_number username password xauth }.each do |config|
|
|
51
|
+
class_eval <<-EOF
|
|
52
|
+
@@#{config} = nil
|
|
53
|
+
def self.#{config}=( val )
|
|
54
|
+
@@#{config} = val
|
|
55
|
+
end
|
|
56
|
+
def self.#{config}
|
|
57
|
+
@@#{config}
|
|
58
|
+
end
|
|
59
|
+
EOF
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Return the appropriate endpoint URI for the service calls. If +user+ is
|
|
63
|
+
# provided, the endpoint is determined using the Endpoint Resolver Service,
|
|
64
|
+
# otherwise it is contructed from the +system_number+ configuration value.
|
|
65
|
+
def self.endpoint_uri( user = nil, service = :automated_batch )
|
|
66
|
+
raise "System Number not known" if user.nil? && system_number.nil?
|
|
67
|
+
|
|
68
|
+
# Translate the service
|
|
69
|
+
service = case service
|
|
70
|
+
when :automated_batch
|
|
71
|
+
[ Postini::API::EndpointResolver::Service::V2AutomatedBatch, "automatedbatch" ]
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
if user.nil?
|
|
75
|
+
"https://api-s#{system_number}.postini.com/api2/#{service[1]}"
|
|
76
|
+
else
|
|
77
|
+
remote = Postini::API::EndpointResolver::EndpointResolverPort.new
|
|
78
|
+
request = Postini::API::EndpointResolver::GetServiceEndpoint.new(
|
|
79
|
+
Postini.api_key, user, service[0]
|
|
80
|
+
)
|
|
81
|
+
response = remote.getServiceEndpoint( request )
|
|
82
|
+
response.endpointURI
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def self.auth( service = :automated_batch, username = nil, password = nil, xauth = nil )
|
|
87
|
+
username ||= self.username
|
|
88
|
+
password ||= self.password
|
|
89
|
+
if password.nil?
|
|
90
|
+
xauth ||= self.xauth
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
case service
|
|
94
|
+
when :automated_batch
|
|
95
|
+
API::AutomatedBatch::AuthElem.new(
|
|
96
|
+
api_key, username, password, xauth
|
|
97
|
+
)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
data/script/console
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# File: script/console
|
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
|
4
|
+
|
|
5
|
+
libs = " -r irb/completion"
|
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/postini.rb'}"
|
|
9
|
+
puts "Loading postini gem"
|
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|