adwords4r 0.6 → 0.7

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.
@@ -0,0 +1,83 @@
1
+ module AdWords
2
+ require 'adwords4r/v6/ReportService'
3
+
4
+ require 'soap/rpc/driver'
5
+
6
+ class ReportServiceInterface < ::SOAP::RPC::Driver
7
+ DefaultEndpointUrl = "https://adwords.google.com/api/adwords/v6/ReportService"
8
+ MappingRegistry = ::SOAP::Mapping::Registry.new
9
+
10
+ Methods = [
11
+ [ "",
12
+ "scheduleReportJob",
13
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "scheduleReportJob"], true],
14
+ ["out", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "scheduleReportJobResponse"], true] ],
15
+ { :request_style => :document, :request_use => :literal,
16
+ :response_style => :document, :response_use => :literal }
17
+ ],
18
+ [ "",
19
+ "getReportJobStatus",
20
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "getReportJobStatus"], true],
21
+ ["out", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "getReportJobStatusResponse"], true] ],
22
+ { :request_style => :document, :request_use => :literal,
23
+ :response_style => :document, :response_use => :literal }
24
+ ],
25
+ [ "",
26
+ "getReportDownloadUrl",
27
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "getReportDownloadUrl"], true],
28
+ ["out", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "getReportDownloadUrlResponse"], true] ],
29
+ { :request_style => :document, :request_use => :literal,
30
+ :response_style => :document, :response_use => :literal }
31
+ ],
32
+ [ "",
33
+ "getGzipReportDownloadUrl",
34
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "getGzipReportDownloadUrl"], true],
35
+ ["out", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "getGzipReportDownloadUrlResponse"], true] ],
36
+ { :request_style => :document, :request_use => :literal,
37
+ :response_style => :document, :response_use => :literal }
38
+ ],
39
+ [ "",
40
+ "getAllJobs",
41
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "getAllJobs"], true],
42
+ ["out", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "getAllJobsResponse"], true] ],
43
+ { :request_style => :document, :request_use => :literal,
44
+ :response_style => :document, :response_use => :literal }
45
+ ],
46
+ [ "",
47
+ "deleteReport",
48
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "deleteReport"], true],
49
+ ["out", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "deleteReportResponse"], true] ],
50
+ { :request_style => :document, :request_use => :literal,
51
+ :response_style => :document, :response_use => :literal }
52
+ ]
53
+ ]
54
+
55
+ def initialize(endpoint_url = nil)
56
+ endpoint_url ||= DefaultEndpointUrl
57
+ super(endpoint_url, nil)
58
+ self.mapping_registry = MappingRegistry
59
+ init_methods
60
+ end
61
+
62
+ private
63
+
64
+ def init_methods
65
+ Methods.each do |definitions|
66
+ opt = definitions.last
67
+ if opt[:request_style] == :document
68
+ add_document_operation(*definitions)
69
+ else
70
+ add_rpc_operation(*definitions)
71
+ qname = definitions[0]
72
+ name = definitions[2]
73
+ if qname.name != name and qname.name.capitalize == name.capitalize
74
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
75
+ __send__(name, *arg)
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+
83
+ end
@@ -0,0 +1,310 @@
1
+ module AdWords
2
+ require 'xsd/qname'
3
+
4
+ # {https://adwords.google.com/api/adwords/v6}estimateCampaignList
5
+ class EstimateCampaignList < ::Array
6
+ @@schema_element = [
7
+ ["campaignRequests", ["CampaignRequest[]", XSD::QName.new("https://adwords.google.com/api/adwords/v6", "campaignRequests")]]
8
+ ]
9
+ end
10
+
11
+ # {https://adwords.google.com/api/adwords/v6}estimateCampaignListResponse
12
+ class EstimateCampaignListResponse < ::Array
13
+ @@schema_element = [
14
+ ["estimateCampaignListReturn", ["CampaignEstimate[]", XSD::QName.new("https://adwords.google.com/api/adwords/v6", "estimateCampaignListReturn")]]
15
+ ]
16
+ end
17
+
18
+ # {https://adwords.google.com/api/adwords/v6}estimateAdGroupList
19
+ class EstimateAdGroupList < ::Array
20
+ @@schema_element = [
21
+ ["adGroupRequests", ["AdGroupRequest[]", XSD::QName.new("https://adwords.google.com/api/adwords/v6", "adGroupRequests")]]
22
+ ]
23
+ end
24
+
25
+ # {https://adwords.google.com/api/adwords/v6}estimateAdGroupListResponse
26
+ class EstimateAdGroupListResponse < ::Array
27
+ @@schema_element = [
28
+ ["estimateAdGroupListReturn", ["AdGroupEstimate[]", XSD::QName.new("https://adwords.google.com/api/adwords/v6", "estimateAdGroupListReturn")]]
29
+ ]
30
+ end
31
+
32
+ # {https://adwords.google.com/api/adwords/v6}estimateKeywordList
33
+ class EstimateKeywordList < ::Array
34
+ @@schema_element = [
35
+ ["keywordRequests", ["KeywordRequest[]", XSD::QName.new("https://adwords.google.com/api/adwords/v6", "keywordRequests")]]
36
+ ]
37
+ end
38
+
39
+ # {https://adwords.google.com/api/adwords/v6}estimateKeywordListResponse
40
+ class EstimateKeywordListResponse < ::Array
41
+ @@schema_element = [
42
+ ["estimateKeywordListReturn", ["KeywordEstimate[]", XSD::QName.new("https://adwords.google.com/api/adwords/v6", "estimateKeywordListReturn")]]
43
+ ]
44
+ end
45
+
46
+ # {https://adwords.google.com/api/adwords/v6}ApiException
47
+ class ApiException
48
+ @@schema_type = "ApiException"
49
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
50
+ @@schema_element = [
51
+ ["code", "SOAP::SOAPInt"],
52
+ ["internal", "SOAP::SOAPBoolean"],
53
+ ["message", "SOAP::SOAPString"],
54
+ ["trigger", "SOAP::SOAPString"],
55
+ ["errors", "ApiError[]"]
56
+ ]
57
+
58
+ attr_accessor :code
59
+ attr_accessor :internal
60
+ attr_accessor :message
61
+ attr_accessor :trigger
62
+ attr_accessor :errors
63
+
64
+ def initialize(code = nil, internal = nil, message = nil, trigger = nil, errors = [])
65
+ @code = code
66
+ @internal = internal
67
+ @message = message
68
+ @trigger = trigger
69
+ @errors = errors
70
+ end
71
+ end
72
+
73
+ # {https://adwords.google.com/api/adwords/v6}ApiError
74
+ class ApiError
75
+ @@schema_type = "ApiError"
76
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
77
+ @@schema_element = [
78
+ ["index", "SOAP::SOAPInt"],
79
+ ["field", "SOAP::SOAPString"],
80
+ ["textIndex", "SOAP::SOAPInt"],
81
+ ["textLength", "SOAP::SOAPInt"],
82
+ ["trigger", "SOAP::SOAPString"],
83
+ ["code", "SOAP::SOAPInt"],
84
+ ["isExemptable", "SOAP::SOAPBoolean"],
85
+ ["detail", "SOAP::SOAPString"]
86
+ ]
87
+
88
+ attr_accessor :index
89
+ attr_accessor :field
90
+ attr_accessor :textIndex
91
+ attr_accessor :textLength
92
+ attr_accessor :trigger
93
+ attr_accessor :code
94
+ attr_accessor :isExemptable
95
+ attr_accessor :detail
96
+
97
+ def initialize(index = nil, field = nil, textIndex = nil, textLength = nil, trigger = nil, code = nil, isExemptable = nil, detail = nil)
98
+ @index = index
99
+ @field = field
100
+ @textIndex = textIndex
101
+ @textLength = textLength
102
+ @trigger = trigger
103
+ @code = code
104
+ @isExemptable = isExemptable
105
+ @detail = detail
106
+ end
107
+ end
108
+
109
+ # {https://adwords.google.com/api/adwords/v6}CampaignRequest
110
+ class CampaignRequest
111
+ @@schema_type = "CampaignRequest"
112
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
113
+ @@schema_element = [
114
+ ["adGroupRequests", "AdGroupRequest[]"],
115
+ ["geoTargeting", "GeoTarget"],
116
+ ["id", "SOAP::SOAPInt"],
117
+ ["languageTargeting", "LanguageTarget"],
118
+ ["networkTargeting", "NetworkTarget"]
119
+ ]
120
+
121
+ attr_accessor :adGroupRequests
122
+ attr_accessor :geoTargeting
123
+ attr_accessor :id
124
+ attr_accessor :languageTargeting
125
+ attr_accessor :networkTargeting
126
+
127
+ def initialize(adGroupRequests = [], geoTargeting = nil, id = nil, languageTargeting = nil, networkTargeting = nil)
128
+ @adGroupRequests = adGroupRequests
129
+ @geoTargeting = geoTargeting
130
+ @id = id
131
+ @languageTargeting = languageTargeting
132
+ @networkTargeting = networkTargeting
133
+ end
134
+ end
135
+
136
+ # {https://adwords.google.com/api/adwords/v6}AdGroupRequest
137
+ class AdGroupRequest
138
+ @@schema_type = "AdGroupRequest"
139
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
140
+ @@schema_element = [
141
+ ["id", "SOAP::SOAPInt"],
142
+ ["keywordRequests", "KeywordRequest[]"],
143
+ ["maxCpc", "SOAP::SOAPLong"]
144
+ ]
145
+
146
+ attr_accessor :id
147
+ attr_accessor :keywordRequests
148
+ attr_accessor :maxCpc
149
+
150
+ def initialize(id = nil, keywordRequests = [], maxCpc = nil)
151
+ @id = id
152
+ @keywordRequests = keywordRequests
153
+ @maxCpc = maxCpc
154
+ end
155
+ end
156
+
157
+ # {https://adwords.google.com/api/adwords/v6}KeywordRequest
158
+ class KeywordRequest
159
+ @@schema_type = "KeywordRequest"
160
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
161
+ @@schema_element = [
162
+ ["id", "SOAP::SOAPLong"],
163
+ ["maxCpc", "SOAP::SOAPLong"],
164
+ ["negative", "SOAP::SOAPBoolean"],
165
+ ["text", "SOAP::SOAPString"],
166
+ ["type", "SOAP::SOAPString"]
167
+ ]
168
+
169
+ attr_accessor :id
170
+ attr_accessor :maxCpc
171
+ attr_accessor :negative
172
+ attr_accessor :text
173
+ attr_accessor :type
174
+
175
+ def initialize(id = nil, maxCpc = nil, negative = nil, text = nil, type = nil)
176
+ @id = id
177
+ @maxCpc = maxCpc
178
+ @negative = negative
179
+ @text = text
180
+ @type = type
181
+ end
182
+ end
183
+
184
+ # {https://adwords.google.com/api/adwords/v6}GeoTarget
185
+ class GeoTarget
186
+ @@schema_type = "GeoTarget"
187
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
188
+ @@schema_element = [
189
+ ["cities", "SOAP::SOAPString[]"],
190
+ ["countries", "SOAP::SOAPString[]"],
191
+ ["metros", "SOAP::SOAPString[]"],
192
+ ["regions", "SOAP::SOAPString[]"]
193
+ ]
194
+
195
+ attr_accessor :cities
196
+ attr_accessor :countries
197
+ attr_accessor :metros
198
+ attr_accessor :regions
199
+
200
+ def initialize(cities = [], countries = [], metros = [], regions = [])
201
+ @cities = cities
202
+ @countries = countries
203
+ @metros = metros
204
+ @regions = regions
205
+ end
206
+ end
207
+
208
+ # {https://adwords.google.com/api/adwords/v6}LanguageTarget
209
+ class LanguageTarget < ::Array
210
+ @@schema_element = [
211
+ ["languages", ["SOAP::SOAPString[]", XSD::QName.new("https://adwords.google.com/api/adwords/v6", "languages")]]
212
+ ]
213
+ end
214
+
215
+ # {https://adwords.google.com/api/adwords/v6}NetworkTarget
216
+ class NetworkTarget < ::Array
217
+ @@schema_element = [
218
+ ["networkTypes", ["SOAP::SOAPString[]", XSD::QName.new("https://adwords.google.com/api/adwords/v6", "networkTypes")]]
219
+ ]
220
+ end
221
+
222
+ # {https://adwords.google.com/api/adwords/v6}CampaignEstimate
223
+ class CampaignEstimate
224
+ @@schema_type = "CampaignEstimate"
225
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
226
+ @@schema_element = [
227
+ ["adGroupEstimates", "AdGroupEstimate[]"],
228
+ ["id", "SOAP::SOAPInt"]
229
+ ]
230
+
231
+ attr_accessor :adGroupEstimates
232
+ attr_accessor :id
233
+
234
+ def initialize(adGroupEstimates = [], id = nil)
235
+ @adGroupEstimates = adGroupEstimates
236
+ @id = id
237
+ end
238
+ end
239
+
240
+ # {https://adwords.google.com/api/adwords/v6}AdGroupEstimate
241
+ class AdGroupEstimate
242
+ @@schema_type = "AdGroupEstimate"
243
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
244
+ @@schema_element = [
245
+ ["id", "SOAP::SOAPInt"],
246
+ ["keywordEstimates", "KeywordEstimate[]"]
247
+ ]
248
+
249
+ attr_accessor :id
250
+ attr_accessor :keywordEstimates
251
+
252
+ def initialize(id = nil, keywordEstimates = [])
253
+ @id = id
254
+ @keywordEstimates = keywordEstimates
255
+ end
256
+ end
257
+
258
+ # {https://adwords.google.com/api/adwords/v6}KeywordEstimate
259
+ class KeywordEstimate
260
+ @@schema_type = "KeywordEstimate"
261
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
262
+ @@schema_element = [
263
+ ["lowerAvgPosition", "Float"],
264
+ ["upperAvgPosition", "Float"],
265
+ ["lowerClicksPerDay", "Float"],
266
+ ["upperClicksPerDay", "Float"],
267
+ ["lowerCpc", "SOAP::SOAPLong"],
268
+ ["upperCpc", "SOAP::SOAPLong"],
269
+ ["id", "SOAP::SOAPLong"]
270
+ ]
271
+
272
+ attr_accessor :lowerAvgPosition
273
+ attr_accessor :upperAvgPosition
274
+ attr_accessor :lowerClicksPerDay
275
+ attr_accessor :upperClicksPerDay
276
+ attr_accessor :lowerCpc
277
+ attr_accessor :upperCpc
278
+ attr_accessor :id
279
+
280
+ def initialize(lowerAvgPosition = nil, upperAvgPosition = nil, lowerClicksPerDay = nil, upperClicksPerDay = nil, lowerCpc = nil, upperCpc = nil, id = nil)
281
+ @lowerAvgPosition = lowerAvgPosition
282
+ @upperAvgPosition = upperAvgPosition
283
+ @lowerClicksPerDay = lowerClicksPerDay
284
+ @upperClicksPerDay = upperClicksPerDay
285
+ @lowerCpc = lowerCpc
286
+ @upperCpc = upperCpc
287
+ @id = id
288
+ end
289
+ end
290
+
291
+ # {https://adwords.google.com/api/adwords/v6}NetworkType
292
+ class NetworkType < ::String
293
+ @@schema_type = "NetworkType"
294
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
295
+
296
+ ContentNetwork = NetworkType.new("ContentNetwork")
297
+ GoogleSearch = NetworkType.new("GoogleSearch")
298
+ SearchNetwork = NetworkType.new("SearchNetwork")
299
+ end
300
+
301
+ # {https://adwords.google.com/api/adwords/v6}KeywordType
302
+ class KeywordType < ::String
303
+ @@schema_type = "KeywordType"
304
+ @@schema_ns = "https://adwords.google.com/api/adwords/v6"
305
+
306
+ Broad = KeywordType.new("Broad")
307
+ Exact = KeywordType.new("Exact")
308
+ Phrase = KeywordType.new("Phrase")
309
+ end
310
+ end
@@ -0,0 +1,62 @@
1
+ module AdWords
2
+ require 'adwords4r/v6/TrafficEstimatorService'
3
+
4
+ require 'soap/rpc/driver'
5
+
6
+ class TrafficEstimatorInterface < ::SOAP::RPC::Driver
7
+ DefaultEndpointUrl = "https://adwords.google.com/api/adwords/v6/TrafficEstimatorService"
8
+ MappingRegistry = ::SOAP::Mapping::Registry.new
9
+
10
+ Methods = [
11
+ [ "",
12
+ "estimateCampaignList",
13
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "estimateCampaignList"], true],
14
+ ["out", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "estimateCampaignListResponse"], true] ],
15
+ { :request_style => :document, :request_use => :literal,
16
+ :response_style => :document, :response_use => :literal }
17
+ ],
18
+ [ "",
19
+ "estimateAdGroupList",
20
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "estimateAdGroupList"], true],
21
+ ["out", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "estimateAdGroupListResponse"], true] ],
22
+ { :request_style => :document, :request_use => :literal,
23
+ :response_style => :document, :response_use => :literal }
24
+ ],
25
+ [ "",
26
+ "estimateKeywordList",
27
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "estimateKeywordList"], true],
28
+ ["out", "parameters", ["::SOAP::SOAPElement", "https://adwords.google.com/api/adwords/v6", "estimateKeywordListResponse"], true] ],
29
+ { :request_style => :document, :request_use => :literal,
30
+ :response_style => :document, :response_use => :literal }
31
+ ]
32
+ ]
33
+
34
+ def initialize(endpoint_url = nil)
35
+ endpoint_url ||= DefaultEndpointUrl
36
+ super(endpoint_url, nil)
37
+ self.mapping_registry = MappingRegistry
38
+ init_methods
39
+ end
40
+
41
+ private
42
+
43
+ def init_methods
44
+ Methods.each do |definitions|
45
+ opt = definitions.last
46
+ if opt[:request_style] == :document
47
+ add_document_operation(*definitions)
48
+ else
49
+ add_rpc_operation(*definitions)
50
+ qname = definitions[0]
51
+ name = definitions[2]
52
+ if qname.name != name and qname.name.capitalize == name.capitalize
53
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
54
+ __send__(name, *arg)
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ end