n8-adcenter-client 0.1.0 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +23 -0
- data/.gemtest +0 -0
- data/History.txt +12 -0
- data/Manifest.txt +44 -0
- data/README.txt +82 -0
- data/Rakefile.rb +30 -0
- data/TODO +12 -0
- data/VERSION +1 -0
- data/bin/get_adcenter_account_info.rb +45 -0
- data/devel/gen_wsdl_drivers.rb +26 -0
- data/devel/wsdl.yml +19 -0
- data/lib/AdministrationServiceDriver.rb +59 -0
- data/lib/AdministrationServiceMappingRegistry.rb +153 -0
- data/lib/CampaignManagementServiceDriver.rb +699 -0
- data/lib/CampaignManagementServiceMappingRegistry.rb +5140 -0
- data/lib/CustomerBillingServiceDriver.rb +107 -0
- data/lib/CustomerBillingServiceMappingRegistry.rb +698 -0
- data/lib/CustomerManagementServiceDriver.rb +219 -0
- data/lib/CustomerManagementServiceMappingRegistry.rb +1703 -0
- data/lib/ReportingServiceDriver.rb +59 -0
- data/lib/ReportingServiceMappingRegistry.rb +3410 -0
- data/lib/SecureDataManagementServiceDriver.rb +51 -0
- data/lib/SecureDataManagementServiceMappingRegistry.rb +380 -0
- data/lib/adcenter_client.rb +112 -0
- data/lib/adcenter_service.rb +74 -0
- data/lib/adcenter_wrapper_entities.rb +8185 -0
- data/lib/administration_service.rb +9 -0
- data/lib/campaign_management_service.rb +7 -0
- data/lib/custom_assertions.rb +5 -0
- data/lib/custom_exceptions.rb +1 -0
- data/lib/customer_billing_service.rb +7 -0
- data/lib/customer_management_service.rb +9 -0
- data/lib/defaultDriver.rb +67 -0
- data/lib/defaultMappingRegistry.rb +529 -0
- data/lib/notification_management.rb +7 -0
- data/lib/reporting_service.rb +7 -0
- data/lib/secure_data_management_service.rb +7 -0
- data/tasks/doctask.rake +9 -0
- data/tasks/testtask.rake +13 -0
- data/test/adcenter_client_test.rb +14 -0
- data/test/administration_service_test.rb +19 -0
- data/test/customer_management_service_test.rb +20 -0
- data/test/report_service_test.rb +44 -0
- data/test/test_credentials.yml-sample +7 -0
- data/test/test_helper.rb +9 -0
- metadata +99 -11
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'adcenter_wrapper_entities'
|
2
|
+
require 'SecureDataManagementServiceMappingRegistry.rb'
|
3
|
+
require 'soap/rpc/driver'
|
4
|
+
|
5
|
+
module AdCenterWrapper
|
6
|
+
|
7
|
+
class ISecureDataManagementService < ::SOAP::RPC::Driver
|
8
|
+
DefaultEndpointUrl = "https://securityservices.adcenterapi.microsoft.com/Api/SecureDataManagement/v7/SecureDataManagementService.svc"
|
9
|
+
|
10
|
+
Methods = [
|
11
|
+
[ "AddPaymentMethod",
|
12
|
+
"addPaymentMethod",
|
13
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "https://adcenter.microsoft.com/api/securedatamanagement", "AddPaymentMethodRequest"]],
|
14
|
+
["out", "parameters", ["::SOAP::SOAPElement", "https://adcenter.microsoft.com/api/securedatamanagement", "AddPaymentMethodResponse"]] ],
|
15
|
+
{ :request_style => :document, :request_use => :literal,
|
16
|
+
:response_style => :document, :response_use => :literal,
|
17
|
+
:faults => {"AdCenterWrapper::ApiFaultFault"=>{:namespace=>nil, :encodingstyle=>"document", :name=>"ApiFaultFault", :use=>"literal", :ns=>"https://adcenter.microsoft.com/api/securedatamanagement"}, "AdCenterWrapper::AdApiFaultDetailFault"=>{:namespace=>nil, :encodingstyle=>"document", :name=>"AdApiFaultDetailFault", :use=>"literal", :ns=>"https://adcenter.microsoft.com/api/securedatamanagement"}} }
|
18
|
+
]
|
19
|
+
]
|
20
|
+
|
21
|
+
def initialize(endpoint_url = nil)
|
22
|
+
endpoint_url ||= DefaultEndpointUrl
|
23
|
+
super(endpoint_url, nil)
|
24
|
+
self.mapping_registry = SecureDataManagementServiceMappingRegistry::EncodedRegistry
|
25
|
+
self.literal_mapping_registry = SecureDataManagementServiceMappingRegistry::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,380 @@
|
|
1
|
+
require 'adcenter_wrapper_entities'
|
2
|
+
require 'soap/mapping'
|
3
|
+
|
4
|
+
module AdCenterWrapper
|
5
|
+
|
6
|
+
module SecureDataManagementServiceMappingRegistry
|
7
|
+
EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new
|
8
|
+
LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new
|
9
|
+
NsAdapiMicrosoftCom = "https://adapi.microsoft.com"
|
10
|
+
NsC_Exception = "https://adcenter.microsoft.com/api/customermanagement/Exception"
|
11
|
+
NsEntities = "https://adcenter.microsoft.com/api/customermanagement/Entities"
|
12
|
+
NsSecuredatamanagement = "https://adcenter.microsoft.com/api/securedatamanagement"
|
13
|
+
|
14
|
+
EncodedRegistry.register(
|
15
|
+
:class => AdCenterWrapper::PaymentMethod,
|
16
|
+
:schema_type => XSD::QName.new(NsEntities, "PaymentMethod"),
|
17
|
+
:schema_element => [
|
18
|
+
["address", ["AdCenterWrapper::Address", XSD::QName.new(NsEntities, "Address")], [0, 1]],
|
19
|
+
["customerId", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "CustomerId")], [0, 1]],
|
20
|
+
["id", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "Id")], [0, 1]],
|
21
|
+
["timeStamp", ["SOAP::SOAPBase64", XSD::QName.new(NsEntities, "TimeStamp")], [0, 1]]
|
22
|
+
]
|
23
|
+
)
|
24
|
+
|
25
|
+
EncodedRegistry.register(
|
26
|
+
:class => AdCenterWrapper::Address,
|
27
|
+
:schema_type => XSD::QName.new(NsEntities, "Address"),
|
28
|
+
:schema_element => [
|
29
|
+
["city", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "City")], [0, 1]],
|
30
|
+
["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "CountryCode")], [0, 1]],
|
31
|
+
["id", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "Id")], [0, 1]],
|
32
|
+
["line1", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line1")], [0, 1]],
|
33
|
+
["line2", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line2")], [0, 1]],
|
34
|
+
["line3", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line3")], [0, 1]],
|
35
|
+
["line4", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line4")], [0, 1]],
|
36
|
+
["postalCode", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "PostalCode")], [0, 1]],
|
37
|
+
["stateOrProvince", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "StateOrProvince")], [0, 1]],
|
38
|
+
["timeStamp", ["SOAP::SOAPBase64", XSD::QName.new(NsEntities, "TimeStamp")], [0, 1]]
|
39
|
+
]
|
40
|
+
)
|
41
|
+
|
42
|
+
EncodedRegistry.register(
|
43
|
+
:class => AdCenterWrapper::CreditCardPaymentMethod,
|
44
|
+
:schema_type => XSD::QName.new(NsEntities, "CreditCardPaymentMethod"),
|
45
|
+
:schema_basetype => XSD::QName.new(NsEntities, "PaymentMethod"),
|
46
|
+
:schema_element => [
|
47
|
+
["address", ["AdCenterWrapper::Address", XSD::QName.new(NsEntities, "Address")], [0, 1]],
|
48
|
+
["customerId", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "CustomerId")], [0, 1]],
|
49
|
+
["id", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "Id")], [0, 1]],
|
50
|
+
["timeStamp", ["SOAP::SOAPBase64", XSD::QName.new(NsEntities, "TimeStamp")], [0, 1]],
|
51
|
+
["expirationDate", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "ExpirationDate")], [0, 1]],
|
52
|
+
["firstName", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "FirstName")], [0, 1]],
|
53
|
+
["lastName", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "LastName")], [0, 1]],
|
54
|
+
["middleInitial", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "MiddleInitial")], [0, 1]],
|
55
|
+
["number", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Number")], [0, 1]],
|
56
|
+
["securityCode", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "SecurityCode")], [0, 1]],
|
57
|
+
["type", ["AdCenterWrapper::CreditCardType", XSD::QName.new(NsEntities, "Type")], [0, 1]]
|
58
|
+
]
|
59
|
+
)
|
60
|
+
|
61
|
+
EncodedRegistry.register(
|
62
|
+
:class => AdCenterWrapper::AdApiFaultDetail,
|
63
|
+
:schema_type => XSD::QName.new(NsAdapiMicrosoftCom, "AdApiFaultDetail"),
|
64
|
+
:schema_basetype => XSD::QName.new(NsAdapiMicrosoftCom, "ApplicationFault"),
|
65
|
+
:schema_element => [
|
66
|
+
["trackingId", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "TrackingId")], [0, 1]],
|
67
|
+
["errors", ["AdCenterWrapper::ArrayOfAdApiError", XSD::QName.new(NsAdapiMicrosoftCom, "Errors")], [0, 1]]
|
68
|
+
]
|
69
|
+
)
|
70
|
+
|
71
|
+
EncodedRegistry.register(
|
72
|
+
:class => AdCenterWrapper::ApplicationFault,
|
73
|
+
:schema_type => XSD::QName.new(NsAdapiMicrosoftCom, "ApplicationFault"),
|
74
|
+
:schema_element => [
|
75
|
+
["trackingId", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "TrackingId")], [0, 1]]
|
76
|
+
]
|
77
|
+
)
|
78
|
+
|
79
|
+
EncodedRegistry.register(
|
80
|
+
:class => AdCenterWrapper::ArrayOfAdApiError,
|
81
|
+
:schema_type => XSD::QName.new(NsAdapiMicrosoftCom, "ArrayOfAdApiError"),
|
82
|
+
:schema_element => [
|
83
|
+
["adApiError", ["AdCenterWrapper::AdApiError[]", XSD::QName.new(NsAdapiMicrosoftCom, "AdApiError")], [0, nil]]
|
84
|
+
]
|
85
|
+
)
|
86
|
+
|
87
|
+
EncodedRegistry.register(
|
88
|
+
:class => AdCenterWrapper::AdApiError,
|
89
|
+
:schema_type => XSD::QName.new(NsAdapiMicrosoftCom, "AdApiError"),
|
90
|
+
:schema_element => [
|
91
|
+
["code", ["SOAP::SOAPInt", XSD::QName.new(NsAdapiMicrosoftCom, "Code")], [0, 1]],
|
92
|
+
["detail", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "Detail")], [0, 1]],
|
93
|
+
["errorCode", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "ErrorCode")], [0, 1]],
|
94
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "Message")], [0, 1]]
|
95
|
+
]
|
96
|
+
)
|
97
|
+
|
98
|
+
EncodedRegistry.register(
|
99
|
+
:class => AdCenterWrapper::ApiFault,
|
100
|
+
:schema_type => XSD::QName.new(NsC_Exception, "ApiFault"),
|
101
|
+
:schema_basetype => XSD::QName.new(NsAdapiMicrosoftCom, "ApplicationFault"),
|
102
|
+
:schema_element => [
|
103
|
+
["trackingId", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "TrackingId")], [0, 1]],
|
104
|
+
["operationErrors", ["AdCenterWrapper::ArrayOfOperationError", XSD::QName.new(NsC_Exception, "OperationErrors")], [0, 1]]
|
105
|
+
]
|
106
|
+
)
|
107
|
+
|
108
|
+
EncodedRegistry.register(
|
109
|
+
:class => AdCenterWrapper::ArrayOfOperationError,
|
110
|
+
:schema_type => XSD::QName.new(NsC_Exception, "ArrayOfOperationError"),
|
111
|
+
:schema_element => [
|
112
|
+
["operationError", ["AdCenterWrapper::OperationError[]", XSD::QName.new(NsC_Exception, "OperationError")], [0, nil]]
|
113
|
+
]
|
114
|
+
)
|
115
|
+
|
116
|
+
EncodedRegistry.register(
|
117
|
+
:class => AdCenterWrapper::OperationError,
|
118
|
+
:schema_type => XSD::QName.new(NsC_Exception, "OperationError"),
|
119
|
+
:schema_element => [
|
120
|
+
["code", ["SOAP::SOAPInt", XSD::QName.new(NsC_Exception, "Code")], [0, 1]],
|
121
|
+
["details", ["SOAP::SOAPString", XSD::QName.new(NsC_Exception, "Details")], [0, 1]],
|
122
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(NsC_Exception, "Message")], [0, 1]]
|
123
|
+
]
|
124
|
+
)
|
125
|
+
|
126
|
+
EncodedRegistry.register(
|
127
|
+
:class => AdCenterWrapper::CreditCardType,
|
128
|
+
:schema_type => XSD::QName.new(NsEntities, "CreditCardType")
|
129
|
+
)
|
130
|
+
|
131
|
+
LiteralRegistry.register(
|
132
|
+
:class => AdCenterWrapper::PaymentMethod,
|
133
|
+
:schema_type => XSD::QName.new(NsEntities, "PaymentMethod"),
|
134
|
+
:schema_element => [
|
135
|
+
["address", ["AdCenterWrapper::Address", XSD::QName.new(NsEntities, "Address")], [0, 1]],
|
136
|
+
["customerId", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "CustomerId")], [0, 1]],
|
137
|
+
["id", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "Id")], [0, 1]],
|
138
|
+
["timeStamp", ["SOAP::SOAPBase64", XSD::QName.new(NsEntities, "TimeStamp")], [0, 1]]
|
139
|
+
]
|
140
|
+
)
|
141
|
+
|
142
|
+
LiteralRegistry.register(
|
143
|
+
:class => AdCenterWrapper::Address,
|
144
|
+
:schema_type => XSD::QName.new(NsEntities, "Address"),
|
145
|
+
:schema_element => [
|
146
|
+
["city", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "City")], [0, 1]],
|
147
|
+
["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "CountryCode")], [0, 1]],
|
148
|
+
["id", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "Id")], [0, 1]],
|
149
|
+
["line1", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line1")], [0, 1]],
|
150
|
+
["line2", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line2")], [0, 1]],
|
151
|
+
["line3", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line3")], [0, 1]],
|
152
|
+
["line4", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line4")], [0, 1]],
|
153
|
+
["postalCode", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "PostalCode")], [0, 1]],
|
154
|
+
["stateOrProvince", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "StateOrProvince")], [0, 1]],
|
155
|
+
["timeStamp", ["SOAP::SOAPBase64", XSD::QName.new(NsEntities, "TimeStamp")], [0, 1]]
|
156
|
+
]
|
157
|
+
)
|
158
|
+
|
159
|
+
LiteralRegistry.register(
|
160
|
+
:class => AdCenterWrapper::CreditCardPaymentMethod,
|
161
|
+
:schema_type => XSD::QName.new(NsEntities, "CreditCardPaymentMethod"),
|
162
|
+
:schema_basetype => XSD::QName.new(NsEntities, "PaymentMethod"),
|
163
|
+
:schema_element => [
|
164
|
+
["address", ["AdCenterWrapper::Address", XSD::QName.new(NsEntities, "Address")], [0, 1]],
|
165
|
+
["customerId", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "CustomerId")], [0, 1]],
|
166
|
+
["id", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "Id")], [0, 1]],
|
167
|
+
["timeStamp", ["SOAP::SOAPBase64", XSD::QName.new(NsEntities, "TimeStamp")], [0, 1]],
|
168
|
+
["expirationDate", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "ExpirationDate")], [0, 1]],
|
169
|
+
["firstName", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "FirstName")], [0, 1]],
|
170
|
+
["lastName", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "LastName")], [0, 1]],
|
171
|
+
["middleInitial", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "MiddleInitial")], [0, 1]],
|
172
|
+
["number", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Number")], [0, 1]],
|
173
|
+
["securityCode", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "SecurityCode")], [0, 1]],
|
174
|
+
["type", ["AdCenterWrapper::CreditCardType", XSD::QName.new(NsEntities, "Type")], [0, 1]]
|
175
|
+
]
|
176
|
+
)
|
177
|
+
|
178
|
+
LiteralRegistry.register(
|
179
|
+
:class => AdCenterWrapper::AdApiFaultDetail,
|
180
|
+
:schema_type => XSD::QName.new(NsAdapiMicrosoftCom, "AdApiFaultDetail"),
|
181
|
+
:schema_basetype => XSD::QName.new(NsAdapiMicrosoftCom, "ApplicationFault"),
|
182
|
+
:schema_element => [
|
183
|
+
["trackingId", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "TrackingId")], [0, 1]],
|
184
|
+
["errors", ["AdCenterWrapper::ArrayOfAdApiError", XSD::QName.new(NsAdapiMicrosoftCom, "Errors")], [0, 1]]
|
185
|
+
]
|
186
|
+
)
|
187
|
+
|
188
|
+
LiteralRegistry.register(
|
189
|
+
:class => AdCenterWrapper::ApplicationFault,
|
190
|
+
:schema_type => XSD::QName.new(NsAdapiMicrosoftCom, "ApplicationFault"),
|
191
|
+
:schema_element => [
|
192
|
+
["trackingId", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "TrackingId")], [0, 1]]
|
193
|
+
]
|
194
|
+
)
|
195
|
+
|
196
|
+
LiteralRegistry.register(
|
197
|
+
:class => AdCenterWrapper::ArrayOfAdApiError,
|
198
|
+
:schema_type => XSD::QName.new(NsAdapiMicrosoftCom, "ArrayOfAdApiError"),
|
199
|
+
:schema_element => [
|
200
|
+
["adApiError", ["AdCenterWrapper::AdApiError[]", XSD::QName.new(NsAdapiMicrosoftCom, "AdApiError")], [0, nil]]
|
201
|
+
]
|
202
|
+
)
|
203
|
+
|
204
|
+
LiteralRegistry.register(
|
205
|
+
:class => AdCenterWrapper::AdApiError,
|
206
|
+
:schema_type => XSD::QName.new(NsAdapiMicrosoftCom, "AdApiError"),
|
207
|
+
:schema_element => [
|
208
|
+
["code", ["SOAP::SOAPInt", XSD::QName.new(NsAdapiMicrosoftCom, "Code")], [0, 1]],
|
209
|
+
["detail", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "Detail")], [0, 1]],
|
210
|
+
["errorCode", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "ErrorCode")], [0, 1]],
|
211
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "Message")], [0, 1]]
|
212
|
+
]
|
213
|
+
)
|
214
|
+
|
215
|
+
LiteralRegistry.register(
|
216
|
+
:class => AdCenterWrapper::ApiFault,
|
217
|
+
:schema_type => XSD::QName.new(NsC_Exception, "ApiFault"),
|
218
|
+
:schema_basetype => XSD::QName.new(NsAdapiMicrosoftCom, "ApplicationFault"),
|
219
|
+
:schema_element => [
|
220
|
+
["trackingId", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "TrackingId")], [0, 1]],
|
221
|
+
["operationErrors", ["AdCenterWrapper::ArrayOfOperationError", XSD::QName.new(NsC_Exception, "OperationErrors")], [0, 1]]
|
222
|
+
]
|
223
|
+
)
|
224
|
+
|
225
|
+
LiteralRegistry.register(
|
226
|
+
:class => AdCenterWrapper::ArrayOfOperationError,
|
227
|
+
:schema_type => XSD::QName.new(NsC_Exception, "ArrayOfOperationError"),
|
228
|
+
:schema_element => [
|
229
|
+
["operationError", ["AdCenterWrapper::OperationError[]", XSD::QName.new(NsC_Exception, "OperationError")], [0, nil]]
|
230
|
+
]
|
231
|
+
)
|
232
|
+
|
233
|
+
LiteralRegistry.register(
|
234
|
+
:class => AdCenterWrapper::OperationError,
|
235
|
+
:schema_type => XSD::QName.new(NsC_Exception, "OperationError"),
|
236
|
+
:schema_element => [
|
237
|
+
["code", ["SOAP::SOAPInt", XSD::QName.new(NsC_Exception, "Code")], [0, 1]],
|
238
|
+
["details", ["SOAP::SOAPString", XSD::QName.new(NsC_Exception, "Details")], [0, 1]],
|
239
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(NsC_Exception, "Message")], [0, 1]]
|
240
|
+
]
|
241
|
+
)
|
242
|
+
|
243
|
+
LiteralRegistry.register(
|
244
|
+
:class => AdCenterWrapper::CreditCardType,
|
245
|
+
:schema_type => XSD::QName.new(NsEntities, "CreditCardType")
|
246
|
+
)
|
247
|
+
|
248
|
+
LiteralRegistry.register(
|
249
|
+
:class => AdCenterWrapper::AddPaymentMethodRequest,
|
250
|
+
:schema_name => XSD::QName.new(NsSecuredatamanagement, "AddPaymentMethodRequest"),
|
251
|
+
:schema_element => [
|
252
|
+
["paymentMethod", ["AdCenterWrapper::PaymentMethod", XSD::QName.new(NsSecuredatamanagement, "PaymentMethod")], [0, 1]]
|
253
|
+
]
|
254
|
+
)
|
255
|
+
|
256
|
+
LiteralRegistry.register(
|
257
|
+
:class => AdCenterWrapper::AddPaymentMethodResponse,
|
258
|
+
:schema_name => XSD::QName.new(NsSecuredatamanagement, "AddPaymentMethodResponse"),
|
259
|
+
:schema_element => [
|
260
|
+
["paymentMethodId", ["SOAP::SOAPLong", XSD::QName.new(NsSecuredatamanagement, "PaymentMethodId")], [0, 1]]
|
261
|
+
]
|
262
|
+
)
|
263
|
+
|
264
|
+
LiteralRegistry.register(
|
265
|
+
:class => AdCenterWrapper::PaymentMethod,
|
266
|
+
:schema_name => XSD::QName.new(NsEntities, "PaymentMethod"),
|
267
|
+
:schema_element => [
|
268
|
+
["address", ["AdCenterWrapper::Address", XSD::QName.new(NsEntities, "Address")], [0, 1]],
|
269
|
+
["customerId", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "CustomerId")], [0, 1]],
|
270
|
+
["id", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "Id")], [0, 1]],
|
271
|
+
["timeStamp", ["SOAP::SOAPBase64", XSD::QName.new(NsEntities, "TimeStamp")], [0, 1]]
|
272
|
+
]
|
273
|
+
)
|
274
|
+
|
275
|
+
LiteralRegistry.register(
|
276
|
+
:class => AdCenterWrapper::Address,
|
277
|
+
:schema_name => XSD::QName.new(NsEntities, "Address"),
|
278
|
+
:schema_element => [
|
279
|
+
["city", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "City")], [0, 1]],
|
280
|
+
["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "CountryCode")], [0, 1]],
|
281
|
+
["id", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "Id")], [0, 1]],
|
282
|
+
["line1", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line1")], [0, 1]],
|
283
|
+
["line2", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line2")], [0, 1]],
|
284
|
+
["line3", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line3")], [0, 1]],
|
285
|
+
["line4", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Line4")], [0, 1]],
|
286
|
+
["postalCode", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "PostalCode")], [0, 1]],
|
287
|
+
["stateOrProvince", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "StateOrProvince")], [0, 1]],
|
288
|
+
["timeStamp", ["SOAP::SOAPBase64", XSD::QName.new(NsEntities, "TimeStamp")], [0, 1]]
|
289
|
+
]
|
290
|
+
)
|
291
|
+
|
292
|
+
LiteralRegistry.register(
|
293
|
+
:class => AdCenterWrapper::CreditCardPaymentMethod,
|
294
|
+
:schema_name => XSD::QName.new(NsEntities, "CreditCardPaymentMethod"),
|
295
|
+
:schema_element => [
|
296
|
+
["address", ["AdCenterWrapper::Address", XSD::QName.new(NsEntities, "Address")], [0, 1]],
|
297
|
+
["customerId", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "CustomerId")], [0, 1]],
|
298
|
+
["id", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "Id")], [0, 1]],
|
299
|
+
["timeStamp", ["SOAP::SOAPBase64", XSD::QName.new(NsEntities, "TimeStamp")], [0, 1]],
|
300
|
+
["expirationDate", ["SOAP::SOAPLong", XSD::QName.new(NsEntities, "ExpirationDate")], [0, 1]],
|
301
|
+
["firstName", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "FirstName")], [0, 1]],
|
302
|
+
["lastName", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "LastName")], [0, 1]],
|
303
|
+
["middleInitial", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "MiddleInitial")], [0, 1]],
|
304
|
+
["number", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "Number")], [0, 1]],
|
305
|
+
["securityCode", ["SOAP::SOAPString", XSD::QName.new(NsEntities, "SecurityCode")], [0, 1]],
|
306
|
+
["type", ["AdCenterWrapper::CreditCardType", XSD::QName.new(NsEntities, "Type")], [0, 1]]
|
307
|
+
]
|
308
|
+
)
|
309
|
+
|
310
|
+
LiteralRegistry.register(
|
311
|
+
:class => AdCenterWrapper::CreditCardType,
|
312
|
+
:schema_name => XSD::QName.new(NsEntities, "CreditCardType")
|
313
|
+
)
|
314
|
+
|
315
|
+
LiteralRegistry.register(
|
316
|
+
:class => AdCenterWrapper::AdApiFaultDetail,
|
317
|
+
:schema_name => XSD::QName.new(NsAdapiMicrosoftCom, "AdApiFaultDetail"),
|
318
|
+
:schema_element => [
|
319
|
+
["trackingId", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "TrackingId")], [0, 1]],
|
320
|
+
["errors", ["AdCenterWrapper::ArrayOfAdApiError", XSD::QName.new(NsAdapiMicrosoftCom, "Errors")], [0, 1]]
|
321
|
+
]
|
322
|
+
)
|
323
|
+
|
324
|
+
LiteralRegistry.register(
|
325
|
+
:class => AdCenterWrapper::ApplicationFault,
|
326
|
+
:schema_name => XSD::QName.new(NsAdapiMicrosoftCom, "ApplicationFault"),
|
327
|
+
:schema_element => [
|
328
|
+
["trackingId", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "TrackingId")], [0, 1]]
|
329
|
+
]
|
330
|
+
)
|
331
|
+
|
332
|
+
LiteralRegistry.register(
|
333
|
+
:class => AdCenterWrapper::ArrayOfAdApiError,
|
334
|
+
:schema_name => XSD::QName.new(NsAdapiMicrosoftCom, "ArrayOfAdApiError"),
|
335
|
+
:schema_element => [
|
336
|
+
["adApiError", ["AdCenterWrapper::AdApiError[]", XSD::QName.new(NsAdapiMicrosoftCom, "AdApiError")], [0, nil]]
|
337
|
+
]
|
338
|
+
)
|
339
|
+
|
340
|
+
LiteralRegistry.register(
|
341
|
+
:class => AdCenterWrapper::AdApiError,
|
342
|
+
:schema_name => XSD::QName.new(NsAdapiMicrosoftCom, "AdApiError"),
|
343
|
+
:schema_element => [
|
344
|
+
["code", ["SOAP::SOAPInt", XSD::QName.new(NsAdapiMicrosoftCom, "Code")], [0, 1]],
|
345
|
+
["detail", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "Detail")], [0, 1]],
|
346
|
+
["errorCode", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "ErrorCode")], [0, 1]],
|
347
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "Message")], [0, 1]]
|
348
|
+
]
|
349
|
+
)
|
350
|
+
|
351
|
+
LiteralRegistry.register(
|
352
|
+
:class => AdCenterWrapper::ApiFault,
|
353
|
+
:schema_name => XSD::QName.new(NsC_Exception, "ApiFault"),
|
354
|
+
:schema_element => [
|
355
|
+
["trackingId", ["SOAP::SOAPString", XSD::QName.new(NsAdapiMicrosoftCom, "TrackingId")], [0, 1]],
|
356
|
+
["operationErrors", ["AdCenterWrapper::ArrayOfOperationError", XSD::QName.new(NsC_Exception, "OperationErrors")], [0, 1]]
|
357
|
+
]
|
358
|
+
)
|
359
|
+
|
360
|
+
LiteralRegistry.register(
|
361
|
+
:class => AdCenterWrapper::ArrayOfOperationError,
|
362
|
+
:schema_name => XSD::QName.new(NsC_Exception, "ArrayOfOperationError"),
|
363
|
+
:schema_element => [
|
364
|
+
["operationError", ["AdCenterWrapper::OperationError[]", XSD::QName.new(NsC_Exception, "OperationError")], [0, nil]]
|
365
|
+
]
|
366
|
+
)
|
367
|
+
|
368
|
+
LiteralRegistry.register(
|
369
|
+
:class => AdCenterWrapper::OperationError,
|
370
|
+
:schema_name => XSD::QName.new(NsC_Exception, "OperationError"),
|
371
|
+
:schema_element => [
|
372
|
+
["code", ["SOAP::SOAPInt", XSD::QName.new(NsC_Exception, "Code")], [0, 1]],
|
373
|
+
["details", ["SOAP::SOAPString", XSD::QName.new(NsC_Exception, "Details")], [0, 1]],
|
374
|
+
["message", ["SOAP::SOAPString", XSD::QName.new(NsC_Exception, "Message")], [0, 1]]
|
375
|
+
]
|
376
|
+
)
|
377
|
+
|
378
|
+
end
|
379
|
+
|
380
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
$: << File.expand_path(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
begin
|
5
|
+
gem 'soap4r'
|
6
|
+
rescue
|
7
|
+
require_gem 'soap4r'
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'soap/wsdlDriver'
|
11
|
+
require 'soap/header/simplehandler'
|
12
|
+
require 'soap/baseData'
|
13
|
+
|
14
|
+
require 'ad_intelligence_service'
|
15
|
+
require 'administration_service'
|
16
|
+
require 'campaign_management_service'
|
17
|
+
require 'customer_billing_service'
|
18
|
+
require 'customer_management_service'
|
19
|
+
require 'notification_service'
|
20
|
+
require 'optimizer_service'
|
21
|
+
require 'reporting_service'
|
22
|
+
|
23
|
+
class AdCenterClient
|
24
|
+
VERSION = '8.0.0'
|
25
|
+
include SOAP::RPC
|
26
|
+
|
27
|
+
attr_accessor :options
|
28
|
+
# connection to ad intelligence service
|
29
|
+
attr_accessor :ad_intelligence_service
|
30
|
+
# connection to administration service
|
31
|
+
attr_accessor :administration_service
|
32
|
+
# connection to campaign management service
|
33
|
+
attr_accessor :campaign_management_service
|
34
|
+
# connection to customer billing service
|
35
|
+
attr_accessor :customer_billing_service
|
36
|
+
# connection to customer management service
|
37
|
+
attr_accessor :customer_management_service
|
38
|
+
# connection to notification service
|
39
|
+
attr_accessor :notification_service
|
40
|
+
# connection to optimizer service
|
41
|
+
attr_accessor :optimizer_service
|
42
|
+
# connection to reporting service
|
43
|
+
attr_accessor :reporting_service
|
44
|
+
# reference to wrapper entities
|
45
|
+
attr_accessor :entities
|
46
|
+
|
47
|
+
# endpoints to be used in production
|
48
|
+
ENDPOINTS_PRODUCTION = {
|
49
|
+
:ad_intelligence_service => 'https://adcenterapi.microsoft.com/Api/Advertiser/v8/CampaignManagement/AdIntelligenceService.svc?wsdl',
|
50
|
+
:administration_service => 'https://adcenterapi.microsoft.com/Api/Advertiser/v8/Administration/AdministrationService.svc?wsdl',
|
51
|
+
:campaign_management_service => 'https://adcenterapi.microsoft.com/Api/Advertiser/v8/CampaignManagement/CampaignManagementService.svc?wsdl',
|
52
|
+
:customer_billing_service => 'https://sharedservices.adcenterapi.microsoft.com/Api/Billing/v8/CustomerBillingService.svc?wsdl',
|
53
|
+
:customer_management_service => 'https://sharedservices.adcenterapi.microsoft.com/Api/CustomerManagement/v8/CustomerManagementService.svc?wsdl',
|
54
|
+
:notification_service => 'https://sharedservices.adcenterapi.microsoft.com/Api/Notification/v8/NotificationService.svc?wsdl',
|
55
|
+
:optimizer_service => 'https://adcenterapi.microsoft.com/Api/Advertiser/v8/Optimizer/OptimizerService.svc?wsdl',
|
56
|
+
:reporting_service => 'https://adcenterapi.microsoft.com/Api/Advertiser/v8/Reporting/ReportingService.svc?wsdl'
|
57
|
+
}
|
58
|
+
|
59
|
+
# endpoints to be used in sandbox
|
60
|
+
ENDPOINTS_SANDBOX = {
|
61
|
+
:ad_intelligence_service => nil,
|
62
|
+
:administration_service => nil,
|
63
|
+
:campaign_management_service => nil,
|
64
|
+
:customer_billing_service => nil,
|
65
|
+
:customer_management_service => nil,
|
66
|
+
:notification_service => nil,
|
67
|
+
:optimizer_service => nil,
|
68
|
+
:reporting_service => nil,
|
69
|
+
}
|
70
|
+
|
71
|
+
# credentials:: Hash of credential data
|
72
|
+
# opts:: unused
|
73
|
+
# sandbox_flag:: bool value
|
74
|
+
def initialize(credentials, opts={}, sandbox_flag=false)
|
75
|
+
unless credentials_valid?(credentials)
|
76
|
+
warn "*** credentials appear invalid"
|
77
|
+
warn credentials.to_yaml
|
78
|
+
end
|
79
|
+
@options = opts
|
80
|
+
@entities = AdCenterWrapper
|
81
|
+
@ad_intelligence_service = AdIntelligenceService.new(select_endpoint('ad_intelligence_service', sandbox_flag), credentials)
|
82
|
+
@administration_service = AdministrationService.new(select_endpoint('administration_service', sandbox_flag), credentials)
|
83
|
+
@campaign_management_service = CampaignManagementService.new(select_endpoint('campaign_management_service', sandbox_flag), credentials)
|
84
|
+
@customer_billing_service = CustomerBillingService.new(select_endpoint('customer_billing_service', sandbox_flag), credentials)
|
85
|
+
@customer_management_service = CustomerManagementService.new(select_endpoint('customer_management_service', sandbox_flag), credentials)
|
86
|
+
@notification_service = NotificationService.new(select_endpoint('notification_service', sandbox_flag), credentials)
|
87
|
+
@optimizer_service = ReportingService.new(select_endpoint('optimizer_service', sandbox_flag), credentials)
|
88
|
+
@reporting_service = ReportingService.new(select_endpoint('reporting_service', sandbox_flag), credentials)
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def credentials_valid?(creds)
|
94
|
+
return false unless creds.kind_of?(Hash)
|
95
|
+
return false unless creds['ApplicationToken']
|
96
|
+
return false unless creds['CustomerAccountId']
|
97
|
+
return false unless creds['CustomerId']
|
98
|
+
return false unless creds['DeveloperToken']
|
99
|
+
return false unless creds['UserName']
|
100
|
+
return false unless creds['Password']
|
101
|
+
return true
|
102
|
+
end
|
103
|
+
|
104
|
+
def select_endpoint(service_name, sandbox_flag)
|
105
|
+
if sandbox_flag
|
106
|
+
return ENDPOINTS_SANDBOX[service_name.to_sym]
|
107
|
+
else
|
108
|
+
return ENDPOINTS_PRODUCTION[service_name.to_sym]
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|