google-adwords-api 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. data/ChangeLog +7 -0
  2. data/README +4 -4
  3. data/examples/v201109_1/account_management/create_account.rb +80 -0
  4. data/examples/v201109_1/account_management/get_account_alerts.rb +111 -0
  5. data/examples/v201109_1/account_management/get_account_changes.rb +137 -0
  6. data/examples/v201109_1/account_management/get_account_hierarchy.rb +93 -0
  7. data/examples/v201109_1/account_management/get_client_customer_id.rb +85 -0
  8. data/examples/v201109_1/account_management/get_client_unit_usage.rb +87 -0
  9. data/examples/v201109_1/basic_operations/add_ad_groups.rb +111 -0
  10. data/examples/v201109_1/basic_operations/add_campaigns.rb +140 -0
  11. data/examples/v201109_1/basic_operations/add_keywords.rb +108 -0
  12. data/examples/v201109_1/basic_operations/add_text_ads.rb +105 -0
  13. data/examples/v201109_1/basic_operations/delete_ad.rb +85 -0
  14. data/examples/v201109_1/basic_operations/delete_ad_group.rb +102 -0
  15. data/examples/v201109_1/basic_operations/delete_campaign.rb +103 -0
  16. data/examples/v201109_1/basic_operations/delete_keyword.rb +90 -0
  17. data/examples/v201109_1/basic_operations/get_ad_groups.rb +98 -0
  18. data/examples/v201109_1/basic_operations/get_campaigns.rb +93 -0
  19. data/examples/v201109_1/basic_operations/get_keywords.rb +104 -0
  20. data/examples/v201109_1/basic_operations/get_text_ads.rb +106 -0
  21. data/examples/v201109_1/basic_operations/pause_ad.rb +84 -0
  22. data/examples/v201109_1/basic_operations/update_ad_group.rb +81 -0
  23. data/examples/v201109_1/basic_operations/update_campaign.rb +84 -0
  24. data/examples/v201109_1/basic_operations/update_keyword.rb +99 -0
  25. data/examples/v201109_1/campaign_management/add_experiment.rb +158 -0
  26. data/examples/v201109_1/campaign_management/add_keywords_in_bulk.rb +150 -0
  27. data/examples/v201109_1/campaign_management/add_location_extension.rb +117 -0
  28. data/examples/v201109_1/campaign_management/add_location_extension_override.rb +83 -0
  29. data/examples/v201109_1/campaign_management/get_all_disapproved_ads.rb +93 -0
  30. data/examples/v201109_1/campaign_management/promote_experiment.rb +77 -0
  31. data/examples/v201109_1/campaign_management/set_ad_parameters.rb +114 -0
  32. data/examples/v201109_1/campaign_management/validate_text_ad.rb +106 -0
  33. data/examples/v201109_1/error_handling/handle_captcha_challenge.rb +93 -0
  34. data/examples/v201109_1/error_handling/handle_partial_failures.rb +126 -0
  35. data/examples/v201109_1/error_handling/handle_policy_violation_error.rb +137 -0
  36. data/examples/v201109_1/error_handling/handle_two_factor_authorization_error.rb +87 -0
  37. data/examples/v201109_1/misc/get_all_images_and_videos.rb +101 -0
  38. data/examples/v201109_1/misc/upload_image.rb +90 -0
  39. data/examples/v201109_1/misc/use_oauth.rb +97 -0
  40. data/examples/v201109_1/optimization/estimate_keyword_traffic.rb +129 -0
  41. data/examples/v201109_1/optimization/get_keyword_bid_simulations.rb +92 -0
  42. data/examples/v201109_1/optimization/get_keyword_ideas.rb +113 -0
  43. data/examples/v201109_1/optimization/get_placement_ideas.rb +106 -0
  44. data/examples/v201109_1/remarketing/add_audience.rb +115 -0
  45. data/examples/v201109_1/remarketing/add_conversion_tracker.rb +97 -0
  46. data/examples/v201109_1/reporting/download_criteria_report.rb +79 -0
  47. data/examples/v201109_1/reporting/get_campaign_stats.rb +105 -0
  48. data/examples/v201109_1/reporting/get_defined_reports.rb +75 -0
  49. data/examples/{v201109/reporting/download_defined_report.rb → v201109_1/reporting/get_report_fields.rb} +15 -11
  50. data/examples/v201109_1/reporting/parallel_report_download.rb +159 -0
  51. data/examples/v201109_1/targeting/add_campaign_targeting_criteria.rb +118 -0
  52. data/examples/v201109_1/targeting/get_campaign_targeting_criteria.rb +102 -0
  53. data/examples/v201109_1/targeting/get_targetable_languages_and_carriers.rb +86 -0
  54. data/examples/v201109_1/targeting/lookup_location.rb +103 -0
  55. data/lib/adwords_api.rb +15 -88
  56. data/lib/adwords_api/api_config.rb +75 -33
  57. data/lib/adwords_api/client_login_header_handler.rb +17 -26
  58. data/lib/adwords_api/credential_handler.rb +29 -65
  59. data/lib/adwords_api/report_header_handler.rb +65 -0
  60. data/lib/adwords_api/report_utils.rb +12 -36
  61. data/lib/adwords_api/v201109/ad_extension_override_service.rb +3 -3
  62. data/lib/adwords_api/v201109/ad_extension_override_service_registry.rb +2 -2
  63. data/lib/adwords_api/v201109/ad_group_ad_service.rb +3 -3
  64. data/lib/adwords_api/v201109/ad_group_ad_service_registry.rb +1 -1
  65. data/lib/adwords_api/v201109/ad_group_criterion_service.rb +3 -3
  66. data/lib/adwords_api/v201109/ad_group_criterion_service_registry.rb +1 -1
  67. data/lib/adwords_api/v201109/ad_group_service.rb +3 -3
  68. data/lib/adwords_api/v201109/ad_group_service_registry.rb +1 -1
  69. data/lib/adwords_api/v201109/ad_param_service.rb +3 -3
  70. data/lib/adwords_api/v201109/ad_param_service_registry.rb +1 -1
  71. data/lib/adwords_api/v201109/alert_service.rb +3 -3
  72. data/lib/adwords_api/v201109/alert_service_registry.rb +1 -1
  73. data/lib/adwords_api/v201109/budget_order_service.rb +42 -0
  74. data/lib/adwords_api/v201109/budget_order_service_registry.rb +46 -0
  75. data/lib/adwords_api/v201109/bulk_mutate_job_service.rb +3 -3
  76. data/lib/adwords_api/v201109/bulk_mutate_job_service_registry.rb +1 -1
  77. data/lib/adwords_api/v201109/campaign_ad_extension_service.rb +3 -3
  78. data/lib/adwords_api/v201109/campaign_ad_extension_service_registry.rb +2 -2
  79. data/lib/adwords_api/v201109/campaign_criterion_service.rb +3 -3
  80. data/lib/adwords_api/v201109/campaign_criterion_service_registry.rb +1 -1
  81. data/lib/adwords_api/v201109/campaign_service.rb +3 -3
  82. data/lib/adwords_api/v201109/campaign_service_registry.rb +1 -1
  83. data/lib/adwords_api/v201109/campaign_target_service.rb +3 -3
  84. data/lib/adwords_api/v201109/campaign_target_service_registry.rb +1 -1
  85. data/lib/adwords_api/v201109/constant_data_service.rb +3 -3
  86. data/lib/adwords_api/v201109/constant_data_service_registry.rb +1 -1
  87. data/lib/adwords_api/v201109/conversion_tracker_service.rb +3 -3
  88. data/lib/adwords_api/v201109/conversion_tracker_service_registry.rb +1 -1
  89. data/lib/adwords_api/v201109/create_account_service.rb +3 -3
  90. data/lib/adwords_api/v201109/create_account_service_registry.rb +1 -1
  91. data/lib/adwords_api/v201109/customer_sync_service.rb +3 -3
  92. data/lib/adwords_api/v201109/customer_sync_service_registry.rb +1 -1
  93. data/lib/adwords_api/v201109/data_service.rb +3 -3
  94. data/lib/adwords_api/v201109/data_service_registry.rb +1 -1
  95. data/lib/adwords_api/v201109/experiment_service.rb +3 -3
  96. data/lib/adwords_api/v201109/experiment_service_registry.rb +1 -1
  97. data/lib/adwords_api/v201109/geo_location_service.rb +3 -3
  98. data/lib/adwords_api/v201109/geo_location_service_registry.rb +1 -1
  99. data/lib/adwords_api/v201109/info_service.rb +3 -3
  100. data/lib/adwords_api/v201109/info_service_registry.rb +1 -1
  101. data/lib/adwords_api/v201109/location_criterion_service.rb +3 -3
  102. data/lib/adwords_api/v201109/location_criterion_service_registry.rb +1 -1
  103. data/lib/adwords_api/v201109/media_service.rb +3 -3
  104. data/lib/adwords_api/v201109/media_service_registry.rb +1 -1
  105. data/lib/adwords_api/v201109/mutate_job_service.rb +3 -3
  106. data/lib/adwords_api/v201109/mutate_job_service_registry.rb +1 -1
  107. data/lib/adwords_api/v201109/report_definition_service.rb +3 -12
  108. data/lib/adwords_api/v201109/report_definition_service_registry.rb +1 -1
  109. data/lib/adwords_api/v201109/serviced_account_service.rb +3 -3
  110. data/lib/adwords_api/v201109/serviced_account_service_registry.rb +1 -1
  111. data/lib/adwords_api/v201109/targeting_idea_service.rb +3 -3
  112. data/lib/adwords_api/v201109/targeting_idea_service_registry.rb +1 -1
  113. data/lib/adwords_api/v201109/traffic_estimator_service.rb +3 -3
  114. data/lib/adwords_api/v201109/traffic_estimator_service_registry.rb +1 -1
  115. data/lib/adwords_api/v201109/user_list_service.rb +3 -3
  116. data/lib/adwords_api/v201109/user_list_service_registry.rb +1 -1
  117. data/lib/adwords_api/v201109_1/ad_extension_override_service.rb +38 -0
  118. data/lib/adwords_api/v201109_1/ad_extension_override_service_registry.rb +46 -0
  119. data/lib/adwords_api/v201109_1/ad_group_ad_service.rb +38 -0
  120. data/lib/adwords_api/v201109_1/ad_group_ad_service_registry.rb +46 -0
  121. data/lib/adwords_api/v201109_1/ad_group_criterion_service.rb +38 -0
  122. data/lib/adwords_api/v201109_1/ad_group_criterion_service_registry.rb +46 -0
  123. data/lib/adwords_api/v201109_1/ad_group_service.rb +38 -0
  124. data/lib/adwords_api/v201109_1/ad_group_service_registry.rb +46 -0
  125. data/lib/adwords_api/v201109_1/ad_param_service.rb +38 -0
  126. data/lib/adwords_api/v201109_1/ad_param_service_registry.rb +46 -0
  127. data/lib/adwords_api/v201109_1/alert_service.rb +34 -0
  128. data/lib/adwords_api/v201109_1/alert_service_registry.rb +46 -0
  129. data/lib/adwords_api/v201109_1/budget_order_service.rb +42 -0
  130. data/lib/adwords_api/v201109_1/budget_order_service_registry.rb +46 -0
  131. data/lib/adwords_api/v201109_1/bulk_mutate_job_service.rb +38 -0
  132. data/lib/adwords_api/v201109_1/bulk_mutate_job_service_registry.rb +46 -0
  133. data/lib/adwords_api/v201109_1/campaign_ad_extension_service.rb +38 -0
  134. data/lib/adwords_api/v201109_1/campaign_ad_extension_service_registry.rb +46 -0
  135. data/lib/adwords_api/v201109_1/campaign_criterion_service.rb +38 -0
  136. data/lib/adwords_api/v201109_1/campaign_criterion_service_registry.rb +46 -0
  137. data/lib/adwords_api/v201109_1/campaign_service.rb +38 -0
  138. data/lib/adwords_api/v201109_1/campaign_service_registry.rb +46 -0
  139. data/lib/adwords_api/v201109_1/campaign_target_service.rb +38 -0
  140. data/lib/adwords_api/v201109_1/campaign_target_service_registry.rb +46 -0
  141. data/lib/adwords_api/v201109_1/constant_data_service.rb +38 -0
  142. data/lib/adwords_api/v201109_1/constant_data_service_registry.rb +46 -0
  143. data/lib/adwords_api/v201109_1/conversion_tracker_service.rb +38 -0
  144. data/lib/adwords_api/v201109_1/conversion_tracker_service_registry.rb +46 -0
  145. data/lib/adwords_api/v201109_1/create_account_service.rb +34 -0
  146. data/lib/adwords_api/v201109_1/create_account_service_registry.rb +47 -0
  147. data/lib/adwords_api/v201109_1/customer_sync_service.rb +34 -0
  148. data/lib/adwords_api/v201109_1/customer_sync_service_registry.rb +47 -0
  149. data/lib/adwords_api/v201109_1/data_service.rb +38 -0
  150. data/lib/adwords_api/v201109_1/data_service_registry.rb +46 -0
  151. data/lib/adwords_api/v201109_1/experiment_service.rb +38 -0
  152. data/lib/adwords_api/v201109_1/experiment_service_registry.rb +46 -0
  153. data/lib/adwords_api/v201109_1/geo_location_service.rb +34 -0
  154. data/lib/adwords_api/v201109_1/geo_location_service_registry.rb +46 -0
  155. data/lib/adwords_api/v201109_1/info_service.rb +34 -0
  156. data/lib/adwords_api/v201109_1/info_service_registry.rb +46 -0
  157. data/lib/adwords_api/v201109_1/location_criterion_service.rb +34 -0
  158. data/lib/adwords_api/v201109_1/location_criterion_service_registry.rb +46 -0
  159. data/lib/adwords_api/v201109_1/media_service.rb +38 -0
  160. data/lib/adwords_api/v201109_1/media_service_registry.rb +46 -0
  161. data/lib/adwords_api/v201109_1/mutate_job_service.rb +42 -0
  162. data/lib/adwords_api/v201109_1/mutate_job_service_registry.rb +46 -0
  163. data/lib/adwords_api/v201109_1/report_definition_service.rb +38 -0
  164. data/lib/adwords_api/v201109_1/report_definition_service_registry.rb +46 -0
  165. data/lib/adwords_api/v201109_1/serviced_account_service.rb +34 -0
  166. data/lib/adwords_api/v201109_1/serviced_account_service_registry.rb +46 -0
  167. data/lib/adwords_api/v201109_1/targeting_idea_service.rb +38 -0
  168. data/lib/adwords_api/v201109_1/targeting_idea_service_registry.rb +46 -0
  169. data/lib/adwords_api/v201109_1/traffic_estimator_service.rb +34 -0
  170. data/lib/adwords_api/v201109_1/traffic_estimator_service_registry.rb +46 -0
  171. data/lib/adwords_api/v201109_1/user_list_service.rb +38 -0
  172. data/lib/adwords_api/v201109_1/user_list_service_registry.rb +46 -0
  173. data/lib/adwords_api/version.rb +1 -1
  174. data/test/adwords_api/test_api_config.rb +24 -8
  175. data/test/adwords_api/test_credential_handler.rb +32 -52
  176. data/test/coverage.rb +38 -0
  177. data/test/examples/v201109/test_reporting.rb +0 -12
  178. data/test/examples/v201109_1/test_account_management.rb +60 -0
  179. data/test/examples/v201109_1/test_basic_operations.rb +172 -0
  180. data/test/examples/v201109_1/test_campaign_management.rb +116 -0
  181. data/test/examples/v201109_1/test_error_handling.rb +63 -0
  182. data/{lib/adwords_api/v13_login_handler.rb → test/examples/v201109_1/test_misc.rb} +24 -10
  183. data/test/examples/v201109_1/test_optimization.rb +63 -0
  184. data/test/{suite_exampletests.rb → examples/v201109_1/test_remarketing.rb} +16 -8
  185. data/test/examples/v201109_1/test_reporting.rb +77 -0
  186. data/test/examples/v201109_1/test_targeting.rb +60 -0
  187. data/test/examples/v201109_1/utils.rb +239 -0
  188. data/test/suite_exampletests_v201109.rb +37 -0
  189. data/test/suite_exampletests_v201109_1.rb +37 -0
  190. data/test/suite_unittests.rb +7 -5
  191. metadata +136 -11
  192. data/lib/adwords_api/extensions.rb +0 -269
@@ -0,0 +1,46 @@
1
+ # Encoding: utf-8
2
+ #
3
+ # This is auto-generated code, changes will be overwritten.
4
+ #
5
+ # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
6
+ # License:: Licensed under the Apache License, Version 2.0.
7
+ #
8
+ # Code generated by AdsCommon library 0.7.0 on 2012-05-09 17:48:19.
9
+
10
+ require 'adwords_api/errors'
11
+
12
+ module AdwordsApi; module V201109_1; module TrafficEstimatorService
13
+ class TrafficEstimatorServiceRegistry
14
+ TRAFFICESTIMATORSERVICE_METHODS = {:get=>{:input=>[{:name=>:selector, :type=>"TrafficEstimatorSelector", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_response", :fields=>[{:name=>:rval, :type=>"TrafficEstimatorResult", :min_occurs=>0, :max_occurs=>1}]}}}
15
+ TRAFFICESTIMATORSERVICE_TYPES = {:ComparableValue=>{:fields=>[{:name=>:comparable_value_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :ns=>0}, :Criterion=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"Criterion.Type", :min_occurs=>0, :max_occurs=>1}, {:name=>:criterion_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :DoubleValue=>{:fields=>[{:name=>:number, :type=>"double", :min_occurs=>0, :max_occurs=>1}], :base=>"NumberValue", :ns=>0}, :EntityAccessDenied=>{:fields=>[{:name=>:reason, :type=>"EntityAccessDenied.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :EntityNotFound=>{:fields=>[{:name=>:reason, :type=>"EntityNotFound.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :Keyword=>{:fields=>[{:name=>:text, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:match_type, :type=>"KeywordMatchType", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :Language=>{:fields=>[{:name=>:code, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :Location=>{:fields=>[{:name=>:location_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:display_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_obsolete, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:parent_locations, :type=>"Location", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Criterion", :ns=>0}, :LongValue=>{:fields=>[{:name=>:number, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"NumberValue", :ns=>0}, :Money=>{:fields=>[{:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"ComparableValue", :ns=>0}, :NetworkSetting=>{:fields=>[{:name=>:target_google_search, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:target_search_network, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:target_content_network, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:target_content_contextual, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:target_partner_search_network, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :NumberValue=>{:fields=>[], :abstract=>true, :base=>"ComparableValue", :ns=>0}, :OperationAccessDenied=>{:fields=>[{:name=>:reason, :type=>"OperationAccessDenied.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError", :ns=>0}, :Placement=>{:fields=>[{:name=>:url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :Product=>{:fields=>[{:name=>:conditions, :type=>"ProductCondition", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:text, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :ProductCondition=>{:fields=>[{:name=>:argument, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:operand, :type=>"ProductConditionOperand", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :ProductConditionOperand=>{:fields=>[{:name=>:operand, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :SoapHeader=>{:fields=>[{:name=>:auth_token, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:client_customer_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:developer_token, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_agent, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:validate_only, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:partial_failure, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:service_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:method_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:operations, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:units, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :CriterionUserInterest=>{:fields=>[{:name=>:user_interest_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_interest_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :CriterionUserList=>{:fields=>[{:name=>:user_list_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_list_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_list_membership_status, :type=>"CriterionUserList.MembershipStatus", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :Vertical=>{:fields=>[{:name=>:path, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Criterion", :ns=>0}, :"Criterion.Type"=>{:fields=>[], :ns=>0}, :KeywordMatchType=>{:fields=>[], :ns=>0}, :"CriterionUserList.MembershipStatus"=>{:fields=>[], :ns=>0}, :AdGroupEstimate=>{:fields=>[{:name=>:ad_group_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:keyword_estimates, :type=>"KeywordEstimate", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Estimate"}, :AdGroupEstimateRequest=>{:fields=>[{:name=>:ad_group_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:keyword_estimate_requests, :type=>"KeywordEstimateRequest", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:max_cpc, :type=>"Money", :min_occurs=>0, :max_occurs=>1}], :base=>"EstimateRequest"}, :CampaignEstimate=>{:fields=>[{:name=>:campaign_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_group_estimates, :type=>"AdGroupEstimate", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Estimate"}, :CampaignEstimateRequest=>{:fields=>[{:name=>:campaign_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_group_estimate_requests, :type=>"AdGroupEstimateRequest", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:criteria, :type=>"Criterion", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:network_setting, :type=>"NetworkSetting", :min_occurs=>0, :max_occurs=>1}, {:name=>:daily_budget, :type=>"Money", :min_occurs=>0, :max_occurs=>1}], :base=>"EstimateRequest"}, :Estimate=>{:fields=>[{:name=>:estimate_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :EstimateRequest=>{:fields=>[{:name=>:estimate_request_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :KeywordEstimate=>{:fields=>[{:name=>:criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:min, :type=>"StatsEstimate", :min_occurs=>0, :max_occurs=>1}, {:name=>:max, :type=>"StatsEstimate", :min_occurs=>0, :max_occurs=>1}], :base=>"Estimate"}, :KeywordEstimateRequest=>{:fields=>[{:name=>:keyword, :type=>"Keyword", :min_occurs=>0, :max_occurs=>1}, {:name=>:max_cpc, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_negative, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"EstimateRequest"}, :StatsEstimate=>{:fields=>[{:name=>:average_cpc, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:average_position, :type=>"double", :min_occurs=>0, :max_occurs=>1}, {:name=>:clicks_per_day, :type=>"float", :min_occurs=>0, :max_occurs=>1}, {:name=>:total_cost, :type=>"Money", :min_occurs=>0, :max_occurs=>1}]}, :TrafficEstimatorResult=>{:fields=>[{:name=>:campaign_estimates, :type=>"CampaignEstimate", :min_occurs=>0, :max_occurs=>:unbounded}]}, :TrafficEstimatorSelector=>{:fields=>[{:name=>:campaign_estimate_requests, :type=>"CampaignEstimateRequest", :min_occurs=>0, :max_occurs=>:unbounded}]}}
16
+ TRAFFICESTIMATORSERVICE_NAMESPACES = ["https://adwords.google.com/api/adwords/cm/v201109_1"]
17
+
18
+ def self.get_method_signature(method_name)
19
+ return TRAFFICESTIMATORSERVICE_METHODS[method_name.to_sym]
20
+ end
21
+
22
+ def self.get_type_signature(type_name)
23
+ return TRAFFICESTIMATORSERVICE_TYPES[type_name.to_sym]
24
+ end
25
+
26
+ def self.get_namespace(index)
27
+ return TRAFFICESTIMATORSERVICE_NAMESPACES[index]
28
+ end
29
+ end
30
+
31
+ # Base class for exceptions.
32
+ class ApplicationException < AdwordsApi::Errors::ApiException
33
+ attr_reader :message # string
34
+ attr_reader :application_exception_type # string
35
+ end
36
+
37
+ # Exception class for holding a list of service errors.
38
+ class ApiException < ApplicationException
39
+ attr_reader :errors # ApiError
40
+ def initialize(exception_fault)
41
+ @array_fields ||= []
42
+ @array_fields << 'errors'
43
+ super(exception_fault)
44
+ end
45
+ end
46
+ end; end; end
@@ -0,0 +1,38 @@
1
+ # Encoding: utf-8
2
+ #
3
+ # This is auto-generated code, changes will be overwritten.
4
+ #
5
+ # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
6
+ # License:: Licensed under the Apache License, Version 2.0.
7
+ #
8
+ # Code generated by AdsCommon library 0.7.0 on 2012-05-09 17:48:20.
9
+
10
+ require 'ads_common/savon_service'
11
+ require 'adwords_api/v201109_1/user_list_service_registry'
12
+
13
+ module AdwordsApi; module V201109_1; module UserListService
14
+ class UserListService < AdsCommon::SavonService
15
+ def initialize(config, endpoint)
16
+ namespace = 'https://adwords.google.com/api/adwords/cm/v201109_1'
17
+ super(config, endpoint, namespace, :v201109_1)
18
+ end
19
+
20
+ def get(*args, &block)
21
+ return execute_action('get', args, &block)
22
+ end
23
+
24
+ def mutate(*args, &block)
25
+ return execute_action('mutate', args, &block)
26
+ end
27
+
28
+ private
29
+
30
+ def get_service_registry()
31
+ return UserListServiceRegistry
32
+ end
33
+
34
+ def get_module()
35
+ return AdwordsApi::V201109_1::UserListService
36
+ end
37
+ end
38
+ end; end; end
@@ -0,0 +1,46 @@
1
+ # Encoding: utf-8
2
+ #
3
+ # This is auto-generated code, changes will be overwritten.
4
+ #
5
+ # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
6
+ # License:: Licensed under the Apache License, Version 2.0.
7
+ #
8
+ # Code generated by AdsCommon library 0.7.0 on 2012-05-09 17:48:20.
9
+
10
+ require 'adwords_api/errors'
11
+
12
+ module AdwordsApi; module V201109_1; module UserListService
13
+ class UserListServiceRegistry
14
+ USERLISTSERVICE_METHODS = {:get=>{:input=>[{:name=>:service_selector, :type=>"Selector", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_response", :fields=>[{:name=>:rval, :type=>"UserListPage", :min_occurs=>0, :max_occurs=>1}]}}, :mutate=>{:input=>[{:name=>:operations, :type=>"UserListOperation", :min_occurs=>0, :max_occurs=>:unbounded}], :output=>{:name=>"mutate_response", :fields=>[{:name=>:rval, :type=>"UserListReturnValue", :min_occurs=>0, :max_occurs=>1}]}}}
15
+ USERLISTSERVICE_TYPES = {:ExternalRemarketingUserList=>{:fields=>[], :base=>"UserList"}, :UserListConversionType=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:category, :type=>"UserListConversionType.Category", :min_occurs=>0, :max_occurs=>1}]}, :DateRange=>{:fields=>[{:name=>:min, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:max, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :ListReturnValue=>{:fields=>[{:name=>:list_return_value_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :LogicalUserList=>{:fields=>[{:name=>:rules, :type=>"UserListLogicalRule", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"UserList"}, :LogicalUserListOperand=>{:fields=>[]}, :Operation=>{:fields=>[{:name=>:operator, :type=>"Operator", :min_occurs=>0, :max_occurs=>1}, {:name=>:operation_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :OperationAccessDenied=>{:fields=>[{:name=>:reason, :type=>"OperationAccessDenied.Reason", :min_occurs=>0, :max_occurs=>1}], :base=>"ApiError"}, :OrderBy=>{:fields=>[{:name=>:field, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:sort_order, :type=>"SortOrder", :min_occurs=>0, :max_occurs=>1}]}, :Page=>{:fields=>[{:name=>:total_num_entries, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:page_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :Paging=>{:fields=>[{:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:number_results, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :Predicate=>{:fields=>[{:name=>:field, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:operator, :type=>"Predicate.Operator", :min_occurs=>0, :max_occurs=>1}, {:name=>:values, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}]}, :RemarketingUserList=>{:fields=>[{:name=>:conversion_types, :type=>"UserListConversionType", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"UserList"}, :Selector=>{:fields=>[{:name=>:fields, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:predicates, :type=>"Predicate", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:date_range, :type=>"DateRange", :min_occurs=>0, :max_occurs=>1}, {:name=>:ordering, :type=>"OrderBy", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:paging, :type=>"Paging", :min_occurs=>0, :max_occurs=>1}]}, :SoapHeader=>{:fields=>[{:name=>:auth_token, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:client_customer_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:developer_token, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_agent, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:validate_only, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:partial_failure, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}]}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:service_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:method_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:operations, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:units, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :UserInterest=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:size_range, :type=>"SizeRange", :min_occurs=>0, :max_occurs=>1}]}, :UserList=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:is_read_only, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:description, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:status, :type=>"UserListMembershipStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:access_reason, :type=>"AccessReason", :min_occurs=>0, :max_occurs=>1}, {:name=>:account_user_list_status, :type=>"AccountUserListStatus", :min_occurs=>0, :max_occurs=>1}, {:name=>:membership_life_span, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:size, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:size_range, :type=>"SizeRange", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"UserList.Type", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_list_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :UserListLogicalRule=>{:fields=>[{:name=>:operator, :type=>"UserListLogicalRule.Operator", :min_occurs=>0, :max_occurs=>1}, {:name=>:rule_operands, :type=>"LogicalUserListOperand", :min_occurs=>0, :max_occurs=>:unbounded}]}, :UserListOperation=>{:fields=>[{:name=>:operand, :type=>"UserList", :min_occurs=>0, :max_occurs=>1}], :base=>"Operation"}, :UserListPage=>{:fields=>[{:name=>:entries, :type=>"UserList", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Page"}, :UserListReturnValue=>{:fields=>[{:name=>:value, :type=>"UserList", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"ListReturnValue"}, :AccessReason=>{:fields=>[]}, :AccountUserListStatus=>{:fields=>[]}, :"UserListConversionType.Category"=>{:fields=>[]}, :Operator=>{:fields=>[]}, :"Predicate.Operator"=>{:fields=>[]}, :SizeRange=>{:fields=>[]}, :SortOrder=>{:fields=>[]}, :"UserList.Type"=>{:fields=>[]}, :"UserListLogicalRule.Operator"=>{:fields=>[]}, :UserListMembershipStatus=>{:fields=>[]}}
16
+ USERLISTSERVICE_NAMESPACES = []
17
+
18
+ def self.get_method_signature(method_name)
19
+ return USERLISTSERVICE_METHODS[method_name.to_sym]
20
+ end
21
+
22
+ def self.get_type_signature(type_name)
23
+ return USERLISTSERVICE_TYPES[type_name.to_sym]
24
+ end
25
+
26
+ def self.get_namespace(index)
27
+ return USERLISTSERVICE_NAMESPACES[index]
28
+ end
29
+ end
30
+
31
+ # Base class for exceptions.
32
+ class ApplicationException < AdwordsApi::Errors::ApiException
33
+ attr_reader :message # string
34
+ attr_reader :application_exception_type # string
35
+ end
36
+
37
+ # Exception class for holding a list of service errors.
38
+ class ApiException < ApplicationException
39
+ attr_reader :errors # ApiError
40
+ def initialize(exception_fault)
41
+ @array_fields ||= []
42
+ @array_fields << 'errors'
43
+ super(exception_fault)
44
+ end
45
+ end
46
+ end; end; end
@@ -21,6 +21,6 @@
21
21
 
22
22
  module AdwordsApi
23
23
  module ApiConfig
24
- CLIENT_LIB_VERSION = '0.5.3'
24
+ CLIENT_LIB_VERSION = '0.6.0'
25
25
  end
26
26
  end
@@ -25,26 +25,42 @@ require 'test/unit'
25
25
  require 'adwords_api/api_config'
26
26
 
27
27
  class TestApiConfig < Test::Unit::TestCase
28
- # Initialize tests.
29
- def setup
28
+ # Initializes tests.
29
+ def setup()
30
30
  @config = AdwordsApi::ApiConfig
31
31
  end
32
32
 
33
- # Test correct require path.
34
- def test_do_require
33
+ # Tests correct require path.
34
+ def test_do_require()
35
35
  name1 = @config.do_require(:v201109, :InfoService)
36
36
  assert_equal('adwords_api/v201109/info_service', name1)
37
37
  end
38
38
 
39
- # Test correct module name.
40
- def test_module_name
39
+ # Tests correct module name.
40
+ def test_module_name()
41
41
  name1 = @config.module_name(:v201109, :InfoService)
42
42
  assert_equal('AdwordsApi::V201109::InfoService', name1)
43
43
  end
44
44
 
45
- # Test correct interface name.
46
- def test_interface_name
45
+ # Tests correct interface name.
46
+ def test_interface_name()
47
47
  name1 = @config.interface_name(:v201109, :InfoService)
48
48
  assert_equal('AdwordsApi::V201109::InfoService::InfoService', name1)
49
49
  end
50
+
51
+ # Tests AdHoc report URL generator (prod).
52
+ def test_adhoc_report_download_url_prod()
53
+ url = AdwordsApi::ApiConfig.adhoc_report_download_url(:PRODUCTION, :v201109)
54
+ expected_url =
55
+ 'https://adwords.google.com/api/adwords/reportdownload/v201109'
56
+ assert_equal(expected_url, url)
57
+ end
58
+
59
+ # Tests AdHoc report URL generator (sandbox).
60
+ def test_adhoc_report_download_url_sandbox()
61
+ url = AdwordsApi::ApiConfig.adhoc_report_download_url(:SANDBOX, :v201109)
62
+ expected_url =
63
+ 'https://adwords-sandbox.google.com/api/adwords/reportdownload/v201109'
64
+ assert_equal(expected_url, url)
65
+ end
50
66
  end
@@ -20,86 +20,66 @@
20
20
  #
21
21
  # Tests credential handler.
22
22
 
23
+ require 'logger'
23
24
  require 'test/unit'
24
25
 
25
- require 'adwords_api'
26
+ require 'ads_common/config'
27
+ require 'adwords_api/credential_handler'
26
28
 
27
29
  # Overriding default access levels to public for tests.
28
30
  module AdwordsApi
31
+
29
32
  class CredentialHandler
30
33
  public :validate_headers_for_server
31
34
  end
32
35
  end
33
36
 
37
+
34
38
  class TestCredentialHandler < Test::Unit::TestCase
35
- def test_validate_headers_for_server_client_email
36
- config = AdsCommon::Config.new(
37
- {:authentication => {:client_email => 'email@example.com'}})
38
- handler = AdwordsApi::CredentialHandler.new(config)
39
- assert_nothing_raised do
40
- handler.validate_headers_for_server(:v201101)
41
- end
39
+
40
+ def setup()
41
+ logger = Logger.new(STDERR)
42
+ config = AdsCommon::Config.new({:library => {:logger => logger}})
43
+ @handler = AdwordsApi::CredentialHandler.new(config)
44
+ end
45
+
46
+ def test_validate_headers_for_server_client_email()
47
+ credentials = {:client_email => 'email@example.com'}
42
48
  assert_raise(AdwordsApi::Errors::BadCredentialsError) do
43
- handler.validate_headers_for_server(:v201109)
49
+ @handler.validate_headers_for_server(credentials)
44
50
  end
45
51
  end
46
52
 
47
- def test_validate_headers_for_server_client_customer_id
48
- config = AdsCommon::Config.new(
49
- {:authentication => {:client_customer_id => '123-456-7890'}})
50
- handler = AdwordsApi::CredentialHandler.new(config)
51
- assert_nothing_raised do
52
- handler.validate_headers_for_server(:v201101)
53
- handler.validate_headers_for_server(:v201109)
54
- end
53
+ def test_validate_headers_for_server_client_customer_id()
54
+ credentials = {:client_customer_id => '123-456-7890'}
55
+ assert_nothing_raised {@handler.validate_headers_for_server(credentials)}
55
56
  end
56
57
 
57
- def test_validate_headers_for_server_valid_cid
58
- config = AdsCommon::Config.new(
59
- {:authentication => {:client_customer_id => '123-456-7890'}})
60
- handler = AdwordsApi::CredentialHandler.new(config)
61
- assert_nothing_raised do
62
- handler.validate_headers_for_server(:v201109)
63
- end
58
+ def test_validate_headers_for_server_valid_cid()
59
+ credentials1 = {:client_customer_id => '123-456-7890'}
60
+ assert_nothing_raised {@handler.validate_headers_for_server(credentials1)}
64
61
 
65
- config = AdsCommon::Config.new(
66
- {:authentication => {:client_customer_id => '1234567890'}})
67
- handler = AdwordsApi::CredentialHandler.new(config)
68
- assert_nothing_raised do
69
- handler.validate_headers_for_server(:v201109)
70
- end
62
+ credentials2 = {:client_customer_id => '1234567890'}
63
+ assert_nothing_raised {@handler.validate_headers_for_server(credentials2)}
71
64
 
72
- config = AdsCommon::Config.new(
73
- {:authentication => {:client_customer_id => 1234567890}})
74
- handler = AdwordsApi::CredentialHandler.new(config)
75
- assert_nothing_raised do
76
- handler.validate_headers_for_server(:v201109)
77
- end
65
+ credentials3 = {:client_customer_id => 1234567890}
66
+ assert_nothing_raised {@handler.validate_headers_for_server(credentials3)}
78
67
  end
79
68
 
80
- def test_validate_headers_for_server_invalid_cid
81
- config = AdsCommon::Config.new(
82
- {:authentication => {:client_customer_id => 'demo@example.com'}})
83
- handler = AdwordsApi::CredentialHandler.new(config)
69
+ def test_validate_headers_for_server_invalid_cid()
70
+ credentials1 = {:client_customer_id => 'demo@example.com'}
84
71
  assert_raise(AdwordsApi::Errors::BadCredentialsError) do
85
- handler.validate_headers_for_server(:v201109)
72
+ @handler.validate_headers_for_server(credentials1)
86
73
  end
87
74
 
88
- config = AdsCommon::Config.new({
89
- :authentication => {
90
- :client_customer_id => 'demo@example.com 1234567890'
91
- }
92
- })
93
- handler = AdwordsApi::CredentialHandler.new(config)
75
+ credentials2 = {:client_customer_id => 'demo@example.com 1234567890'}
94
76
  assert_raise(AdwordsApi::Errors::BadCredentialsError) do
95
- handler.validate_headers_for_server(:v201109)
77
+ @handler.validate_headers_for_server(credentials2)
96
78
  end
97
79
 
98
- config = AdsCommon::Config.new(
99
- {:authentication => {:client_customer_id => '123-456-7890-'}})
100
- handler = AdwordsApi::CredentialHandler.new(config)
80
+ credentials3 = {:client_customer_id => '123-456-7890-'}
101
81
  assert_raise(AdwordsApi::Errors::BadCredentialsError) do
102
- handler.validate_headers_for_server(:v201109)
82
+ @handler.validate_headers_for_server(credentials3)
103
83
  end
104
84
  end
105
85
  end
data/test/coverage.rb ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
5
+ #
6
+ # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
7
+ #
8
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
+ # implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+ # Runs test with coverage tool.
22
+
23
+ require 'simplecov'
24
+
25
+ SimpleCov.start do
26
+ # Skipping auto-generated code.
27
+ add_filter '/adwords_api/v\d+/'
28
+ end
29
+
30
+ $:.unshift File.expand_path('../../', __FILE__)
31
+ require File.join(File.dirname(__FILE__), 'suite_unittests.rb')
32
+
33
+ # Now loading all files in the library to make sure we hit all untested files.
34
+ lib_base_path = File.expand_path('../../lib', __FILE__)
35
+ $:.unshift lib_base_path
36
+
37
+ code_files_mask = File.join(lib_base_path, '**/*.rb')
38
+ Dir.glob(code_files_mask).each {|file| require file}
@@ -24,7 +24,6 @@ require 'test/unit'
24
24
  require 'tempfile'
25
25
 
26
26
  require 'reporting/download_criteria_report'
27
- require 'reporting/download_defined_report'
28
27
  require 'reporting/get_campaign_stats'
29
28
  require 'reporting/get_defined_reports'
30
29
  require 'reporting/get_report_fields'
@@ -53,17 +52,6 @@ class TestReportingV201109 < Test::Unit::TestCase
53
52
  end
54
53
  end
55
54
 
56
- def test_download_defined_report
57
- report_definition_id = '1234567890'
58
- file = Tempfile.new('ruby-examples')
59
- begin
60
- file.close()
61
- download_defined_report(report_definition_id, file.path)
62
- ensure
63
- file.unlink()
64
- end
65
- end
66
-
67
55
  def test_get_campaign_stats
68
56
  get_campaign_stats()
69
57
  end
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
5
+ #
6
+ # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
7
+ #
8
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
+ # implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+ # Tests the account managements examples.
22
+
23
+ require 'test/unit'
24
+
25
+ require 'account_management/create_account'
26
+ require 'account_management/get_account_alerts'
27
+ require 'account_management/get_account_changes'
28
+ require 'account_management/get_account_hierarchy'
29
+ require 'account_management/get_client_customer_id'
30
+ require 'account_management/get_client_unit_usage'
31
+
32
+ class TestAccountManagementV201109_1 < Test::Unit::TestCase
33
+ def setup
34
+ end
35
+
36
+ # This test is disabled to avoid creating too many accounts.
37
+ def disabled_test_create_account
38
+ create_account()
39
+ end
40
+
41
+ def test_get_account_alerts
42
+ get_account_alerts()
43
+ end
44
+
45
+ def test_get_account_changes
46
+ get_account_changes()
47
+ end
48
+
49
+ def test_get_account_hierarchy
50
+ get_account_hierarchy()
51
+ end
52
+
53
+ def test_get_client_customer_id
54
+ get_client_customer_id('user@example.com')
55
+ end
56
+
57
+ def test_get_client_unit_usage
58
+ get_client_unit_usage(1234567890)
59
+ end
60
+ end
@@ -0,0 +1,172 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
5
+ #
6
+ # Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
7
+ #
8
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
+ # implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+ # Tests the basic operations examples.
22
+
23
+ require 'test/unit'
24
+
25
+ require 'basic_operations/add_ad_groups'
26
+ require 'basic_operations/add_campaigns'
27
+ require 'basic_operations/add_keywords'
28
+ require 'basic_operations/add_text_ads'
29
+ require 'basic_operations/delete_ad_group'
30
+ require 'basic_operations/delete_ad'
31
+ require 'basic_operations/delete_campaign'
32
+ require 'basic_operations/delete_keyword'
33
+ require 'basic_operations/get_ad_groups'
34
+ require 'basic_operations/get_campaigns'
35
+ require 'basic_operations/get_keywords'
36
+ require 'basic_operations/get_text_ads'
37
+ require 'basic_operations/pause_ad'
38
+ require 'basic_operations/update_ad_group'
39
+ require 'basic_operations/update_campaign'
40
+ require 'basic_operations/update_keyword'
41
+
42
+ class TestBasicOperationsV201109_1 < Test::Unit::TestCase
43
+ def setup
44
+ @logger = Logger.new(STDOUT)
45
+ @logger.level = Logger::ERROR
46
+ @adwords = AdwordsApi::Api.new
47
+ @adwords.logger = @logger
48
+ @utils = UtilsV201109_1.new(@adwords)
49
+ end
50
+
51
+ def test_add_campaigns
52
+ add_campaigns()
53
+ end
54
+
55
+ def test_get_campaigns
56
+ get_campaigns()
57
+ end
58
+
59
+ def test_add_ad_groups
60
+ campaign = @utils.get_campaign()
61
+ assert_not_nil(campaign)
62
+ assert_not_nil(campaign[:id])
63
+ add_ad_groups(campaign[:id])
64
+ end
65
+
66
+ def test_add_keywords
67
+ ad_group = @utils.get_ad_group()
68
+ assert_not_nil(ad_group)
69
+ assert_not_nil(ad_group[:id])
70
+ add_keywords(ad_group[:id])
71
+ end
72
+
73
+ def test_get_keywords
74
+ ad_group = @utils.get_ad_group()
75
+ assert_not_nil(ad_group)
76
+ assert_not_nil(ad_group[:id])
77
+ get_keywords(ad_group[:id])
78
+ end
79
+
80
+ def test_add_text_ads
81
+ ad_group = @utils.get_ad_group()
82
+ assert_not_nil(ad_group)
83
+ assert_not_nil(ad_group[:id])
84
+ add_text_ads(ad_group[:id])
85
+ end
86
+
87
+ def test_get_text_ads
88
+ ad_group = @utils.get_ad_group()
89
+ assert_not_nil(ad_group)
90
+ assert_not_nil(ad_group[:id])
91
+ get_text_ads(ad_group[:id])
92
+ end
93
+
94
+ def test_pause_ad
95
+ ad_group = @utils.get_ad_group()
96
+ assert_not_nil(ad_group)
97
+ assert_not_nil(ad_group[:id])
98
+ ad = @utils.get_ad()
99
+ assert_not_nil(ad)
100
+ assert_not_nil(ad[:ad])
101
+ assert_not_nil(ad[:ad][:id])
102
+ pause_ad(ad_group[:id], ad[:ad][:id])
103
+ end
104
+
105
+ def test_update_ad_group
106
+ ad_group = @utils.get_ad_group()
107
+ assert_not_nil(ad_group)
108
+ assert_not_nil(ad_group[:id])
109
+ update_ad_group(ad_group[:id])
110
+ end
111
+
112
+ def test_update_campaign
113
+ campaign = @utils.get_campaign()
114
+ assert_not_nil(campaign)
115
+ assert_not_nil(campaign[:id])
116
+ update_campaign(campaign[:id])
117
+ end
118
+
119
+ def test_update_keyword
120
+ ad_group = @utils.get_ad_group()
121
+ assert_not_nil(ad_group)
122
+ assert_not_nil(ad_group[:id])
123
+ keyword = @utils.get_keyword()
124
+ assert_not_nil(keyword)
125
+ assert_not_nil(keyword[:criterion])
126
+ assert_not_nil(keyword[:criterion][:id])
127
+ update_keyword(ad_group[:id], keyword[:criterion][:id])
128
+ end
129
+
130
+ def test_delete_keyword
131
+ ad_group = @utils.get_ad_group()
132
+ assert_not_nil(ad_group)
133
+ assert_not_nil(ad_group[:id])
134
+ keyword = @utils.get_keyword()
135
+ assert_not_nil(keyword)
136
+ assert_not_nil(keyword[:criterion])
137
+ assert_not_nil(keyword[:criterion][:id])
138
+ delete_keyword(ad_group[:id], keyword[:criterion][:id])
139
+ end
140
+
141
+ def test_delete_ad
142
+ ad_group = @utils.get_ad_group()
143
+ assert_not_nil(ad_group)
144
+ assert_not_nil(ad_group[:id])
145
+ ad = @utils.get_ad()
146
+ assert_not_nil(ad)
147
+ assert_not_nil(ad[:ad])
148
+ assert_not_nil(ad[:ad][:id])
149
+ delete_ad(ad_group[:id], ad[:ad][:id])
150
+ end
151
+
152
+ def test_delete_ad_group
153
+ ad_group = @utils.get_ad_group()
154
+ assert_not_nil(ad_group)
155
+ assert_not_nil(ad_group[:id])
156
+ delete_ad_group(ad_group[:id])
157
+ end
158
+
159
+ def test_delete_campaign
160
+ campaign = @utils.get_campaign()
161
+ assert_not_nil(campaign)
162
+ assert_not_nil(campaign[:id])
163
+ delete_campaign(campaign[:id])
164
+ end
165
+
166
+ def test_get_ad_groups
167
+ campaign = @utils.get_campaign()
168
+ assert_not_nil(campaign)
169
+ assert_not_nil(campaign[:id])
170
+ get_ad_groups(campaign[:id])
171
+ end
172
+ end