sem4r 0.1.2 → 0.1.3
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/Gemfile +13 -2
- data/Gemfile.lock +13 -7
- data/README.rdoc +44 -7
- data/Rakefile +2 -122
- data/VERSION.yml +1 -1
- data/bin/sem +1 -0
- data/examples_sem4r/01_get_account.rb +1 -0
- data/examples_sem4r/02_get_info.rb +1 -0
- data/examples_sem4r/03_list_ad.rb +1 -0
- data/examples_sem4r/04_list_keywords.rb +1 -0
- data/examples_sem4r/05_request_report.rb +25 -14
- data/examples_sem4r/{05_request_report_2010.rb → 06_request_report_definition.rb} +2 -4
- data/examples_sem4r/{06_create_campaigns.rb → 07_create_campaigns.rb} +1 -0
- data/examples_sem4r/{07_create_campaigns_block.rb → 08_create_campaigns_block.rb} +1 -0
- data/examples_sem4r/{07_create_campaigns_simple.rb → 09_create_campaigns_simple.rb} +1 -0
- data/examples_sem4r/{08_ad_params.rb → 10_ad_params.rb} +1 -0
- data/examples_sem4r/{09_targeting_idea.rb → 11_targeting_idea.rb} +1 -0
- data/examples_sem4r/{10_get_location.rb → 12_get_location.rb} +1 -0
- data/examples_sem4r/{11_submit_bulk_job.rb → 13_submit_bulk_job.rb} +1 -1
- data/examples_sem4r/{12_list_bulk_job.rb → 14_list_bulk_job.rb} +3 -0
- data/examples_sem4r/30_prune_empty_adgroup.rb +1 -0
- data/examples_sem4r/31_empty_accounts.rb +1 -0
- data/examples_sem4r/example_helper.rb +2 -1
- data/lib/sem4r/ad_group/ad_group.rb +22 -7
- data/lib/sem4r/ad_group/ad_group_bids.rb +1 -1
- data/lib/sem4r/ad_group/ad_group_service.rb +12 -5
- data/lib/sem4r/ad_group_ad/ad_group_ad.rb +1 -0
- data/lib/sem4r/ad_group_ad/ad_group_ad_operations.rb +1 -0
- data/lib/sem4r/ad_group_ad/ad_group_ad_service.rb +14 -9
- data/lib/sem4r/ad_group_ad/ad_group_mobile_ad.rb +16 -25
- data/lib/sem4r/ad_group_ad/ad_group_text_ad.rb +18 -14
- data/lib/sem4r/ad_group_criterion/ad_group_criterion.rb +27 -19
- data/lib/sem4r/ad_group_criterion/ad_group_criterion_bids.rb +2 -1
- data/lib/sem4r/ad_group_criterion/ad_group_criterion_operations.rb +1 -0
- data/lib/sem4r/ad_group_criterion/ad_group_criterion_service.rb +9 -4
- data/lib/sem4r/ad_group_criterion/criterion.rb +1 -0
- data/lib/sem4r/ad_group_criterion/criterion_keyword.rb +1 -0
- data/lib/sem4r/ad_group_criterion/criterion_placement.rb +1 -0
- data/lib/sem4r/ad_param/ad_param.rb +24 -8
- data/lib/sem4r/ad_param/ad_param_service.rb +8 -5
- data/lib/sem4r/adwords.rb +232 -76
- data/lib/sem4r/base.rb +1 -1
- data/lib/sem4r/bulk_mutate_job/bulk_mutate_job.rb +41 -35
- data/lib/sem4r/bulk_mutate_job/bulk_mutate_job_account_extension.rb +49 -15
- data/lib/sem4r/bulk_mutate_job/bulk_mutate_job_selector.rb +29 -20
- data/lib/sem4r/bulk_mutate_job/bulk_mutate_job_service.rb +13 -14
- data/lib/sem4r/bulk_mutate_job/job_operations.rb +1 -1
- data/lib/sem4r/campaign/campaign.rb +1 -0
- data/lib/sem4r/campaign/campaign_account_extension.rb +2 -1
- data/lib/sem4r/campaign/campaign_service.rb +9 -5
- data/lib/sem4r/credentials.rb +11 -5
- data/lib/sem4r/geo_location/address.rb +56 -0
- data/lib/sem4r/geo_location/geo_location_account_extension.rb +27 -6
- data/lib/sem4r/geo_location/geo_location_selector.rb +57 -0
- data/lib/sem4r/geo_location/geo_location_service.rb +9 -16
- data/lib/sem4r/info/info_account_extension.rb +3 -2
- data/lib/sem4r/info/info_selector.rb +2 -1
- data/lib/sem4r/info/info_service.rb +10 -3
- data/lib/sem4r/operation.rb +39 -20
- data/lib/sem4r/report_definition/report_definition.rb +37 -19
- data/lib/sem4r/report_definition/report_definition_account_extension.rb +66 -16
- data/lib/sem4r/report_definition/report_definition_operation.rb +2 -2
- data/lib/sem4r/report_definition/report_definition_selector.rb +1 -1
- data/lib/sem4r/report_definition/report_definition_service.rb +11 -7
- data/lib/sem4r/report_definition/report_field.rb +3 -2
- data/lib/sem4r/sem4r_templates.rb +77 -0
- data/lib/sem4r/{services/service.rb → service.rb} +23 -23
- data/lib/sem4r/targeting_idea/targeting_idea.rb +4 -4
- data/lib/sem4r/targeting_idea/targeting_idea_account_extension.rb +1 -1
- data/lib/sem4r/targeting_idea/targeting_idea_selector.rb +6 -6
- data/lib/sem4r/targeting_idea/targeting_idea_service.rb +7 -5
- data/lib/sem4r/v13_account/account_account_extension.rb +7 -10
- data/lib/sem4r/v13_account/account_service.rb +10 -4
- data/lib/sem4r/v13_account/billing_address.rb +2 -2
- data/lib/sem4r/v13_report/report_service.rb +11 -9
- data/lib/sem4r.rb +46 -31
- data/lib/{sem4r/cli → sem4r_cli}/cli_helpers.rb +3 -2
- data/lib/{sem4r/cli/cli_command.rb → sem4r_cli/cli_mini_framework.rb} +77 -32
- data/lib/{sem4r/cli/cli_common_args.rb → sem4r_cli/cli_sem.rb} +177 -157
- data/lib/{sem4r/cli/commands/cli_list_ads.rb → sem4r_cli/commands/cli_ads.rb} +7 -9
- data/lib/sem4r_cli/commands/cli_campaign.rb +69 -0
- data/lib/{sem4r/cli/commands/cli_list_client.rb → sem4r_cli/commands/cli_clients.rb} +2 -2
- data/lib/{sem4r/cli → sem4r_cli}/commands/cli_ideas.rb +35 -27
- data/lib/{sem4r/cli → sem4r_cli}/commands/cli_info.rb +3 -4
- data/lib/{sem4r/cli/commands/cli_repdef.rb → sem4r_cli/commands/cli_job.rb} +57 -55
- data/lib/{sem4r/cli/commands/cli_list_keywords.rb → sem4r_cli/commands/cli_keywords.rb} +14 -13
- data/lib/sem4r_cli/commands/cli_profile.rb +138 -0
- data/lib/{sem4r/cli/commands/cli_report.rb → sem4r_cli/commands/cli_repdef.rb} +67 -20
- data/lib/{sem4r/cli/commands/cli_request_report.rb → sem4r_cli/commands/cli_report.rb} +82 -19
- data/lib/sem4r_cli.rb +5 -7
- data/lib/sem4r_soap/http_connector.rb +206 -0
- data/lib/{soap_helpers → sem4r_soap}/soap_attributes.rb +8 -3
- data/lib/{sem4r/services → sem4r_soap}/soap_dumper.rb +36 -20
- data/lib/{sem4r/services → sem4r_soap}/soap_error.rb +5 -2
- data/lib/sem4r_soap/soap_response.rb +75 -0
- data/lib/sem4r_soap/soap_service.rb +137 -0
- data/lib/{sem4r/cli/cli_sem.rb → sem4r_soap/soap_service_v13.rb} +27 -28
- data/lib/sem4r_soap/soap_service_v2010.rb +80 -0
- data/lib/sem4r_soap.rb +17 -0
- data/sem4r.gemspec +93 -58
- data/spec/build_fixtures.rb +49 -42
- data/spec/fixtures/password.example.yml +3 -0
- data/spec/fixtures/sem4r.example.yml +6 -0
- data/spec/fixtures/{services/error.xml → soap_error.xml} +0 -0
- data/spec/fixtures/soap_error2.xml +29 -0
- data/spec/helpers/dump_interceptor.rb +90 -0
- data/spec/helpers/fixtures_bulk_mutate_job.rb +48 -0
- data/spec/helpers/fixtures_geo_location.rb +45 -0
- data/{lib/sem4r/campaign_criterion/campaign_criterion_service.rb → spec/helpers/fixtures_info.rb} +10 -6
- data/spec/helpers/fixtures_report_definition.rb +65 -0
- data/spec/{rspec_hash.rb → helpers/rspec_hash.rb} +1 -0
- data/spec/{rspec_matchers.rb → helpers/rspec_matchers.rb} +46 -19
- data/spec/{rspec_sem4r_helper.rb → helpers/rspec_sem4r_helper.rb} +19 -16
- data/spec/{sem4r_stubs.rb → helpers/sem4r_stubs.rb} +5 -4
- data/spec/rspec_helper.rb +4 -4
- data/spec/sem4r/account_spec.rb +2 -3
- data/spec/sem4r/ad_group/ad_group_service_spec.rb +1 -1
- data/spec/sem4r/ad_group/ad_group_spec.rb +1 -1
- data/spec/sem4r/ad_group_ad/ad_group_ad_operation_spec.rb +3 -3
- data/spec/sem4r/adwords_spec.rb +62 -39
- data/{lib/sem4r/cli/commands/cli_list_campaign.rb → spec/sem4r/bulk_mutate_job/bulk_mutate_job_selector_spec.rb} +14 -11
- data/spec/sem4r/bulk_mutate_job/bulk_mutate_job_service_spec.rb +2 -3
- data/spec/sem4r/bulk_mutate_job/bulk_mutate_job_spec.rb +23 -17
- data/spec/sem4r/bulk_mutate_job/fixtures/get-list_job-req.xml +35 -0
- data/spec/sem4r/bulk_mutate_job/fixtures/get-list_job-res.xml +417 -0
- data/spec/sem4r/bulk_mutate_job/fixtures/mutate-add_job-req.xml +106 -0
- data/spec/sem4r/bulk_mutate_job/fixtures/mutate-add_job-res.xml +48 -0
- data/spec/sem4r/bulk_mutate_job/job_operation_spec.rb +5 -7
- data/spec/sem4r/campaign/campaign_service_spec.rb +2 -2
- data/spec/sem4r/credentials_spec.rb +10 -8
- data/spec/sem4r/geo_location/address_spec.rb +62 -0
- data/spec/sem4r/geo_location/fixtures/get-req.xml +42 -0
- data/spec/sem4r/geo_location/fixtures/get-res.xml +60 -0
- data/spec/sem4r/info/fixtures/get-req.xml +34 -0
- data/spec/sem4r/info/fixtures/get-res.xml +27 -0
- data/spec/sem4r/nokogiri_parsing_spec.rb +1 -0
- data/spec/sem4r/operation_spec.rb +72 -0
- data/spec/sem4r/report_definition/fixtures/get-list-repdef-req.xml +22 -0
- data/spec/sem4r/report_definition/fixtures/get-list-repdef-res.xml +73 -0
- data/spec/sem4r/report_definition/fixtures/getReportFields-req.xml +24 -0
- data/spec/sem4r/report_definition/fixtures/getReportFields-res.xml +1199 -0
- data/spec/sem4r/report_definition/fixtures/mutate-add-report-req.xml +63 -0
- data/spec/sem4r/report_definition/fixtures/mutate-add-report-res.xml +68 -0
- data/spec/sem4r/report_definition/report_definition_service_spec.rb +5 -5
- data/spec/sem4r/report_definition/report_definition_spec.rb +28 -43
- data/{lib/sem4r/cli/commands/cli_list_report.rb → spec/sem4r/report_definition/report_field_spec.rb} +12 -10
- data/spec/sem4r/rexml_parsing_spec.rb +1 -0
- data/spec/sem4r/{services/service_spec.rb → service_spec.rb} +1 -1
- data/spec/sem4r/targeting_idea/targeting_idea_selector_spec.rb +1 -1
- data/spec/sem4r/targeting_idea/targeting_idea_service_spec.rb +1 -1
- data/spec/sem4r/targeting_idea/targeting_idea_spec.rb +1 -1
- data/spec/sem4r/v13_account/account_service_spec.rb +2 -2
- data/spec/sem4r/v13_report/report_service_spec.rb +2 -2
- data/spec/{sem4r/cli → sem4r_cli}/cli_spec.rb +22 -27
- data/spec/{soap_helpers → sem4r_soap}/soap_attributes_spec.rb +3 -3
- data/spec/{sem4r/services/soap_message_v13_spec.rb → sem4r_soap/soap_response_spec.rb} +10 -15
- data/spec/{sem4r/services/soap_call_spec.rb → sem4r_soap/soap_service_spec.rb} +35 -54
- data/tasks/jeweler.rake +66 -0
- data/tasks/rspec.rake +21 -0
- data/tasks/sem4r.rake +25 -0
- data/tasks/yard.rake +31 -0
- metadata +173 -76
- data/lib/sem4r/ad_extension_override/ad_extension_override_service.rb +0 -30
- data/lib/sem4r/api_counters.rb +0 -8
- data/lib/sem4r/campaign_target/campaign_target_service.rb +0 -30
- data/lib/sem4r/cli/commands/cli_download_report.rb +0 -82
- data/lib/sem4r/services/http_connector.rb +0 -93
- data/lib/sem4r/services/soap_call.rb +0 -122
- data/lib/sem4r/services/soap_connector.rb +0 -139
- data/lib/sem4r/services/soap_message_v13.rb +0 -135
- data/lib/sem4r/services/soap_message_v2010.rb +0 -184
- data/lib/sem4r/v13_traffic_estimator/traffic_estimator_service.rb +0 -30
- data/spec/aggregates_rspec_helper.rb +0 -59
- data/spec/sem4r/report_definition/fixtures/mutate_add-req.xml +0 -24
- data/spec/sem4r/report_definition/fixtures/mutate_add-req_orig.xml +0 -45
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
# -------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
-
#
|
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
-
# a copy of this software and associated documentation files (the
|
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
-
# the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be
|
|
13
|
-
# included in all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
-
# -------------------------------------------------------------------
|
|
23
|
-
|
|
24
|
-
module Sem4r
|
|
25
|
-
|
|
26
|
-
class SoapMessageV2010
|
|
27
|
-
|
|
28
|
-
attr_reader :response
|
|
29
|
-
attr_reader :counters
|
|
30
|
-
|
|
31
|
-
def initialize(connector, credentials)
|
|
32
|
-
@connector = connector
|
|
33
|
-
@credentials = credentials
|
|
34
|
-
@response = nil
|
|
35
|
-
@counters = {}
|
|
36
|
-
@logger = nil
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def logger=(logger)
|
|
40
|
-
@logger= logger
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def init(header_namespace, service_namespace)
|
|
44
|
-
@header_namespace = header_namespace
|
|
45
|
-
@service_namespace = service_namespace
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def body=(soap_body_content)
|
|
49
|
-
@soap_body_content = soap_body_content
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def send(service_url)
|
|
53
|
-
send_raw(service_url, build_soap_message)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def send_raw(service_url, soap_message)
|
|
57
|
-
soap_message = soap_message.dup
|
|
58
|
-
soap_message.gsub!(/{authentication_token}/, @credentials.authentication_token)
|
|
59
|
-
soap_message.gsub!(/{useragent}/, @credentials.useragent)
|
|
60
|
-
soap_message.gsub!(/{developer_token}/, @credentials.developer_token)
|
|
61
|
-
# soap_message.gsub!(/{client_email}/, @credentials.client_email)
|
|
62
|
-
_send_raw(service_url, soap_message)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
private
|
|
66
|
-
|
|
67
|
-
def _send_raw(service_url, soap_message)
|
|
68
|
-
response_xml = @connector.send(service_url, "", soap_message)
|
|
69
|
-
# erase namespace so it more simple parsing the xml
|
|
70
|
-
response_xml.gsub!(/\b(ns\d:|xsi:|s:|soapenv:|env:|soap:)/, "")
|
|
71
|
-
response_xml.gsub!(/xmlns=["'].*?['"]/, '')
|
|
72
|
-
@response = Nokogiri::XML::Document.parse(response_xml)
|
|
73
|
-
|
|
74
|
-
#
|
|
75
|
-
# extract information from header
|
|
76
|
-
#
|
|
77
|
-
header = @response.at_xpath("//ResponseHeader")
|
|
78
|
-
if header
|
|
79
|
-
@counters = {
|
|
80
|
-
:operations => header.at_xpath("operations").text.to_i,
|
|
81
|
-
:response_time => header.at_xpath("responseTime").text.to_i,
|
|
82
|
-
:units => header.at_xpath("units").text.to_i
|
|
83
|
-
}
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
#
|
|
87
|
-
# check soap fault
|
|
88
|
-
#
|
|
89
|
-
fault_el = @response.at_xpath("//Fault")
|
|
90
|
-
if fault_el
|
|
91
|
-
fault_string = fault_el.at_xpath('faultstring').text
|
|
92
|
-
@logger.error("soap error: #{fault_string}") if @logger
|
|
93
|
-
raise fault_string
|
|
94
|
-
end
|
|
95
|
-
self
|
|
96
|
-
|
|
97
|
-
# <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
|
98
|
-
# <soap:Header>
|
|
99
|
-
# <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v200909">
|
|
100
|
-
# <requestId>e7c3b00f339bcaf56b7df47db97efdb7</requestId>
|
|
101
|
-
# <operations>1</operations>
|
|
102
|
-
# <responseTime>231</responseTime>
|
|
103
|
-
# <units>1</units>
|
|
104
|
-
# </ResponseHeader>
|
|
105
|
-
# </soap:Header>
|
|
106
|
-
# <soap:Body>
|
|
107
|
-
# <soap:Fault>
|
|
108
|
-
# <faultcode>soap:Server</faultcode>
|
|
109
|
-
# <faultstring>[CampaignError.DUPLICATE_CAMPAIGN_NAME @ operations[0].operand.name]</faultstring>
|
|
110
|
-
# <detail>
|
|
111
|
-
# <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v200909">
|
|
112
|
-
# <message>[CampaignError.DUPLICATE_CAMPAIGN_NAME @ operations[0].operand.name]</message>
|
|
113
|
-
# <ApplicationException.Type>ApiException</ApplicationException.Type>
|
|
114
|
-
# <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CampaignError">
|
|
115
|
-
# <fieldPath>operations[0].operand.name</fieldPath>
|
|
116
|
-
# <trigger></trigger>
|
|
117
|
-
# <ApiError.Type>CampaignError</ApiError.Type>
|
|
118
|
-
# <reason>DUPLICATE_CAMPAIGN_NAME</reason>
|
|
119
|
-
# </errors>
|
|
120
|
-
# </ApiExceptionFault>
|
|
121
|
-
# </detail>
|
|
122
|
-
# </soap:Fault>
|
|
123
|
-
# </soap:Body>
|
|
124
|
-
#</soap:Envelope>
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
def build_soap_header
|
|
128
|
-
auth_token = @credentials.authentication_token
|
|
129
|
-
|
|
130
|
-
str = "<env:Header>"
|
|
131
|
-
|
|
132
|
-
if @service_namespace
|
|
133
|
-
str += "<s:RequestHeader env:mustUnderstand=\"0\">"
|
|
134
|
-
else
|
|
135
|
-
str += "<RequestHeader env:mustUnderstand=\"0\">"
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
str +=<<-EOFS
|
|
139
|
-
<authToken>#{auth_token}</authToken>
|
|
140
|
-
<userAgent>#{@credentials.useragent}</userAgent>
|
|
141
|
-
<developerToken>#{@credentials.developer_token}</developerToken>
|
|
142
|
-
EOFS
|
|
143
|
-
|
|
144
|
-
if @credentials.client_email
|
|
145
|
-
str += "<clientEmail>#{@credentials.client_email}</clientEmail>"
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
if @service_namespace
|
|
149
|
-
str += "</s:RequestHeader>"
|
|
150
|
-
else
|
|
151
|
-
str += "</RequestHeader>"
|
|
152
|
-
end
|
|
153
|
-
str += "</env:Header>"
|
|
154
|
-
str
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def build_soap_message
|
|
158
|
-
soap_message = '<?xml version="1.0" encoding="utf-8" ?>'
|
|
159
|
-
soap_message +=<<-EOFS
|
|
160
|
-
<env:Envelope
|
|
161
|
-
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
162
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
163
|
-
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
|
164
|
-
xmlns="#{@header_namespace}"
|
|
165
|
-
EOFS
|
|
166
|
-
|
|
167
|
-
if @service_namespace
|
|
168
|
-
soap_message += " xmlns:s=\"#{@service_namespace}\""
|
|
169
|
-
end
|
|
170
|
-
soap_message += ">"
|
|
171
|
-
|
|
172
|
-
soap_message += build_soap_header
|
|
173
|
-
soap_message += "<env:Body>"
|
|
174
|
-
soap_message += @soap_body_content
|
|
175
|
-
soap_message += <<-EOFS
|
|
176
|
-
</env:Body>
|
|
177
|
-
</env:Envelope>
|
|
178
|
-
EOFS
|
|
179
|
-
soap_message
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# -------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
-
#
|
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
-
# a copy of this software and associated documentation files (the
|
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
-
# the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be
|
|
13
|
-
# included in all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
-
# -------------------------------------------------------------------
|
|
23
|
-
|
|
24
|
-
module Sem4r
|
|
25
|
-
class TrafficEstimatorService
|
|
26
|
-
def initialize
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# -------------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
-
#
|
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
-
# a copy of this software and associated documentation files (the
|
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
-
# the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be
|
|
13
|
-
# included in all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
-
#
|
|
23
|
-
# -------------------------------------------------------------------------
|
|
24
|
-
|
|
25
|
-
module AggregatesSpecHelper
|
|
26
|
-
def create_bulk_mutate_job(campaign, adgroup)
|
|
27
|
-
# TextAd
|
|
28
|
-
text_ad1 = AdGroupTextAd.new(adgroup)
|
|
29
|
-
text_ad1.headline = "Cruise to Mars Sector 1"
|
|
30
|
-
text_ad1.description1 = "Visit the Red Planet in style."
|
|
31
|
-
text_ad1.description2 = "Low-gravity fun for everyone!"
|
|
32
|
-
text_ad1.url = "http://www.example.com"
|
|
33
|
-
text_ad1.display_url = "www.example.com"
|
|
34
|
-
|
|
35
|
-
# TextAd
|
|
36
|
-
text_ad2 = AdGroupTextAd.new(adgroup)
|
|
37
|
-
text_ad2.headline = "Cruise to Mars Sector 2"
|
|
38
|
-
text_ad2.description1 = "Visit the Red Planet in style."
|
|
39
|
-
text_ad2.description2 = "Low-gravity fun for everyone!"
|
|
40
|
-
text_ad2.url = "http://www.example.com"
|
|
41
|
-
text_ad2.display_url = "www.example.com"
|
|
42
|
-
|
|
43
|
-
# adgroupad_operation
|
|
44
|
-
ad_operation1 = AdGroupAdOperation.new
|
|
45
|
-
ad_operation1.add text_ad1
|
|
46
|
-
|
|
47
|
-
# adgroupad_operation
|
|
48
|
-
ad_operation2 = AdGroupAdOperation.new
|
|
49
|
-
ad_operation2.add text_ad2
|
|
50
|
-
|
|
51
|
-
bulk_mutate_job = BulkMutateJob.new
|
|
52
|
-
bulk_mutate_job.campaign_id = campaign.id
|
|
53
|
-
bulk_mutate_job.add_operation ad_operation1
|
|
54
|
-
bulk_mutate_job.add_operation ad_operation2
|
|
55
|
-
|
|
56
|
-
bulk_mutate_job
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
|
-
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
3
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
|
-
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
|
|
5
|
-
<env:Header>
|
|
6
|
-
<n1:RequestHeader env:mustUnderstand="0"
|
|
7
|
-
xmlns:n1="https://adwords.google.com/api/adwords/cm/v201003">
|
|
8
|
-
<n1:authToken></n1:authToken>
|
|
9
|
-
<n1:userAgent></n1:userAgent>
|
|
10
|
-
<n1:developerToken></n1:developerToken>
|
|
11
|
-
<n1:clientEmail></n1:clientEmail>
|
|
12
|
-
</n1:RequestHeader>
|
|
13
|
-
</env:Header>
|
|
14
|
-
<env:Body>
|
|
15
|
-
<n2:mutate xmlns:n2="https://adwords.google.com/api/adwords/cm/v201003">
|
|
16
|
-
<n2:operations xsi:type="n2:ReportDefinitionOperation">
|
|
17
|
-
<n2:operator>ADD</n2:operator>
|
|
18
|
-
<n2:operand>
|
|
19
|
-
<n2:reportName>report</n2:reportName>
|
|
20
|
-
</n2:operand>
|
|
21
|
-
</n2:operations>
|
|
22
|
-
</n2:mutate>
|
|
23
|
-
</env:Body>
|
|
24
|
-
</env:Envelope>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
|
-
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
3
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
|
-
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
|
|
5
|
-
<env:Header>
|
|
6
|
-
<n1:RequestHeader env:mustUnderstand="0"
|
|
7
|
-
xmlns:n1="https://adwords.google.com/api/adwords/cm/v201003">
|
|
8
|
-
<n1:authToken></n1:authToken>
|
|
9
|
-
<n1:userAgent></n1:userAgent>
|
|
10
|
-
<n1:developerToken></n1:developerToken>
|
|
11
|
-
<n1:clientEmail></n1:clientEmail>
|
|
12
|
-
</n1:RequestHeader>
|
|
13
|
-
</env:Header>
|
|
14
|
-
<env:Body>
|
|
15
|
-
<n2:mutate xmlns:n2="https://adwords.google.com/api/adwords/cm/v201003">
|
|
16
|
-
<n2:operations xsi:type="n2:ReportDefinitionOperation">
|
|
17
|
-
<n2:operator>ADD</n2:operator>
|
|
18
|
-
<n2:operand>
|
|
19
|
-
<n2:selector>
|
|
20
|
-
<n2:fields>AdGroupId</n2:fields>
|
|
21
|
-
<n2:fields>Id</n2:fields>
|
|
22
|
-
<n2:fields>KeywordText</n2:fields>
|
|
23
|
-
<n2:fields>KeywordMatchType</n2:fields>
|
|
24
|
-
<n2:fields>Impressions</n2:fields>
|
|
25
|
-
<n2:fields>Clicks</n2:fields>
|
|
26
|
-
<n2:fields>Cost</n2:fields>
|
|
27
|
-
<n2:predicates>
|
|
28
|
-
<n2:field>AdGroupId</n2:field>
|
|
29
|
-
<n2:operator>EQUALS</n2:operator>
|
|
30
|
-
<n2:values>0</n2:values>
|
|
31
|
-
</n2:predicates>
|
|
32
|
-
<n2:dateRange>
|
|
33
|
-
<n2:min>INSERT_START_DATE_HERE</n2:min>
|
|
34
|
-
<n2:max>INSERT_END_DATE_HERE</n2:max>
|
|
35
|
-
</n2:dateRange>
|
|
36
|
-
</n2:selector>
|
|
37
|
-
<n2:reportName>Keywords performance report #1277024503235</n2:reportName>
|
|
38
|
-
<n2:reportType>KEYWORDS_PERFORMANCE_REPORT</n2:reportType>
|
|
39
|
-
<n2:dateRangeType>CUSTOM_DATE</n2:dateRangeType>
|
|
40
|
-
<n2:downloadFormat>XML</n2:downloadFormat>
|
|
41
|
-
</n2:operand>
|
|
42
|
-
</n2:operations>
|
|
43
|
-
</n2:mutate>
|
|
44
|
-
</env:Body>
|
|
45
|
-
</env:Envelope>
|