google-adwords-api 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +8 -8
  2. data/ChangeLog +3 -0
  3. data/examples/v201402/basic_operations/delete_ad_group.rb +1 -22
  4. data/examples/{v201309/basic_operations/delete_ad_group.rb → v201402/basic_operations/delete_ad_group.rb~} +2 -8
  5. data/examples/v201402/basic_operations/delete_campaign.rb +2 -23
  6. data/examples/{v201309/basic_operations/update_campaign.rb → v201402/basic_operations/delete_campaign.rb~} +13 -12
  7. data/examples/v201406/basic_operations/remove_ad_group.rb +1 -22
  8. data/examples/{v201309/basic_operations/update_ad_group.rb → v201406/basic_operations/remove_ad_group.rb~} +14 -13
  9. data/examples/v201406/basic_operations/remove_campaign.rb +4 -24
  10. data/examples/{v201309/basic_operations/delete_campaign.rb → v201406/basic_operations/remove_campaign.rb~} +11 -11
  11. data/lib/adwords_api.rb +5 -8
  12. data/lib/adwords_api/api_config.rb +0 -76
  13. data/lib/adwords_api/report_utils.rb +9 -0
  14. data/lib/adwords_api/report_utils.rb~ +283 -0
  15. data/lib/adwords_api/version.rb +1 -1
  16. data/lib/adwords_api/version.rb~ +26 -0
  17. data/test/adwords_api/test_adwords_api.rb +5 -21
  18. data/test/adwords_api/test_adwords_api.rb~ +114 -0
  19. data/test/adwords_api/test_api_config.rb +8 -8
  20. data/test/adwords_api/test_report_utils.rb +29 -1
  21. data/test/adwords_api/test_report_utils.rb~ +216 -0
  22. data/test/templates/{v201309 → v201402}/basic_operations_get_campaigns.def +7 -7
  23. data/test/templates/{v201309 → v201402}/misc_use_oauth2_jwt.def +7 -7
  24. data/test/templates/v201406/basic_operations_get_campaigns.def +114 -0
  25. data/test/templates/v201406/misc_use_oauth2_jwt.def +131 -0
  26. metadata +14 -139
  27. data/examples/v201309/account_management/create_account.rb +0 -95
  28. data/examples/v201309/account_management/get_account_alerts.rb +0 -122
  29. data/examples/v201309/account_management/get_account_changes.rb +0 -145
  30. data/examples/v201309/account_management/get_account_hierarchy.rb +0 -103
  31. data/examples/v201309/advanced_operations/add_ad_group_bid_modifier.rb +0 -105
  32. data/examples/v201309/advanced_operations/add_click_to_download_ad.rb +0 -137
  33. data/examples/v201309/advanced_operations/add_site_links.rb +0 -306
  34. data/examples/v201309/advanced_operations/create_and_attach_shared_keyword_set.rb +0 -147
  35. data/examples/v201309/advanced_operations/find_and_remove_criteria_from_shared_set.rb +0 -181
  36. data/examples/v201309/advanced_operations/get_ad_group_bid_modifiers.rb +0 -106
  37. data/examples/v201309/advanced_operations/update_site_links.rb +0 -194
  38. data/examples/v201309/advanced_operations/upload_offline_conversions.rb +0 -117
  39. data/examples/v201309/advanced_operations/use_shared_bidding_strategy.rb +0 -163
  40. data/examples/v201309/basic_operations/add_ad_groups.rb +0 -143
  41. data/examples/v201309/basic_operations/add_campaigns.rb +0 -162
  42. data/examples/v201309/basic_operations/add_keywords.rb +0 -116
  43. data/examples/v201309/basic_operations/add_text_ads.rb +0 -113
  44. data/examples/v201309/basic_operations/delete_ad.rb +0 -93
  45. data/examples/v201309/basic_operations/delete_keyword.rb +0 -98
  46. data/examples/v201309/basic_operations/get_ad_groups.rb +0 -106
  47. data/examples/v201309/basic_operations/get_campaigns.rb +0 -101
  48. data/examples/v201309/basic_operations/get_campaigns_with_awql.rb +0 -93
  49. data/examples/v201309/basic_operations/get_keywords.rb +0 -112
  50. data/examples/v201309/basic_operations/get_text_ads.rb +0 -114
  51. data/examples/v201309/basic_operations/pause_ad.rb +0 -92
  52. data/examples/v201309/basic_operations/update_keyword.rb +0 -110
  53. data/examples/v201309/campaign_management/add_experiment.rb +0 -166
  54. data/examples/v201309/campaign_management/add_keywords_in_bulk.rb +0 -158
  55. data/examples/v201309/campaign_management/add_location_extension.rb +0 -125
  56. data/examples/v201309/campaign_management/get_all_disapproved_ads.rb +0 -101
  57. data/examples/v201309/campaign_management/get_all_disapproved_ads_with_awql.rb +0 -93
  58. data/examples/v201309/campaign_management/promote_experiment.rb +0 -85
  59. data/examples/v201309/campaign_management/set_ad_parameters.rb +0 -122
  60. data/examples/v201309/campaign_management/set_criterion_bid_modifier.rb +0 -108
  61. data/examples/v201309/campaign_management/validate_text_ad.rb +0 -114
  62. data/examples/v201309/error_handling/handle_captcha_challenge.rb +0 -93
  63. data/examples/v201309/error_handling/handle_partial_failures.rb +0 -134
  64. data/examples/v201309/error_handling/handle_policy_violation_error.rb +0 -145
  65. data/examples/v201309/error_handling/handle_two_factor_authorization_error.rb +0 -88
  66. data/examples/v201309/misc/get_all_images_and_videos.rb +0 -108
  67. data/examples/v201309/misc/setup_oauth2.rb +0 -88
  68. data/examples/v201309/misc/upload_image.rb +0 -97
  69. data/examples/v201309/misc/use_oauth2_jwt.rb +0 -97
  70. data/examples/v201309/optimization/estimate_keyword_traffic.rb +0 -137
  71. data/examples/v201309/optimization/get_keyword_bid_simulations.rb +0 -100
  72. data/examples/v201309/optimization/get_keyword_ideas.rb +0 -130
  73. data/examples/v201309/optimization/get_placement_ideas.rb +0 -112
  74. data/examples/v201309/remarketing/add_audience.rb +0 -123
  75. data/examples/v201309/remarketing/add_conversion_tracker.rb +0 -104
  76. data/examples/v201309/reporting/download_criteria_report.rb +0 -87
  77. data/examples/v201309/reporting/download_criteria_report_with_awql.rb +0 -86
  78. data/examples/v201309/reporting/get_report_fields.rb +0 -79
  79. data/examples/v201309/reporting/parallel_report_download.rb +0 -171
  80. data/examples/v201309/targeting/add_campaign_targeting_criteria.rb +0 -123
  81. data/examples/v201309/targeting/add_demographic_targeting_criteria.rb +0 -116
  82. data/examples/v201309/targeting/get_campaign_targeting_criteria.rb +0 -110
  83. data/examples/v201309/targeting/get_targetable_languages_and_carriers.rb +0 -94
  84. data/examples/v201309/targeting/lookup_location.rb +0 -112
  85. data/lib/adwords_api/v201309/ad_group_ad_service.rb +0 -42
  86. data/lib/adwords_api/v201309/ad_group_ad_service_registry.rb +0 -46
  87. data/lib/adwords_api/v201309/ad_group_bid_modifier_service.rb +0 -38
  88. data/lib/adwords_api/v201309/ad_group_bid_modifier_service_registry.rb +0 -46
  89. data/lib/adwords_api/v201309/ad_group_criterion_service.rb +0 -42
  90. data/lib/adwords_api/v201309/ad_group_criterion_service_registry.rb +0 -46
  91. data/lib/adwords_api/v201309/ad_group_feed_service.rb +0 -38
  92. data/lib/adwords_api/v201309/ad_group_feed_service_registry.rb +0 -46
  93. data/lib/adwords_api/v201309/ad_group_service.rb +0 -42
  94. data/lib/adwords_api/v201309/ad_group_service_registry.rb +0 -46
  95. data/lib/adwords_api/v201309/ad_param_service.rb +0 -38
  96. data/lib/adwords_api/v201309/ad_param_service_registry.rb +0 -46
  97. data/lib/adwords_api/v201309/adwords_user_list_service.rb +0 -38
  98. data/lib/adwords_api/v201309/adwords_user_list_service_registry.rb +0 -46
  99. data/lib/adwords_api/v201309/alert_service.rb +0 -34
  100. data/lib/adwords_api/v201309/alert_service_registry.rb +0 -46
  101. data/lib/adwords_api/v201309/bidding_strategy_service.rb +0 -38
  102. data/lib/adwords_api/v201309/bidding_strategy_service_registry.rb +0 -46
  103. data/lib/adwords_api/v201309/budget_order_service.rb +0 -42
  104. data/lib/adwords_api/v201309/budget_order_service_registry.rb +0 -46
  105. data/lib/adwords_api/v201309/budget_service.rb +0 -38
  106. data/lib/adwords_api/v201309/budget_service_registry.rb +0 -46
  107. data/lib/adwords_api/v201309/campaign_ad_extension_service.rb +0 -38
  108. data/lib/adwords_api/v201309/campaign_ad_extension_service_registry.rb +0 -46
  109. data/lib/adwords_api/v201309/campaign_criterion_service.rb +0 -42
  110. data/lib/adwords_api/v201309/campaign_criterion_service_registry.rb +0 -46
  111. data/lib/adwords_api/v201309/campaign_feed_service.rb +0 -38
  112. data/lib/adwords_api/v201309/campaign_feed_service_registry.rb +0 -46
  113. data/lib/adwords_api/v201309/campaign_service.rb +0 -42
  114. data/lib/adwords_api/v201309/campaign_service_registry.rb +0 -46
  115. data/lib/adwords_api/v201309/campaign_shared_set_service.rb +0 -38
  116. data/lib/adwords_api/v201309/campaign_shared_set_service_registry.rb +0 -47
  117. data/lib/adwords_api/v201309/constant_data_service.rb +0 -62
  118. data/lib/adwords_api/v201309/constant_data_service_registry.rb +0 -46
  119. data/lib/adwords_api/v201309/conversion_tracker_service.rb +0 -38
  120. data/lib/adwords_api/v201309/conversion_tracker_service_registry.rb +0 -46
  121. data/lib/adwords_api/v201309/customer_service.rb +0 -34
  122. data/lib/adwords_api/v201309/customer_service_registry.rb +0 -46
  123. data/lib/adwords_api/v201309/customer_sync_service.rb +0 -34
  124. data/lib/adwords_api/v201309/customer_sync_service_registry.rb +0 -47
  125. data/lib/adwords_api/v201309/data_service.rb +0 -38
  126. data/lib/adwords_api/v201309/data_service_registry.rb +0 -46
  127. data/lib/adwords_api/v201309/experiment_service.rb +0 -38
  128. data/lib/adwords_api/v201309/experiment_service_registry.rb +0 -46
  129. data/lib/adwords_api/v201309/feed_item_service.rb +0 -38
  130. data/lib/adwords_api/v201309/feed_item_service_registry.rb +0 -46
  131. data/lib/adwords_api/v201309/feed_mapping_service.rb +0 -38
  132. data/lib/adwords_api/v201309/feed_mapping_service_registry.rb +0 -46
  133. data/lib/adwords_api/v201309/feed_service.rb +0 -38
  134. data/lib/adwords_api/v201309/feed_service_registry.rb +0 -46
  135. data/lib/adwords_api/v201309/geo_location_service.rb +0 -34
  136. data/lib/adwords_api/v201309/geo_location_service_registry.rb +0 -46
  137. data/lib/adwords_api/v201309/location_criterion_service.rb +0 -34
  138. data/lib/adwords_api/v201309/location_criterion_service_registry.rb +0 -46
  139. data/lib/adwords_api/v201309/managed_customer_service.rb +0 -50
  140. data/lib/adwords_api/v201309/managed_customer_service_registry.rb +0 -46
  141. data/lib/adwords_api/v201309/media_service.rb +0 -38
  142. data/lib/adwords_api/v201309/media_service_registry.rb +0 -46
  143. data/lib/adwords_api/v201309/mutate_job_service.rb +0 -42
  144. data/lib/adwords_api/v201309/mutate_job_service_registry.rb +0 -46
  145. data/lib/adwords_api/v201309/offline_conversion_feed_service.rb +0 -34
  146. data/lib/adwords_api/v201309/offline_conversion_feed_service_registry.rb +0 -46
  147. data/lib/adwords_api/v201309/report_definition_service.rb +0 -34
  148. data/lib/adwords_api/v201309/report_definition_service_registry.rb +0 -46
  149. data/lib/adwords_api/v201309/shared_criterion_service.rb +0 -38
  150. data/lib/adwords_api/v201309/shared_criterion_service_registry.rb +0 -47
  151. data/lib/adwords_api/v201309/shared_set_service.rb +0 -38
  152. data/lib/adwords_api/v201309/shared_set_service_registry.rb +0 -47
  153. data/lib/adwords_api/v201309/targeting_idea_service.rb +0 -38
  154. data/lib/adwords_api/v201309/targeting_idea_service_registry.rb +0 -46
  155. data/lib/adwords_api/v201309/traffic_estimator_service.rb +0 -34
  156. data/lib/adwords_api/v201309/traffic_estimator_service_registry.rb +0 -46
  157. data/test/bugs/test_issue_00000031.rb +0 -75
@@ -15,28 +15,28 @@ def setup_mocks()
15
15
  with(:body => {"Email"=>"noreply@google.com", "Passwd"=>"noreply_password", "accountType"=>"GOOGLE", "service"=>"adwords"}).
16
16
  to_return(:status => 200, :body => "SID=abcSIDbcd\nLSID=abcLSIDbcd\nAuth=abcAuthbcd\n", :headers => {})
17
17
 
18
- stub_request(:post, "https://adwords.google.com/api/adwords/cm/v201309/CampaignService").
18
+ stub_request(:post, "https://adwords.google.com/api/adwords/cm/v201402/CampaignService").
19
19
  with(
20
20
  :body =>
21
21
  # autogenerated code
22
22
  {"env:Envelope"=>
23
23
  {"env:Header"=>
24
24
  {"wsdl:RequestHeader"=>
25
- {"userAgent"=>"ruby-tests (AwApi-Ruby/0.11.2, Common-Ruby/0.9.6, Savon/1.2.0, ruby/1.9.3, HTTPI/1.1.1, net_http)",
25
+ {"userAgent"=>"ruby-tests (AwApi-Ruby/0.13.0, Common-Ruby/0.9.6, Savon/1.2.0, ruby/1.9.3, HTTPI/1.1.1, net_http)",
26
26
  "developerToken"=>"dev_token123",
27
27
  "clientCustomerId"=>"123-456-7890",
28
28
  "authToken"=>"abcAuthbcd",
29
- "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201309"}},
29
+ "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201402"}},
30
30
  "env:Body"=>
31
31
  {"get"=>
32
32
  {"serviceSelector"=>
33
33
  {"fields"=>["Id", "Name", "Status"],
34
34
  "ordering"=>{"field"=>"Name", "sortOrder"=>"ASCENDING"},
35
35
  "paging"=>{"startIndex"=>"0", "numberResults"=>"5"}},
36
- "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201309"}},
36
+ "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201402"}},
37
37
  "xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema",
38
38
  "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
39
- "xmlns:wsdl"=>"https://adwords.google.com/api/adwords/cm/v201309",
39
+ "xmlns:wsdl"=>"https://adwords.google.com/api/adwords/cm/v201402",
40
40
  "xmlns:env"=>"http://schemas.xmlsoap.org/soap/envelope/"}},
41
41
  # end of auto-generated code.
42
42
  :headers => {
@@ -48,7 +48,7 @@ def setup_mocks()
48
48
  :status => 200,
49
49
  :body => '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
50
50
  <soap:Header>
51
- <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201309">
51
+ <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201402">
52
52
  <requestId>0004c</requestId>
53
53
  <serviceName>CampaignService</serviceName>
54
54
  <methodName>get</methodName>
@@ -58,7 +58,7 @@ def setup_mocks()
58
58
  </ResponseHeader>
59
59
  </soap:Header>
60
60
  <soap:Body>
61
- <getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201309">
61
+ <getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201402">
62
62
  <rval>
63
63
  <totalNumEntries>2</totalNumEntries>
64
64
  <Page.Type>CampaignPage</Page.Type>
@@ -33,26 +33,26 @@ def setup_mocks()
33
33
  :body => "{\n \"access_token\" : \"ab01.CBEF2GHi3JKlMnOpqRstUvW4X-YzaBcdEFG5IjKLMNPPqRStuV\",\n \"token_type\" : \"Bearer\",\n \"expires_in\" : 3600\n}",
34
34
  :headers => {"Content-Type"=>"application/json"})
35
35
 
36
- stub_request(:post, "https://adwords.google.com/api/adwords/cm/v201309/CampaignService").
36
+ stub_request(:post, "https://adwords.google.com/api/adwords/cm/v201402/CampaignService").
37
37
  with(
38
38
  :body =>
39
39
  # autogenerated code
40
40
  {"env:Envelope"=>
41
41
  {"env:Header"=>
42
42
  {"wsdl:RequestHeader"=>
43
- {"userAgent"=>"ruby-tests (AwApi-Ruby/0.11.2, Common-Ruby/0.9.6, Savon/1.2.0, ruby/1.9.3, HTTPI/1.1.1, net_http)",
43
+ {"userAgent"=>"ruby-tests (AwApi-Ruby/0.13.0, Common-Ruby/0.9.6, Savon/1.2.0, ruby/1.9.3, HTTPI/1.1.1, net_http)",
44
44
  "developerToken"=>"dev_token123",
45
45
  "clientCustomerId"=>"123-456-7890",
46
- "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201309"}},
46
+ "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201402"}},
47
47
  "env:Body"=>
48
48
  {"get"=>
49
49
  {"serviceSelector"=>
50
50
  {"fields"=>["Id", "Name", "Status"],
51
51
  "ordering"=>{"field"=>"Name", "sortOrder"=>"ASCENDING"}},
52
- "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201309"}},
52
+ "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201402"}},
53
53
  "xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema",
54
54
  "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
55
- "xmlns:wsdl"=>"https://adwords.google.com/api/adwords/cm/v201309",
55
+ "xmlns:wsdl"=>"https://adwords.google.com/api/adwords/cm/v201402",
56
56
  "xmlns:env"=>"http://schemas.xmlsoap.org/soap/envelope/"}},
57
57
  # end of auto-generated code.
58
58
  :headers => {
@@ -65,7 +65,7 @@ def setup_mocks()
65
65
  :status => 200,
66
66
  :body => '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
67
67
  <soap:Header>
68
- <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201309">
68
+ <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201402">
69
69
  <requestId>0004c</requestId>
70
70
  <serviceName>CampaignService</serviceName>
71
71
  <methodName>get</methodName>
@@ -75,7 +75,7 @@ def setup_mocks()
75
75
  </ResponseHeader>
76
76
  </soap:Header>
77
77
  <soap:Body>
78
- <getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201309">
78
+ <getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201402">
79
79
  <rval>
80
80
  <totalNumEntries>2</totalNumEntries>
81
81
  <Page.Type>CampaignPage</Page.Type>
@@ -0,0 +1,114 @@
1
+ def setup_mocks()
2
+ $api_config = {
3
+ :service => {:environment => 'PRODUCTION'},
4
+ :authentication => {
5
+ :method => 'ClientLogin',
6
+ :email => 'noreply@google.com',
7
+ :password => 'noreply_password',
8
+ :developer_token => 'dev_token123',
9
+ :client_customer_id => '123-456-7890',
10
+ :user_agent => 'ruby-tests'
11
+ }
12
+ }
13
+
14
+ stub_request(:post, "https://www.google.com/accounts/ClientLogin").
15
+ with(:body => {"Email"=>"noreply@google.com", "Passwd"=>"noreply_password", "accountType"=>"GOOGLE", "service"=>"adwords"}).
16
+ to_return(:status => 200, :body => "SID=abcSIDbcd\nLSID=abcLSIDbcd\nAuth=abcAuthbcd\n", :headers => {})
17
+
18
+ stub_request(:post, "https://adwords.google.com/api/adwords/cm/v201406/CampaignService").
19
+ with(
20
+ :body =>
21
+ # autogenerated code
22
+ {"env:Envelope"=>
23
+ {"env:Header"=>
24
+ {"wsdl:RequestHeader"=>
25
+ {"userAgent"=>"ruby-tests (AwApi-Ruby/0.13.0, Common-Ruby/0.9.6, Savon/1.2.0, ruby/1.9.3, HTTPI/1.1.1, net_http)",
26
+ "developerToken"=>"dev_token123",
27
+ "clientCustomerId"=>"123-456-7890",
28
+ "authToken"=>"abcAuthbcd",
29
+ "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201406"}},
30
+ "env:Body"=>
31
+ {"get"=>
32
+ {"serviceSelector"=>
33
+ {"fields"=>["Id", "Name", "Status"],
34
+ "ordering"=>{"field"=>"Name", "sortOrder"=>"ASCENDING"},
35
+ "paging"=>{"startIndex"=>"0", "numberResults"=>"5"}},
36
+ "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201406"}},
37
+ "xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema",
38
+ "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
39
+ "xmlns:wsdl"=>"https://adwords.google.com/api/adwords/cm/v201406",
40
+ "xmlns:env"=>"http://schemas.xmlsoap.org/soap/envelope/"}},
41
+ # end of auto-generated code.
42
+ :headers => {
43
+ 'SOAPAction' => '"get"',
44
+ 'Content-Type' => 'text/xml;charset=UTF-8'
45
+ }
46
+ ).
47
+ to_return(
48
+ :status => 200,
49
+ :body => '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
50
+ <soap:Header>
51
+ <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201406">
52
+ <requestId>0004c</requestId>
53
+ <serviceName>CampaignService</serviceName>
54
+ <methodName>get</methodName>
55
+ <operations>42</operations>
56
+ <responseTime>84</responseTime>
57
+ <units>42</units>
58
+ </ResponseHeader>
59
+ </soap:Header>
60
+ <soap:Body>
61
+ <getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201406">
62
+ <rval>
63
+ <totalNumEntries>2</totalNumEntries>
64
+ <Page.Type>CampaignPage</Page.Type>
65
+ <totalBudget>
66
+ <period>DAILY</period><amount><ComparableValue.Type>Money</ComparableValue.Type>
67
+ <microAmount>0</microAmount></amount>
68
+ </totalBudget>
69
+ <entries>
70
+ <id>15</id><name>Campaign name 1</name><status>PAUSED</status><campaignStats><network>ALL</network>
71
+ <Stats.Type>CampaignStats</Stats.Type></campaignStats><frequencyCap><impressions>0</impressions></frequencyCap>
72
+ </entries>
73
+ <entries>
74
+ <id>16</id><name>Campaign name 2</name><status>ACTIVE</status><campaignStats><network>ALL</network>
75
+ <Stats.Type>CampaignStats</Stats.Type></campaignStats><frequencyCap><impressions>150</impressions></frequencyCap>
76
+ </entries>
77
+ </rval>
78
+ </getResponse>
79
+ </soap:Body>
80
+ </soap:Envelope>',
81
+ :headers => {'content-type' => 'text/xml;'}
82
+ )
83
+ end
84
+
85
+ def run_asserts()
86
+ assert_equal(2, $latest_result[:total_num_entries])
87
+ assert_equal('CampaignPage', $latest_result[:page_type])
88
+ entries = $latest_result[:entries]
89
+ assert_equal(2, entries.size)
90
+
91
+ if entries[0][:id] == 15
92
+ assert_campaign_15(entries[0])
93
+ assert_campaign_16(entries[1])
94
+ else
95
+ assert_campaign_15(entries[1])
96
+ assert_campaign_16(entries[0])
97
+ end
98
+ end
99
+
100
+ def assert_campaign_15(entry)
101
+ assert_equal(15, entry[:id])
102
+ assert_equal('Campaign name 1', entry[:name])
103
+ assert_equal('PAUSED', entry[:status])
104
+ assert_equal({:network=>"ALL", :stats_type=>"CampaignStats"}, entry[:campaign_stats])
105
+ assert_equal({:impressions=>0}, entry[:frequency_cap])
106
+ end
107
+
108
+ def assert_campaign_16(entry)
109
+ assert_equal(16, entry[:id])
110
+ assert_equal('Campaign name 2', entry[:name])
111
+ assert_equal('ACTIVE', entry[:status])
112
+ assert_equal({:network=>"ALL", :stats_type=>"CampaignStats"}, entry[:campaign_stats])
113
+ assert_equal({:impressions=>150}, entry[:frequency_cap])
114
+ end
@@ -0,0 +1,131 @@
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_JWT',
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'=>'*/*', 'Cache-Control'=>'no-store', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Ruby'}).
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/v201406/CampaignService").
37
+ with(
38
+ :body =>
39
+ # autogenerated code
40
+ {"env:Envelope"=>
41
+ {"env:Header"=>
42
+ {"wsdl:RequestHeader"=>
43
+ {"userAgent"=>"ruby-tests (AwApi-Ruby/0.13.0, Common-Ruby/0.9.6, Savon/1.2.0, ruby/1.9.3, HTTPI/1.1.1, net_http)",
44
+ "developerToken"=>"dev_token123",
45
+ "clientCustomerId"=>"123-456-7890",
46
+ "xmlns"=>"https://adwords.google.com/api/adwords/cm/v201406"}},
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/v201406"}},
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/v201406",
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/v201406">
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/v201406">
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-adwords-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danial Klimkin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-09 00:00:00.000000000 Z
12
+ date: 2014-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-ads-common
@@ -37,68 +37,6 @@ files:
37
37
  - ChangeLog
38
38
  - README.md
39
39
  - adwords_api.yml
40
- - examples/v201309/account_management/create_account.rb
41
- - examples/v201309/account_management/get_account_alerts.rb
42
- - examples/v201309/account_management/get_account_changes.rb
43
- - examples/v201309/account_management/get_account_hierarchy.rb
44
- - examples/v201309/advanced_operations/add_ad_group_bid_modifier.rb
45
- - examples/v201309/advanced_operations/add_click_to_download_ad.rb
46
- - examples/v201309/advanced_operations/add_site_links.rb
47
- - examples/v201309/advanced_operations/create_and_attach_shared_keyword_set.rb
48
- - examples/v201309/advanced_operations/find_and_remove_criteria_from_shared_set.rb
49
- - examples/v201309/advanced_operations/get_ad_group_bid_modifiers.rb
50
- - examples/v201309/advanced_operations/update_site_links.rb
51
- - examples/v201309/advanced_operations/upload_offline_conversions.rb
52
- - examples/v201309/advanced_operations/use_shared_bidding_strategy.rb
53
- - examples/v201309/basic_operations/add_ad_groups.rb
54
- - examples/v201309/basic_operations/add_campaigns.rb
55
- - examples/v201309/basic_operations/add_keywords.rb
56
- - examples/v201309/basic_operations/add_text_ads.rb
57
- - examples/v201309/basic_operations/delete_ad.rb
58
- - examples/v201309/basic_operations/delete_ad_group.rb
59
- - examples/v201309/basic_operations/delete_campaign.rb
60
- - examples/v201309/basic_operations/delete_keyword.rb
61
- - examples/v201309/basic_operations/get_ad_groups.rb
62
- - examples/v201309/basic_operations/get_campaigns.rb
63
- - examples/v201309/basic_operations/get_campaigns_with_awql.rb
64
- - examples/v201309/basic_operations/get_keywords.rb
65
- - examples/v201309/basic_operations/get_text_ads.rb
66
- - examples/v201309/basic_operations/pause_ad.rb
67
- - examples/v201309/basic_operations/update_ad_group.rb
68
- - examples/v201309/basic_operations/update_campaign.rb
69
- - examples/v201309/basic_operations/update_keyword.rb
70
- - examples/v201309/campaign_management/add_experiment.rb
71
- - examples/v201309/campaign_management/add_keywords_in_bulk.rb
72
- - examples/v201309/campaign_management/add_location_extension.rb
73
- - examples/v201309/campaign_management/get_all_disapproved_ads.rb
74
- - examples/v201309/campaign_management/get_all_disapproved_ads_with_awql.rb
75
- - examples/v201309/campaign_management/promote_experiment.rb
76
- - examples/v201309/campaign_management/set_ad_parameters.rb
77
- - examples/v201309/campaign_management/set_criterion_bid_modifier.rb
78
- - examples/v201309/campaign_management/validate_text_ad.rb
79
- - examples/v201309/error_handling/handle_captcha_challenge.rb
80
- - examples/v201309/error_handling/handle_partial_failures.rb
81
- - examples/v201309/error_handling/handle_policy_violation_error.rb
82
- - examples/v201309/error_handling/handle_two_factor_authorization_error.rb
83
- - examples/v201309/misc/get_all_images_and_videos.rb
84
- - examples/v201309/misc/setup_oauth2.rb
85
- - examples/v201309/misc/upload_image.rb
86
- - examples/v201309/misc/use_oauth2_jwt.rb
87
- - examples/v201309/optimization/estimate_keyword_traffic.rb
88
- - examples/v201309/optimization/get_keyword_bid_simulations.rb
89
- - examples/v201309/optimization/get_keyword_ideas.rb
90
- - examples/v201309/optimization/get_placement_ideas.rb
91
- - examples/v201309/remarketing/add_audience.rb
92
- - examples/v201309/remarketing/add_conversion_tracker.rb
93
- - examples/v201309/reporting/download_criteria_report.rb
94
- - examples/v201309/reporting/download_criteria_report_with_awql.rb
95
- - examples/v201309/reporting/get_report_fields.rb
96
- - examples/v201309/reporting/parallel_report_download.rb
97
- - examples/v201309/targeting/add_campaign_targeting_criteria.rb
98
- - examples/v201309/targeting/add_demographic_targeting_criteria.rb
99
- - examples/v201309/targeting/get_campaign_targeting_criteria.rb
100
- - examples/v201309/targeting/get_targetable_languages_and_carriers.rb
101
- - examples/v201309/targeting/lookup_location.rb
102
40
  - examples/v201402/account_management/create_account.rb
103
41
  - examples/v201402/account_management/get_account_alerts.rb
104
42
  - examples/v201402/account_management/get_account_changes.rb
@@ -117,7 +55,9 @@ files:
117
55
  - examples/v201402/basic_operations/add_text_ads.rb
118
56
  - examples/v201402/basic_operations/delete_ad.rb
119
57
  - examples/v201402/basic_operations/delete_ad_group.rb
58
+ - examples/v201402/basic_operations/delete_ad_group.rb~
120
59
  - examples/v201402/basic_operations/delete_campaign.rb
60
+ - examples/v201402/basic_operations/delete_campaign.rb~
121
61
  - examples/v201402/basic_operations/delete_keyword.rb
122
62
  - examples/v201402/basic_operations/get_ad_groups.rb
123
63
  - examples/v201402/basic_operations/get_campaigns.rb
@@ -191,7 +131,9 @@ files:
191
131
  - examples/v201406/basic_operations/pause_ad.rb
192
132
  - examples/v201406/basic_operations/remove_ad.rb
193
133
  - examples/v201406/basic_operations/remove_ad_group.rb
134
+ - examples/v201406/basic_operations/remove_ad_group.rb~
194
135
  - examples/v201406/basic_operations/remove_campaign.rb
136
+ - examples/v201406/basic_operations/remove_campaign.rb~
195
137
  - examples/v201406/basic_operations/remove_keyword.rb
196
138
  - examples/v201406/basic_operations/update_ad_group.rb
197
139
  - examples/v201406/basic_operations/update_campaign.rb
@@ -243,79 +185,8 @@ files:
243
185
  - lib/adwords_api/errors.rb
244
186
  - lib/adwords_api/report_header_handler.rb
245
187
  - lib/adwords_api/report_utils.rb
188
+ - lib/adwords_api/report_utils.rb~
246
189
  - lib/adwords_api/utils.rb
247
- - lib/adwords_api/v201309/ad_group_ad_service.rb
248
- - lib/adwords_api/v201309/ad_group_ad_service_registry.rb
249
- - lib/adwords_api/v201309/ad_group_bid_modifier_service.rb
250
- - lib/adwords_api/v201309/ad_group_bid_modifier_service_registry.rb
251
- - lib/adwords_api/v201309/ad_group_criterion_service.rb
252
- - lib/adwords_api/v201309/ad_group_criterion_service_registry.rb
253
- - lib/adwords_api/v201309/ad_group_feed_service.rb
254
- - lib/adwords_api/v201309/ad_group_feed_service_registry.rb
255
- - lib/adwords_api/v201309/ad_group_service.rb
256
- - lib/adwords_api/v201309/ad_group_service_registry.rb
257
- - lib/adwords_api/v201309/ad_param_service.rb
258
- - lib/adwords_api/v201309/ad_param_service_registry.rb
259
- - lib/adwords_api/v201309/adwords_user_list_service.rb
260
- - lib/adwords_api/v201309/adwords_user_list_service_registry.rb
261
- - lib/adwords_api/v201309/alert_service.rb
262
- - lib/adwords_api/v201309/alert_service_registry.rb
263
- - lib/adwords_api/v201309/bidding_strategy_service.rb
264
- - lib/adwords_api/v201309/bidding_strategy_service_registry.rb
265
- - lib/adwords_api/v201309/budget_order_service.rb
266
- - lib/adwords_api/v201309/budget_order_service_registry.rb
267
- - lib/adwords_api/v201309/budget_service.rb
268
- - lib/adwords_api/v201309/budget_service_registry.rb
269
- - lib/adwords_api/v201309/campaign_ad_extension_service.rb
270
- - lib/adwords_api/v201309/campaign_ad_extension_service_registry.rb
271
- - lib/adwords_api/v201309/campaign_criterion_service.rb
272
- - lib/adwords_api/v201309/campaign_criterion_service_registry.rb
273
- - lib/adwords_api/v201309/campaign_feed_service.rb
274
- - lib/adwords_api/v201309/campaign_feed_service_registry.rb
275
- - lib/adwords_api/v201309/campaign_service.rb
276
- - lib/adwords_api/v201309/campaign_service_registry.rb
277
- - lib/adwords_api/v201309/campaign_shared_set_service.rb
278
- - lib/adwords_api/v201309/campaign_shared_set_service_registry.rb
279
- - lib/adwords_api/v201309/constant_data_service.rb
280
- - lib/adwords_api/v201309/constant_data_service_registry.rb
281
- - lib/adwords_api/v201309/conversion_tracker_service.rb
282
- - lib/adwords_api/v201309/conversion_tracker_service_registry.rb
283
- - lib/adwords_api/v201309/customer_service.rb
284
- - lib/adwords_api/v201309/customer_service_registry.rb
285
- - lib/adwords_api/v201309/customer_sync_service.rb
286
- - lib/adwords_api/v201309/customer_sync_service_registry.rb
287
- - lib/adwords_api/v201309/data_service.rb
288
- - lib/adwords_api/v201309/data_service_registry.rb
289
- - lib/adwords_api/v201309/experiment_service.rb
290
- - lib/adwords_api/v201309/experiment_service_registry.rb
291
- - lib/adwords_api/v201309/feed_item_service.rb
292
- - lib/adwords_api/v201309/feed_item_service_registry.rb
293
- - lib/adwords_api/v201309/feed_mapping_service.rb
294
- - lib/adwords_api/v201309/feed_mapping_service_registry.rb
295
- - lib/adwords_api/v201309/feed_service.rb
296
- - lib/adwords_api/v201309/feed_service_registry.rb
297
- - lib/adwords_api/v201309/geo_location_service.rb
298
- - lib/adwords_api/v201309/geo_location_service_registry.rb
299
- - lib/adwords_api/v201309/location_criterion_service.rb
300
- - lib/adwords_api/v201309/location_criterion_service_registry.rb
301
- - lib/adwords_api/v201309/managed_customer_service.rb
302
- - lib/adwords_api/v201309/managed_customer_service_registry.rb
303
- - lib/adwords_api/v201309/media_service.rb
304
- - lib/adwords_api/v201309/media_service_registry.rb
305
- - lib/adwords_api/v201309/mutate_job_service.rb
306
- - lib/adwords_api/v201309/mutate_job_service_registry.rb
307
- - lib/adwords_api/v201309/offline_conversion_feed_service.rb
308
- - lib/adwords_api/v201309/offline_conversion_feed_service_registry.rb
309
- - lib/adwords_api/v201309/report_definition_service.rb
310
- - lib/adwords_api/v201309/report_definition_service_registry.rb
311
- - lib/adwords_api/v201309/shared_criterion_service.rb
312
- - lib/adwords_api/v201309/shared_criterion_service_registry.rb
313
- - lib/adwords_api/v201309/shared_set_service.rb
314
- - lib/adwords_api/v201309/shared_set_service_registry.rb
315
- - lib/adwords_api/v201309/targeting_idea_service.rb
316
- - lib/adwords_api/v201309/targeting_idea_service_registry.rb
317
- - lib/adwords_api/v201309/traffic_estimator_service.rb
318
- - lib/adwords_api/v201309/traffic_estimator_service_registry.rb
319
190
  - lib/adwords_api/v201402/ad_group_ad_service.rb
320
191
  - lib/adwords_api/v201402/ad_group_ad_service_registry.rb
321
192
  - lib/adwords_api/v201402/ad_group_bid_modifier_service.rb
@@ -467,17 +338,21 @@ files:
467
338
  - lib/adwords_api/v201406/traffic_estimator_service.rb
468
339
  - lib/adwords_api/v201406/traffic_estimator_service_registry.rb
469
340
  - lib/adwords_api/version.rb
341
+ - lib/adwords_api/version.rb~
470
342
  - test/adwords_api/test_adwords_api.rb
343
+ - test/adwords_api/test_adwords_api.rb~
471
344
  - test/adwords_api/test_api_config.rb
472
345
  - test/adwords_api/test_credential_handler.rb
473
346
  - test/adwords_api/test_report_utils.rb
347
+ - test/adwords_api/test_report_utils.rb~
474
348
  - test/adwords_api/test_utils.rb
475
- - test/bugs/test_issue_00000031.rb
476
349
  - test/coverage.rb
477
350
  - test/suite_integration.rb
478
351
  - test/suite_unittests.rb
479
- - test/templates/v201309/basic_operations_get_campaigns.def
480
- - test/templates/v201309/misc_use_oauth2_jwt.def
352
+ - test/templates/v201402/basic_operations_get_campaigns.def
353
+ - test/templates/v201402/misc_use_oauth2_jwt.def
354
+ - test/templates/v201406/basic_operations_get_campaigns.def
355
+ - test/templates/v201406/misc_use_oauth2_jwt.def
481
356
  - test/test_utils.rb
482
357
  homepage: http://code.google.com/p/google-api-ads-ruby/
483
358
  licenses: