google-adwords-api 0.21.1 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +3 -0
- data/examples/{v201603/basic_operations/remove_campaign.rb → v201609/account_management/accept_service_link.rb} +24 -20
- data/examples/v201609/advanced_operations/add_universal_app_campaign.rb +3 -0
- data/examples/v201609/advanced_operations/use_portfolio_bidding_strategy.rb +3 -0
- data/examples/v201609/basic_operations/add_campaigns.rb +3 -0
- data/examples/v201609/campaign_management/add_complete_campaigns_using_batch_job.rb +3 -0
- data/examples/v201609/misc/use_oauth2_jwt.rb +1 -1
- data/examples/v201609/shopping_campaigns/add_shopping_campaign.rb +4 -0
- data/lib/adwords_api/api_config.rb +0 -92
- data/lib/adwords_api/version.rb +1 -1
- data/test/adwords_api/test_choices.rb +88 -25
- metadata +5 -174
- data/examples/v201603/account_management/create_account.rb +0 -88
- data/examples/v201603/account_management/get_account_changes.rb +0 -135
- data/examples/v201603/account_management/get_account_hierarchy.rb +0 -132
- data/examples/v201603/advanced_operations/add_ad_customizers.rb +0 -184
- data/examples/v201603/advanced_operations/add_ad_group_bid_modifier.rb +0 -101
- data/examples/v201603/advanced_operations/add_click_to_download_ad.rb +0 -133
- data/examples/v201603/advanced_operations/add_html5_ad.rb +0 -137
- data/examples/v201603/advanced_operations/add_text_ad_with_upgraded_urls.rb +0 -134
- data/examples/v201603/advanced_operations/create_and_attach_shared_keyword_set.rb +0 -141
- data/examples/v201603/advanced_operations/find_and_remove_criteria_from_shared_set.rb +0 -174
- data/examples/v201603/advanced_operations/get_ad_group_bid_modifiers.rb +0 -102
- data/examples/v201603/advanced_operations/use_portfolio_bidding_strategy.rb +0 -146
- data/examples/v201603/basic_operations/add_ad_groups.rb +0 -142
- data/examples/v201603/basic_operations/add_campaigns.rb +0 -138
- data/examples/v201603/basic_operations/add_keywords.rb +0 -114
- data/examples/v201603/basic_operations/add_text_ads.rb +0 -109
- data/examples/v201603/basic_operations/get_ad_groups.rb +0 -102
- data/examples/v201603/basic_operations/get_campaigns.rb +0 -97
- data/examples/v201603/basic_operations/get_campaigns_with_awql.rb +0 -89
- data/examples/v201603/basic_operations/get_keywords.rb +0 -109
- data/examples/v201603/basic_operations/get_text_ads.rb +0 -110
- data/examples/v201603/basic_operations/pause_ad.rb +0 -88
- data/examples/v201603/basic_operations/remove_ad.rb +0 -89
- data/examples/v201603/basic_operations/remove_ad_group.rb +0 -85
- data/examples/v201603/basic_operations/remove_keyword.rb +0 -94
- data/examples/v201603/basic_operations/update_ad_group.rb +0 -85
- data/examples/v201603/basic_operations/update_campaign.rb +0 -86
- data/examples/v201603/basic_operations/update_keyword.rb +0 -106
- data/examples/v201603/campaign_management/add_campaign_labels.rb +0 -82
- data/examples/v201603/campaign_management/add_complete_campaigns_using_batch_job.rb +0 -355
- data/examples/v201603/campaign_management/add_draft.rb +0 -114
- data/examples/v201603/campaign_management/add_experiment.rb +0 -162
- data/examples/v201603/campaign_management/add_keywords_using_incremental_batch_job.rb +0 -210
- data/examples/v201603/campaign_management/add_trial.rb +0 -142
- data/examples/v201603/campaign_management/get_all_disapproved_ads.rb +0 -97
- data/examples/v201603/campaign_management/get_all_disapproved_ads_with_awql.rb +0 -89
- data/examples/v201603/campaign_management/get_campaigns_by_label.rb +0 -108
- data/examples/v201603/campaign_management/graduate_trial.rb +0 -106
- data/examples/v201603/campaign_management/promote_experiment.rb +0 -81
- data/examples/v201603/campaign_management/set_ad_parameters.rb +0 -118
- data/examples/v201603/campaign_management/set_criterion_bid_modifier.rb +0 -104
- data/examples/v201603/campaign_management/validate_text_ad.rb +0 -110
- data/examples/v201603/error_handling/handle_partial_failures.rb +0 -130
- data/examples/v201603/error_handling/handle_policy_violation_error.rb +0 -141
- data/examples/v201603/extensions/add_google_my_business_location_extensions.rb +0 -193
- data/examples/v201603/extensions/add_site_links.rb +0 -184
- data/examples/v201603/extensions/add_site_links_using_feeds.rb +0 -281
- data/examples/v201603/migration/migrate_to_extension_settings.rb +0 -386
- data/examples/v201603/migration/upgrade_ad_url.rb +0 -93
- data/examples/v201603/misc/get_all_images_and_videos.rb +0 -104
- data/examples/v201603/misc/setup_oauth2.rb +0 -84
- data/examples/v201603/misc/upload_image.rb +0 -93
- data/examples/v201603/misc/upload_media_bundle.rb +0 -90
- data/examples/v201603/misc/use_oauth2_jwt.rb +0 -93
- data/examples/v201603/misc/use_runtime_config.rb +0 -92
- data/examples/v201603/optimization/estimate_keyword_traffic.rb +0 -146
- data/examples/v201603/optimization/get_campaign_criterion_bid_modifier_simulations.rb +0 -128
- data/examples/v201603/optimization/get_keyword_bid_simulations.rb +0 -95
- data/examples/v201603/optimization/get_keyword_ideas.rb +0 -136
- data/examples/v201603/remarketing/add_audience.rb +0 -118
- data/examples/v201603/remarketing/add_conversion_tracker.rb +0 -97
- data/examples/v201603/remarketing/add_crm_based_user_list.rb +0 -116
- data/examples/v201603/remarketing/add_rule_based_user_lists.rb +0 -167
- data/examples/v201603/remarketing/upload_offline_conversions.rb +0 -98
- data/examples/v201603/reporting/download_criteria_report.rb +0 -92
- data/examples/v201603/reporting/download_criteria_report_with_awql.rb +0 -93
- data/examples/v201603/reporting/get_report_fields.rb +0 -75
- data/examples/v201603/reporting/parallel_report_download.rb +0 -164
- data/examples/v201603/reporting/stream_criteria_report_results.rb +0 -97
- data/examples/v201603/shopping_campaigns/add_product_partition_tree.rb +0 -267
- data/examples/v201603/shopping_campaigns/add_product_scope.rb +0 -130
- data/examples/v201603/shopping_campaigns/add_shopping_campaign.rb +0 -129
- data/examples/v201603/shopping_campaigns/get_product_category_taxonomy.rb +0 -115
- data/examples/v201603/targeting/add_campaign_targeting_criteria.rb +0 -180
- data/examples/v201603/targeting/add_demographic_targeting_criteria.rb +0 -112
- data/examples/v201603/targeting/get_campaign_targeting_criteria.rb +0 -106
- data/examples/v201603/targeting/get_targetable_languages_and_carriers.rb +0 -89
- data/examples/v201603/targeting/lookup_location.rb +0 -108
- data/lib/adwords_api/v201603/account_label_service.rb +0 -46
- data/lib/adwords_api/v201603/account_label_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/ad_customizer_feed_service.rb +0 -46
- data/lib/adwords_api/v201603/ad_customizer_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/ad_group_ad_service.rb +0 -70
- data/lib/adwords_api/v201603/ad_group_ad_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/ad_group_bid_modifier_service.rb +0 -54
- data/lib/adwords_api/v201603/ad_group_bid_modifier_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/ad_group_criterion_service.rb +0 -62
- data/lib/adwords_api/v201603/ad_group_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/ad_group_extension_setting_service.rb +0 -54
- data/lib/adwords_api/v201603/ad_group_extension_setting_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/ad_group_feed_service.rb +0 -54
- data/lib/adwords_api/v201603/ad_group_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/ad_group_service.rb +0 -62
- data/lib/adwords_api/v201603/ad_group_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/ad_param_service.rb +0 -46
- data/lib/adwords_api/v201603/ad_param_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/adwords_user_list_service.rb +0 -62
- data/lib/adwords_api/v201603/adwords_user_list_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/batch_job_service.rb +0 -54
- data/lib/adwords_api/v201603/batch_job_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/bidding_strategy_service.rb +0 -54
- data/lib/adwords_api/v201603/bidding_strategy_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/budget_order_service.rb +0 -54
- data/lib/adwords_api/v201603/budget_order_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/budget_service.rb +0 -54
- data/lib/adwords_api/v201603/budget_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/campaign_criterion_service.rb +0 -54
- data/lib/adwords_api/v201603/campaign_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/campaign_extension_setting_service.rb +0 -54
- data/lib/adwords_api/v201603/campaign_extension_setting_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/campaign_feed_service.rb +0 -54
- data/lib/adwords_api/v201603/campaign_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/campaign_service.rb +0 -62
- data/lib/adwords_api/v201603/campaign_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/campaign_shared_set_service.rb +0 -54
- data/lib/adwords_api/v201603/campaign_shared_set_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/constant_data_service.rb +0 -110
- data/lib/adwords_api/v201603/constant_data_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/conversion_tracker_service.rb +0 -54
- data/lib/adwords_api/v201603/conversion_tracker_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/customer_extension_setting_service.rb +0 -54
- data/lib/adwords_api/v201603/customer_extension_setting_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/customer_feed_service.rb +0 -54
- data/lib/adwords_api/v201603/customer_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/customer_service.rb +0 -54
- data/lib/adwords_api/v201603/customer_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/customer_sync_service.rb +0 -38
- data/lib/adwords_api/v201603/customer_sync_service_registry.rb +0 -47
- data/lib/adwords_api/v201603/data_service.rb +0 -94
- data/lib/adwords_api/v201603/data_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/draft_async_error_service.rb +0 -46
- data/lib/adwords_api/v201603/draft_async_error_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/draft_service.rb +0 -54
- data/lib/adwords_api/v201603/draft_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/experiment_service.rb +0 -46
- data/lib/adwords_api/v201603/experiment_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/feed_item_service.rb +0 -54
- data/lib/adwords_api/v201603/feed_item_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/feed_mapping_service.rb +0 -54
- data/lib/adwords_api/v201603/feed_mapping_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/feed_service.rb +0 -54
- data/lib/adwords_api/v201603/feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/label_service.rb +0 -54
- data/lib/adwords_api/v201603/label_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/location_criterion_service.rb +0 -46
- data/lib/adwords_api/v201603/location_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/managed_customer_service.rb +0 -78
- data/lib/adwords_api/v201603/managed_customer_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/media_service.rb +0 -54
- data/lib/adwords_api/v201603/media_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/offline_conversion_feed_service.rb +0 -38
- data/lib/adwords_api/v201603/offline_conversion_feed_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/report_definition_service.rb +0 -38
- data/lib/adwords_api/v201603/report_definition_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/shared_criterion_service.rb +0 -54
- data/lib/adwords_api/v201603/shared_criterion_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/shared_set_service.rb +0 -54
- data/lib/adwords_api/v201603/shared_set_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/targeting_idea_service.rb +0 -38
- data/lib/adwords_api/v201603/targeting_idea_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/traffic_estimator_service.rb +0 -38
- data/lib/adwords_api/v201603/traffic_estimator_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/trial_async_error_service.rb +0 -46
- data/lib/adwords_api/v201603/trial_async_error_service_registry.rb +0 -46
- data/lib/adwords_api/v201603/trial_service.rb +0 -54
- data/lib/adwords_api/v201603/trial_service_registry.rb +0 -46
- data/test/templates/v201603/basic_operations_get_campaigns.def +0 -116
- data/test/templates/v201603/basic_operations_update_keyword.def +0 -125
- data/test/templates/v201603/misc_use_oauth2_jwt.def +0 -131
@@ -1,131 +0,0 @@
|
|
1
|
-
def setup_mocks()
|
2
|
-
file_name = 'privatekey.p12'
|
3
|
-
file_contents = 'file contents'
|
4
|
-
key_secret = 'not-secret'
|
5
|
-
|
6
|
-
$api_config = {
|
7
|
-
:service => {:environment => 'PRODUCTION'},
|
8
|
-
:authentication => {
|
9
|
-
:method => 'OAUTH2_SERVICE_ACCOUNT',
|
10
|
-
:oauth2_issuer => 'not-valid@developer.gserviceaccount.com',
|
11
|
-
:oauth2_secret => key_secret,
|
12
|
-
:oauth2_keyfile => file_name,
|
13
|
-
:developer_token => 'dev_token123',
|
14
|
-
:client_customer_id => '123-456-7890',
|
15
|
-
:user_agent => 'ruby-tests'
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
stub(File).file?(file_name) { true }
|
20
|
-
stub.proxy(File).file?
|
21
|
-
|
22
|
-
stub(File).read(file_name) { file_contents }
|
23
|
-
stub.proxy(File).read
|
24
|
-
|
25
|
-
key = mock!.key { 'pkcs12 key' }
|
26
|
-
stub(OpenSSL::PKCS12).new.with(file_contents, key_secret) { key }
|
27
|
-
|
28
|
-
stub_request(:post, "https://accounts.google.com/o/oauth2/token").
|
29
|
-
with(:body => hash_including({"grant_type"=>"urn:ietf:params:oauth:grant-type:jwt-bearer"}),
|
30
|
-
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Faraday v0.9.2'}).
|
31
|
-
with(:body => /assertion=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9/).
|
32
|
-
to_return(:status => 200,
|
33
|
-
:body => "{\n \"access_token\" : \"ab01.CBEF2GHi3JKlMnOpqRstUvW4X-YzaBcdEFG5IjKLMNPPqRStuV\",\n \"token_type\" : \"Bearer\",\n \"expires_in\" : 3600\n}",
|
34
|
-
:headers => {"Content-Type"=>"application/json"})
|
35
|
-
|
36
|
-
stub_request(:post, "https://adwords.google.com/api/adwords/cm/v201603/CampaignService").
|
37
|
-
with(
|
38
|
-
:body =>
|
39
|
-
# autogenerated code
|
40
|
-
{"env:Envelope"=>
|
41
|
-
{"env:Header"=>
|
42
|
-
{"wsdl:RequestHeader"=>
|
43
|
-
{"userAgent"=>/ruby-tests.*AwApi\-Ruby.*Common\-Ruby/,
|
44
|
-
"developerToken"=>"dev_token123",
|
45
|
-
"clientCustomerId"=>"123-456-7890",
|
46
|
-
"xmlns"=>"https://adwords.google.com/api/adwords/cm/v201603"}},
|
47
|
-
"env:Body"=>
|
48
|
-
{"get"=>
|
49
|
-
{"serviceSelector"=>
|
50
|
-
{"fields"=>["Id", "Name", "Status"],
|
51
|
-
"ordering"=>{"field"=>"Name", "sortOrder"=>"ASCENDING"}},
|
52
|
-
"xmlns"=>"https://adwords.google.com/api/adwords/cm/v201603"}},
|
53
|
-
"xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema",
|
54
|
-
"xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
|
55
|
-
"xmlns:wsdl"=>"https://adwords.google.com/api/adwords/cm/v201603",
|
56
|
-
"xmlns:env"=>"http://schemas.xmlsoap.org/soap/envelope/"}},
|
57
|
-
# end of auto-generated code.
|
58
|
-
:headers => {
|
59
|
-
'SOAPAction' => '"get"',
|
60
|
-
'Content-Type' => 'text/xml;charset=UTF-8',
|
61
|
-
'Authorization' => 'Bearer ab01.CBEF2GHi3JKlMnOpqRstUvW4X-YzaBcdEFG5IjKLMNPPqRStuV'
|
62
|
-
}
|
63
|
-
).
|
64
|
-
to_return(
|
65
|
-
:status => 200,
|
66
|
-
:body => '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
67
|
-
<soap:Header>
|
68
|
-
<ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201603">
|
69
|
-
<requestId>0004c</requestId>
|
70
|
-
<serviceName>CampaignService</serviceName>
|
71
|
-
<methodName>get</methodName>
|
72
|
-
<operations>42</operations>
|
73
|
-
<responseTime>84</responseTime>
|
74
|
-
<units>42</units>
|
75
|
-
</ResponseHeader>
|
76
|
-
</soap:Header>
|
77
|
-
<soap:Body>
|
78
|
-
<getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201603">
|
79
|
-
<rval>
|
80
|
-
<totalNumEntries>2</totalNumEntries>
|
81
|
-
<Page.Type>CampaignPage</Page.Type>
|
82
|
-
<totalBudget>
|
83
|
-
<period>DAILY</period><amount><ComparableValue.Type>Money</ComparableValue.Type>
|
84
|
-
<microAmount>0</microAmount></amount>
|
85
|
-
</totalBudget>
|
86
|
-
<entries>
|
87
|
-
<id>15</id><name>Campaign name 1</name><status>PAUSED</status><campaignStats><network>ALL</network>
|
88
|
-
<Stats.Type>CampaignStats</Stats.Type></campaignStats><frequencyCap><impressions>0</impressions></frequencyCap>
|
89
|
-
</entries>
|
90
|
-
<entries>
|
91
|
-
<id>16</id><name>Campaign name 2</name><status>ACTIVE</status><campaignStats><network>ALL</network>
|
92
|
-
<Stats.Type>CampaignStats</Stats.Type></campaignStats><frequencyCap><impressions>150</impressions></frequencyCap>
|
93
|
-
</entries>
|
94
|
-
</rval>
|
95
|
-
</getResponse>
|
96
|
-
</soap:Body>
|
97
|
-
</soap:Envelope>',
|
98
|
-
:headers => {'content-type' => 'text/xml;'}
|
99
|
-
)
|
100
|
-
end
|
101
|
-
|
102
|
-
def run_asserts()
|
103
|
-
assert_equal(2, $latest_result[:total_num_entries])
|
104
|
-
assert_equal('CampaignPage', $latest_result[:page_type])
|
105
|
-
entries = $latest_result[:entries]
|
106
|
-
assert_equal(2, entries.size)
|
107
|
-
|
108
|
-
if entries[0][:id] == 15
|
109
|
-
assert_campaign_15(entries[0])
|
110
|
-
assert_campaign_16(entries[1])
|
111
|
-
else
|
112
|
-
assert_campaign_15(entries[1])
|
113
|
-
assert_campaign_16(entries[0])
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def assert_campaign_15(entry)
|
118
|
-
assert_equal(15, entry[:id])
|
119
|
-
assert_equal('Campaign name 1', entry[:name])
|
120
|
-
assert_equal('PAUSED', entry[:status])
|
121
|
-
assert_equal({:network=>"ALL", :stats_type=>"CampaignStats"}, entry[:campaign_stats])
|
122
|
-
assert_equal({:impressions=>0}, entry[:frequency_cap])
|
123
|
-
end
|
124
|
-
|
125
|
-
def assert_campaign_16(entry)
|
126
|
-
assert_equal(16, entry[:id])
|
127
|
-
assert_equal('Campaign name 2', entry[:name])
|
128
|
-
assert_equal('ACTIVE', entry[:status])
|
129
|
-
assert_equal({:network=>"ALL", :stats_type=>"CampaignStats"}, entry[:campaign_stats])
|
130
|
-
assert_equal({:impressions=>150}, entry[:frequency_cap])
|
131
|
-
end
|