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.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +3 -0
  3. data/examples/{v201603/basic_operations/remove_campaign.rb → v201609/account_management/accept_service_link.rb} +24 -20
  4. data/examples/v201609/advanced_operations/add_universal_app_campaign.rb +3 -0
  5. data/examples/v201609/advanced_operations/use_portfolio_bidding_strategy.rb +3 -0
  6. data/examples/v201609/basic_operations/add_campaigns.rb +3 -0
  7. data/examples/v201609/campaign_management/add_complete_campaigns_using_batch_job.rb +3 -0
  8. data/examples/v201609/misc/use_oauth2_jwt.rb +1 -1
  9. data/examples/v201609/shopping_campaigns/add_shopping_campaign.rb +4 -0
  10. data/lib/adwords_api/api_config.rb +0 -92
  11. data/lib/adwords_api/version.rb +1 -1
  12. data/test/adwords_api/test_choices.rb +88 -25
  13. metadata +5 -174
  14. data/examples/v201603/account_management/create_account.rb +0 -88
  15. data/examples/v201603/account_management/get_account_changes.rb +0 -135
  16. data/examples/v201603/account_management/get_account_hierarchy.rb +0 -132
  17. data/examples/v201603/advanced_operations/add_ad_customizers.rb +0 -184
  18. data/examples/v201603/advanced_operations/add_ad_group_bid_modifier.rb +0 -101
  19. data/examples/v201603/advanced_operations/add_click_to_download_ad.rb +0 -133
  20. data/examples/v201603/advanced_operations/add_html5_ad.rb +0 -137
  21. data/examples/v201603/advanced_operations/add_text_ad_with_upgraded_urls.rb +0 -134
  22. data/examples/v201603/advanced_operations/create_and_attach_shared_keyword_set.rb +0 -141
  23. data/examples/v201603/advanced_operations/find_and_remove_criteria_from_shared_set.rb +0 -174
  24. data/examples/v201603/advanced_operations/get_ad_group_bid_modifiers.rb +0 -102
  25. data/examples/v201603/advanced_operations/use_portfolio_bidding_strategy.rb +0 -146
  26. data/examples/v201603/basic_operations/add_ad_groups.rb +0 -142
  27. data/examples/v201603/basic_operations/add_campaigns.rb +0 -138
  28. data/examples/v201603/basic_operations/add_keywords.rb +0 -114
  29. data/examples/v201603/basic_operations/add_text_ads.rb +0 -109
  30. data/examples/v201603/basic_operations/get_ad_groups.rb +0 -102
  31. data/examples/v201603/basic_operations/get_campaigns.rb +0 -97
  32. data/examples/v201603/basic_operations/get_campaigns_with_awql.rb +0 -89
  33. data/examples/v201603/basic_operations/get_keywords.rb +0 -109
  34. data/examples/v201603/basic_operations/get_text_ads.rb +0 -110
  35. data/examples/v201603/basic_operations/pause_ad.rb +0 -88
  36. data/examples/v201603/basic_operations/remove_ad.rb +0 -89
  37. data/examples/v201603/basic_operations/remove_ad_group.rb +0 -85
  38. data/examples/v201603/basic_operations/remove_keyword.rb +0 -94
  39. data/examples/v201603/basic_operations/update_ad_group.rb +0 -85
  40. data/examples/v201603/basic_operations/update_campaign.rb +0 -86
  41. data/examples/v201603/basic_operations/update_keyword.rb +0 -106
  42. data/examples/v201603/campaign_management/add_campaign_labels.rb +0 -82
  43. data/examples/v201603/campaign_management/add_complete_campaigns_using_batch_job.rb +0 -355
  44. data/examples/v201603/campaign_management/add_draft.rb +0 -114
  45. data/examples/v201603/campaign_management/add_experiment.rb +0 -162
  46. data/examples/v201603/campaign_management/add_keywords_using_incremental_batch_job.rb +0 -210
  47. data/examples/v201603/campaign_management/add_trial.rb +0 -142
  48. data/examples/v201603/campaign_management/get_all_disapproved_ads.rb +0 -97
  49. data/examples/v201603/campaign_management/get_all_disapproved_ads_with_awql.rb +0 -89
  50. data/examples/v201603/campaign_management/get_campaigns_by_label.rb +0 -108
  51. data/examples/v201603/campaign_management/graduate_trial.rb +0 -106
  52. data/examples/v201603/campaign_management/promote_experiment.rb +0 -81
  53. data/examples/v201603/campaign_management/set_ad_parameters.rb +0 -118
  54. data/examples/v201603/campaign_management/set_criterion_bid_modifier.rb +0 -104
  55. data/examples/v201603/campaign_management/validate_text_ad.rb +0 -110
  56. data/examples/v201603/error_handling/handle_partial_failures.rb +0 -130
  57. data/examples/v201603/error_handling/handle_policy_violation_error.rb +0 -141
  58. data/examples/v201603/extensions/add_google_my_business_location_extensions.rb +0 -193
  59. data/examples/v201603/extensions/add_site_links.rb +0 -184
  60. data/examples/v201603/extensions/add_site_links_using_feeds.rb +0 -281
  61. data/examples/v201603/migration/migrate_to_extension_settings.rb +0 -386
  62. data/examples/v201603/migration/upgrade_ad_url.rb +0 -93
  63. data/examples/v201603/misc/get_all_images_and_videos.rb +0 -104
  64. data/examples/v201603/misc/setup_oauth2.rb +0 -84
  65. data/examples/v201603/misc/upload_image.rb +0 -93
  66. data/examples/v201603/misc/upload_media_bundle.rb +0 -90
  67. data/examples/v201603/misc/use_oauth2_jwt.rb +0 -93
  68. data/examples/v201603/misc/use_runtime_config.rb +0 -92
  69. data/examples/v201603/optimization/estimate_keyword_traffic.rb +0 -146
  70. data/examples/v201603/optimization/get_campaign_criterion_bid_modifier_simulations.rb +0 -128
  71. data/examples/v201603/optimization/get_keyword_bid_simulations.rb +0 -95
  72. data/examples/v201603/optimization/get_keyword_ideas.rb +0 -136
  73. data/examples/v201603/remarketing/add_audience.rb +0 -118
  74. data/examples/v201603/remarketing/add_conversion_tracker.rb +0 -97
  75. data/examples/v201603/remarketing/add_crm_based_user_list.rb +0 -116
  76. data/examples/v201603/remarketing/add_rule_based_user_lists.rb +0 -167
  77. data/examples/v201603/remarketing/upload_offline_conversions.rb +0 -98
  78. data/examples/v201603/reporting/download_criteria_report.rb +0 -92
  79. data/examples/v201603/reporting/download_criteria_report_with_awql.rb +0 -93
  80. data/examples/v201603/reporting/get_report_fields.rb +0 -75
  81. data/examples/v201603/reporting/parallel_report_download.rb +0 -164
  82. data/examples/v201603/reporting/stream_criteria_report_results.rb +0 -97
  83. data/examples/v201603/shopping_campaigns/add_product_partition_tree.rb +0 -267
  84. data/examples/v201603/shopping_campaigns/add_product_scope.rb +0 -130
  85. data/examples/v201603/shopping_campaigns/add_shopping_campaign.rb +0 -129
  86. data/examples/v201603/shopping_campaigns/get_product_category_taxonomy.rb +0 -115
  87. data/examples/v201603/targeting/add_campaign_targeting_criteria.rb +0 -180
  88. data/examples/v201603/targeting/add_demographic_targeting_criteria.rb +0 -112
  89. data/examples/v201603/targeting/get_campaign_targeting_criteria.rb +0 -106
  90. data/examples/v201603/targeting/get_targetable_languages_and_carriers.rb +0 -89
  91. data/examples/v201603/targeting/lookup_location.rb +0 -108
  92. data/lib/adwords_api/v201603/account_label_service.rb +0 -46
  93. data/lib/adwords_api/v201603/account_label_service_registry.rb +0 -46
  94. data/lib/adwords_api/v201603/ad_customizer_feed_service.rb +0 -46
  95. data/lib/adwords_api/v201603/ad_customizer_feed_service_registry.rb +0 -46
  96. data/lib/adwords_api/v201603/ad_group_ad_service.rb +0 -70
  97. data/lib/adwords_api/v201603/ad_group_ad_service_registry.rb +0 -46
  98. data/lib/adwords_api/v201603/ad_group_bid_modifier_service.rb +0 -54
  99. data/lib/adwords_api/v201603/ad_group_bid_modifier_service_registry.rb +0 -46
  100. data/lib/adwords_api/v201603/ad_group_criterion_service.rb +0 -62
  101. data/lib/adwords_api/v201603/ad_group_criterion_service_registry.rb +0 -46
  102. data/lib/adwords_api/v201603/ad_group_extension_setting_service.rb +0 -54
  103. data/lib/adwords_api/v201603/ad_group_extension_setting_service_registry.rb +0 -46
  104. data/lib/adwords_api/v201603/ad_group_feed_service.rb +0 -54
  105. data/lib/adwords_api/v201603/ad_group_feed_service_registry.rb +0 -46
  106. data/lib/adwords_api/v201603/ad_group_service.rb +0 -62
  107. data/lib/adwords_api/v201603/ad_group_service_registry.rb +0 -46
  108. data/lib/adwords_api/v201603/ad_param_service.rb +0 -46
  109. data/lib/adwords_api/v201603/ad_param_service_registry.rb +0 -46
  110. data/lib/adwords_api/v201603/adwords_user_list_service.rb +0 -62
  111. data/lib/adwords_api/v201603/adwords_user_list_service_registry.rb +0 -46
  112. data/lib/adwords_api/v201603/batch_job_service.rb +0 -54
  113. data/lib/adwords_api/v201603/batch_job_service_registry.rb +0 -46
  114. data/lib/adwords_api/v201603/bidding_strategy_service.rb +0 -54
  115. data/lib/adwords_api/v201603/bidding_strategy_service_registry.rb +0 -46
  116. data/lib/adwords_api/v201603/budget_order_service.rb +0 -54
  117. data/lib/adwords_api/v201603/budget_order_service_registry.rb +0 -46
  118. data/lib/adwords_api/v201603/budget_service.rb +0 -54
  119. data/lib/adwords_api/v201603/budget_service_registry.rb +0 -46
  120. data/lib/adwords_api/v201603/campaign_criterion_service.rb +0 -54
  121. data/lib/adwords_api/v201603/campaign_criterion_service_registry.rb +0 -46
  122. data/lib/adwords_api/v201603/campaign_extension_setting_service.rb +0 -54
  123. data/lib/adwords_api/v201603/campaign_extension_setting_service_registry.rb +0 -46
  124. data/lib/adwords_api/v201603/campaign_feed_service.rb +0 -54
  125. data/lib/adwords_api/v201603/campaign_feed_service_registry.rb +0 -46
  126. data/lib/adwords_api/v201603/campaign_service.rb +0 -62
  127. data/lib/adwords_api/v201603/campaign_service_registry.rb +0 -46
  128. data/lib/adwords_api/v201603/campaign_shared_set_service.rb +0 -54
  129. data/lib/adwords_api/v201603/campaign_shared_set_service_registry.rb +0 -46
  130. data/lib/adwords_api/v201603/constant_data_service.rb +0 -110
  131. data/lib/adwords_api/v201603/constant_data_service_registry.rb +0 -46
  132. data/lib/adwords_api/v201603/conversion_tracker_service.rb +0 -54
  133. data/lib/adwords_api/v201603/conversion_tracker_service_registry.rb +0 -46
  134. data/lib/adwords_api/v201603/customer_extension_setting_service.rb +0 -54
  135. data/lib/adwords_api/v201603/customer_extension_setting_service_registry.rb +0 -46
  136. data/lib/adwords_api/v201603/customer_feed_service.rb +0 -54
  137. data/lib/adwords_api/v201603/customer_feed_service_registry.rb +0 -46
  138. data/lib/adwords_api/v201603/customer_service.rb +0 -54
  139. data/lib/adwords_api/v201603/customer_service_registry.rb +0 -46
  140. data/lib/adwords_api/v201603/customer_sync_service.rb +0 -38
  141. data/lib/adwords_api/v201603/customer_sync_service_registry.rb +0 -47
  142. data/lib/adwords_api/v201603/data_service.rb +0 -94
  143. data/lib/adwords_api/v201603/data_service_registry.rb +0 -46
  144. data/lib/adwords_api/v201603/draft_async_error_service.rb +0 -46
  145. data/lib/adwords_api/v201603/draft_async_error_service_registry.rb +0 -46
  146. data/lib/adwords_api/v201603/draft_service.rb +0 -54
  147. data/lib/adwords_api/v201603/draft_service_registry.rb +0 -46
  148. data/lib/adwords_api/v201603/experiment_service.rb +0 -46
  149. data/lib/adwords_api/v201603/experiment_service_registry.rb +0 -46
  150. data/lib/adwords_api/v201603/feed_item_service.rb +0 -54
  151. data/lib/adwords_api/v201603/feed_item_service_registry.rb +0 -46
  152. data/lib/adwords_api/v201603/feed_mapping_service.rb +0 -54
  153. data/lib/adwords_api/v201603/feed_mapping_service_registry.rb +0 -46
  154. data/lib/adwords_api/v201603/feed_service.rb +0 -54
  155. data/lib/adwords_api/v201603/feed_service_registry.rb +0 -46
  156. data/lib/adwords_api/v201603/label_service.rb +0 -54
  157. data/lib/adwords_api/v201603/label_service_registry.rb +0 -46
  158. data/lib/adwords_api/v201603/location_criterion_service.rb +0 -46
  159. data/lib/adwords_api/v201603/location_criterion_service_registry.rb +0 -46
  160. data/lib/adwords_api/v201603/managed_customer_service.rb +0 -78
  161. data/lib/adwords_api/v201603/managed_customer_service_registry.rb +0 -46
  162. data/lib/adwords_api/v201603/media_service.rb +0 -54
  163. data/lib/adwords_api/v201603/media_service_registry.rb +0 -46
  164. data/lib/adwords_api/v201603/offline_conversion_feed_service.rb +0 -38
  165. data/lib/adwords_api/v201603/offline_conversion_feed_service_registry.rb +0 -46
  166. data/lib/adwords_api/v201603/report_definition_service.rb +0 -38
  167. data/lib/adwords_api/v201603/report_definition_service_registry.rb +0 -46
  168. data/lib/adwords_api/v201603/shared_criterion_service.rb +0 -54
  169. data/lib/adwords_api/v201603/shared_criterion_service_registry.rb +0 -46
  170. data/lib/adwords_api/v201603/shared_set_service.rb +0 -54
  171. data/lib/adwords_api/v201603/shared_set_service_registry.rb +0 -46
  172. data/lib/adwords_api/v201603/targeting_idea_service.rb +0 -38
  173. data/lib/adwords_api/v201603/targeting_idea_service_registry.rb +0 -46
  174. data/lib/adwords_api/v201603/traffic_estimator_service.rb +0 -38
  175. data/lib/adwords_api/v201603/traffic_estimator_service_registry.rb +0 -46
  176. data/lib/adwords_api/v201603/trial_async_error_service.rb +0 -46
  177. data/lib/adwords_api/v201603/trial_async_error_service_registry.rb +0 -46
  178. data/lib/adwords_api/v201603/trial_service.rb +0 -54
  179. data/lib/adwords_api/v201603/trial_service_registry.rb +0 -46
  180. data/test/templates/v201603/basic_operations_get_campaigns.def +0 -116
  181. data/test/templates/v201603/basic_operations_update_keyword.def +0 -125
  182. 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