google-adwords-api 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +9 -0
- data/README +26 -10
- data/Rakefile +1 -1
- data/examples/v200909/add_ad_group.rb +2 -2
- data/examples/v200909/add_ads.rb +4 -4
- data/examples/v200909/add_campaign.rb +2 -2
- data/examples/v200909/check_campaigns.rb +4 -4
- data/examples/v201003/add_ad_group.rb +2 -2
- data/examples/v201003/add_ads.rb +6 -6
- data/examples/v201003/add_campaign.rb +2 -2
- data/examples/v201003/add_keywords_performance_report_definition.rb +2 -2
- data/examples/v201003/check_campaigns.rb +4 -4
- data/examples/v201008/add_ad_group.rb +2 -2
- data/examples/v201008/add_ads.rb +7 -7
- data/examples/v201008/add_campaign.rb +2 -2
- data/examples/v201008/add_experiment.rb +5 -5
- data/examples/v201008/add_keywords_performance_report_definition.rb +2 -2
- data/examples/v201008/add_user_list.rb +2 -2
- data/examples/v201008/check_campaigns.rb +4 -4
- data/examples/v201008/get_account_hierarchy.rb +8 -11
- data/examples/v201101/add_ad_group.rb +2 -2
- data/examples/v201101/add_ads.rb +6 -6
- data/examples/v201101/add_campaign.rb +2 -2
- data/examples/v201101/add_conversion.rb +4 -4
- data/examples/v201101/add_experiment.rb +5 -5
- data/examples/v201101/add_keywords_performance_report_definition.rb +2 -2
- data/examples/v201101/add_user_list.rb +3 -3
- data/examples/v201101/check_campaigns.rb +4 -4
- data/examples/v201101/get_account_hierarchy.rb +7 -9
- data/examples/v201109/add_ad_extension_override.rb +82 -0
- data/examples/v201109/add_ad_group.rb +89 -0
- data/examples/v201109/add_ad_group_criteria.rb +109 -0
- data/examples/v201109/add_ads.rb +174 -0
- data/examples/v201109/add_campaign.rb +99 -0
- data/examples/v201109/add_campaign_ad_extension.rb +121 -0
- data/examples/v201109/add_campaign_targeting_criteria.rb +102 -0
- data/examples/{v201101/add_mcc_report_definition.rb → v201109/add_conversion.rb} +26 -28
- data/examples/v201109/add_experiment.rb +153 -0
- data/examples/v201109/add_negative_campaign_criterion.rb +87 -0
- data/examples/v201109/add_user_list.rb +113 -0
- data/examples/v201109/check_campaigns.rb +123 -0
- data/examples/v201109/delete_ad.rb +85 -0
- data/examples/v201109/delete_ad_group.rb +77 -0
- data/examples/v201109/delete_ad_group_criterion.rb +86 -0
- data/examples/v201109/delete_bulk_mutate_job.rb +87 -0
- data/examples/v201109/delete_campaign.rb +78 -0
- data/examples/v201109/delete_experiment.rb +78 -0
- data/examples/v201109/delete_user_list.rb +78 -0
- data/examples/v201109/download_adhoc_report.rb +79 -0
- data/examples/v201109/download_report.rb +67 -0
- data/examples/v201109/get_account_hierarchy.rb +93 -0
- data/examples/v201109/get_ad_group_bid_landscape.rb +94 -0
- data/examples/v201109/get_all_account_changes.rb +137 -0
- data/examples/v201109/get_all_active_ad_group_criteria.rb +98 -0
- data/examples/v201109/get_all_ad_extension_overrides.rb +82 -0
- data/examples/v201109/get_all_ad_group_criteria.rb +90 -0
- data/examples/v201109/get_all_ad_groups.rb +85 -0
- data/examples/v201109/get_all_ad_params.rb +86 -0
- data/examples/v201109/get_all_ads.rb +90 -0
- data/examples/v201109/get_all_campaign_ad_extensions.rb +87 -0
- data/examples/v201109/get_all_campaign_targets.rb +74 -0
- data/examples/v201109/get_all_campaigns.rb +77 -0
- data/examples/v201109/get_all_carriers.rb +72 -0
- data/examples/v201109/get_all_conversions.rb +79 -0
- data/examples/v201109/get_all_disapproved_ads.rb +93 -0
- data/examples/v201109/get_all_experiments.rb +89 -0
- data/examples/v201109/get_all_images.rb +82 -0
- data/examples/v201109/get_all_languages.rb +73 -0
- data/examples/v201109/get_all_paused_campaigns.rb +83 -0
- data/examples/v201109/get_all_report_definitions.rb +75 -0
- data/examples/v201109/get_all_user_lists.rb +78 -0
- data/examples/v201109/get_all_videos.rb +78 -0
- data/examples/v201109/get_bulk_mutate_job.rb +97 -0
- data/examples/v201109/get_campaign_alerts.rb +95 -0
- data/examples/v201109/get_client_customer_id.rb +87 -0
- data/examples/v201109/get_conversion_optimizer_eligibility.rb +93 -0
- data/examples/v201109/get_criterion_bid_landscape.rb +93 -0
- data/examples/v201109/get_geo_location_info.rb +99 -0
- data/examples/v201109/get_keyword_opportunities.rb +95 -0
- data/examples/v201109/get_location_criteria.rb +103 -0
- data/examples/v201109/get_method_cost.rb +87 -0
- data/examples/v201109/get_operation_count.rb +79 -0
- data/examples/v201109/get_related_keywords.rb +108 -0
- data/examples/v201109/get_related_placements.rb +107 -0
- data/examples/v201109/get_report_fields.rb +72 -0
- data/examples/v201109/get_total_usage_units_per_month.rb +74 -0
- data/examples/v201109/get_traffic_estimates.rb +129 -0
- data/examples/v201109/get_unit_count.rb +81 -0
- data/examples/v201109/handle_partial_failures.rb +127 -0
- data/examples/v201109/handle_policy_violation_error.rb +138 -0
- data/examples/v201109/handle_second_factor.rb +87 -0
- data/examples/v201109/oauth_handling.rb +95 -0
- data/examples/v201109/perform_bulk_mutate_job.rb +212 -0
- data/examples/v201109/perform_mutate_job.rb +177 -0
- data/examples/v201109/promote_experiment.rb +79 -0
- data/examples/v201109/set_ad_params.rb +115 -0
- data/examples/v201109/update_ad.rb +86 -0
- data/examples/v201109/update_ad_group.rb +81 -0
- data/examples/v201109/update_ad_group_criterion.rb +99 -0
- data/examples/v201109/update_campaign.rb +84 -0
- data/examples/v201109/update_conversion.rb +87 -0
- data/examples/v201109/update_user_list.rb +82 -0
- data/examples/v201109/upload_image.rb +90 -0
- data/lib/adwords_api.rb +54 -50
- data/lib/adwords_api/api_config.rb +70 -14
- data/lib/adwords_api/credential_handler.rb +32 -13
- data/lib/adwords_api/errors.rb +12 -0
- data/lib/adwords_api/extensions.rb +8 -118
- data/lib/adwords_api/report_utils.rb +198 -0
- data/lib/adwords_api/utils.rb +5 -2
- data/lib/adwords_api/v13/account_service.rb +11 -11
- data/lib/adwords_api/v13/account_service_registry.rb +5 -3
- data/lib/adwords_api/v13/report_service.rb +15 -15
- data/lib/adwords_api/v13/report_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/ad_extension_override_service.rb +5 -5
- data/lib/adwords_api/v200909/ad_extension_override_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/ad_group_ad_service.rb +5 -5
- data/lib/adwords_api/v200909/ad_group_ad_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/ad_group_criterion_service.rb +5 -5
- data/lib/adwords_api/v200909/ad_group_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/ad_group_service.rb +5 -5
- data/lib/adwords_api/v200909/ad_group_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/ad_param_service.rb +5 -5
- data/lib/adwords_api/v200909/ad_param_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/bulk_mutate_job_service.rb +5 -5
- data/lib/adwords_api/v200909/bulk_mutate_job_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/campaign_ad_extension_service.rb +5 -5
- data/lib/adwords_api/v200909/campaign_ad_extension_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/campaign_criterion_service.rb +5 -5
- data/lib/adwords_api/v200909/campaign_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/campaign_service.rb +5 -5
- data/lib/adwords_api/v200909/campaign_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/campaign_target_service.rb +5 -5
- data/lib/adwords_api/v200909/campaign_target_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/geo_location_service.rb +3 -3
- data/lib/adwords_api/v200909/geo_location_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/info_service.rb +3 -3
- data/lib/adwords_api/v200909/info_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/targeting_idea_service.rb +5 -5
- data/lib/adwords_api/v200909/targeting_idea_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/ad_extension_override_service.rb +5 -5
- data/lib/adwords_api/v201003/ad_extension_override_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/ad_group_ad_service.rb +5 -5
- data/lib/adwords_api/v201003/ad_group_ad_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/ad_group_criterion_service.rb +5 -5
- data/lib/adwords_api/v201003/ad_group_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/ad_group_service.rb +5 -5
- data/lib/adwords_api/v201003/ad_group_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/ad_param_service.rb +5 -5
- data/lib/adwords_api/v201003/ad_param_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/bid_landscape_service.rb +3 -3
- data/lib/adwords_api/v201003/bid_landscape_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/bulk_mutate_job_service.rb +5 -5
- data/lib/adwords_api/v201003/bulk_mutate_job_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/campaign_ad_extension_service.rb +5 -5
- data/lib/adwords_api/v201003/campaign_ad_extension_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/campaign_criterion_service.rb +5 -5
- data/lib/adwords_api/v201003/campaign_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/campaign_service.rb +5 -5
- data/lib/adwords_api/v201003/campaign_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/campaign_target_service.rb +5 -5
- data/lib/adwords_api/v201003/campaign_target_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/geo_location_service.rb +3 -3
- data/lib/adwords_api/v201003/geo_location_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/info_service.rb +3 -3
- data/lib/adwords_api/v201003/info_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/media_service.rb +5 -5
- data/lib/adwords_api/v201003/media_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/report_definition_service.rb +7 -7
- data/lib/adwords_api/v201003/report_definition_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/targeting_idea_service.rb +5 -5
- data/lib/adwords_api/v201003/targeting_idea_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/ad_extension_override_service.rb +5 -5
- data/lib/adwords_api/v201008/ad_extension_override_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/ad_group_ad_service.rb +5 -5
- data/lib/adwords_api/v201008/ad_group_ad_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/ad_group_criterion_service.rb +5 -5
- data/lib/adwords_api/v201008/ad_group_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/ad_group_service.rb +5 -5
- data/lib/adwords_api/v201008/ad_group_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/ad_param_service.rb +5 -5
- data/lib/adwords_api/v201008/ad_param_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/alert_service.rb +3 -3
- data/lib/adwords_api/v201008/alert_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/bid_landscape_service.rb +3 -3
- data/lib/adwords_api/v201008/bid_landscape_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/bulk_mutate_job_service.rb +5 -5
- data/lib/adwords_api/v201008/bulk_mutate_job_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/campaign_ad_extension_service.rb +5 -5
- data/lib/adwords_api/v201008/campaign_ad_extension_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/campaign_criterion_service.rb +5 -5
- data/lib/adwords_api/v201008/campaign_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/campaign_service.rb +5 -5
- data/lib/adwords_api/v201008/campaign_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/campaign_target_service.rb +5 -5
- data/lib/adwords_api/v201008/campaign_target_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/customer_sync_service.rb +3 -3
- data/lib/adwords_api/v201008/customer_sync_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/experiment_service.rb +5 -5
- data/lib/adwords_api/v201008/experiment_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/geo_location_service.rb +3 -3
- data/lib/adwords_api/v201008/geo_location_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/info_service.rb +3 -3
- data/lib/adwords_api/v201008/info_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/media_service.rb +5 -5
- data/lib/adwords_api/v201008/media_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/report_definition_service.rb +7 -7
- data/lib/adwords_api/v201008/report_definition_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/serviced_account_service.rb +3 -3
- data/lib/adwords_api/v201008/serviced_account_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/targeting_idea_service.rb +5 -5
- data/lib/adwords_api/v201008/targeting_idea_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/traffic_estimator_service.rb +3 -3
- data/lib/adwords_api/v201008/traffic_estimator_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/user_list_service.rb +5 -5
- data/lib/adwords_api/v201008/user_list_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/ad_extension_override_service.rb +5 -5
- data/lib/adwords_api/v201101/ad_extension_override_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/ad_group_ad_service.rb +5 -5
- data/lib/adwords_api/v201101/ad_group_ad_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/ad_group_criterion_service.rb +5 -5
- data/lib/adwords_api/v201101/ad_group_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/ad_group_service.rb +5 -5
- data/lib/adwords_api/v201101/ad_group_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/ad_param_service.rb +5 -5
- data/lib/adwords_api/v201101/ad_param_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/alert_service.rb +3 -3
- data/lib/adwords_api/v201101/alert_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/bulk_mutate_job_service.rb +5 -5
- data/lib/adwords_api/v201101/bulk_mutate_job_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/bulk_opportunity_service.rb +3 -3
- data/lib/adwords_api/v201101/bulk_opportunity_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/campaign_ad_extension_service.rb +5 -5
- data/lib/adwords_api/v201101/campaign_ad_extension_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/campaign_criterion_service.rb +5 -5
- data/lib/adwords_api/v201101/campaign_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/campaign_service.rb +5 -5
- data/lib/adwords_api/v201101/campaign_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/campaign_target_service.rb +5 -5
- data/lib/adwords_api/v201101/campaign_target_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/conversion_tracker_service.rb +5 -5
- data/lib/adwords_api/v201101/conversion_tracker_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/customer_sync_service.rb +3 -3
- data/lib/adwords_api/v201101/customer_sync_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/data_service.rb +5 -5
- data/lib/adwords_api/v201101/data_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/experiment_service.rb +5 -5
- data/lib/adwords_api/v201101/experiment_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/geo_location_service.rb +3 -3
- data/lib/adwords_api/v201101/geo_location_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/info_service.rb +3 -3
- data/lib/adwords_api/v201101/info_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/media_service.rb +5 -5
- data/lib/adwords_api/v201101/media_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/report_definition_service.rb +7 -15
- data/lib/adwords_api/v201101/report_definition_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/serviced_account_service.rb +3 -3
- data/lib/adwords_api/v201101/serviced_account_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/targeting_idea_service.rb +5 -5
- data/lib/adwords_api/v201101/targeting_idea_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/traffic_estimator_service.rb +3 -3
- data/lib/adwords_api/v201101/traffic_estimator_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/user_list_service.rb +5 -5
- data/lib/adwords_api/v201101/user_list_service_registry.rb +5 -3
- data/lib/adwords_api/v201109/ad_extension_override_service.rb +36 -0
- data/lib/adwords_api/v201109/ad_extension_override_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/ad_group_ad_service.rb +36 -0
- data/lib/adwords_api/v201109/ad_group_ad_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/ad_group_criterion_service.rb +36 -0
- data/lib/adwords_api/v201109/ad_group_criterion_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/ad_group_service.rb +36 -0
- data/lib/adwords_api/v201109/ad_group_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/ad_param_service.rb +36 -0
- data/lib/adwords_api/v201109/ad_param_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/alert_service.rb +32 -0
- data/lib/adwords_api/v201109/alert_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/bulk_mutate_job_service.rb +36 -0
- data/lib/adwords_api/v201109/bulk_mutate_job_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/bulk_opportunity_service.rb +32 -0
- data/lib/adwords_api/v201109/bulk_opportunity_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/campaign_ad_extension_service.rb +36 -0
- data/lib/adwords_api/v201109/campaign_ad_extension_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/campaign_criterion_service.rb +36 -0
- data/lib/adwords_api/v201109/campaign_criterion_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/campaign_service.rb +36 -0
- data/lib/adwords_api/v201109/campaign_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/campaign_target_service.rb +36 -0
- data/lib/adwords_api/v201109/campaign_target_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/constant_data_service.rb +36 -0
- data/lib/adwords_api/v201109/constant_data_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/conversion_tracker_service.rb +36 -0
- data/lib/adwords_api/v201109/conversion_tracker_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/customer_sync_service.rb +32 -0
- data/lib/adwords_api/v201109/customer_sync_service_registry.rb +45 -0
- data/lib/adwords_api/v201109/data_service.rb +36 -0
- data/lib/adwords_api/v201109/data_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/experiment_service.rb +36 -0
- data/lib/adwords_api/v201109/experiment_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/geo_location_service.rb +32 -0
- data/lib/adwords_api/v201109/geo_location_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/info_service.rb +32 -0
- data/lib/adwords_api/v201109/info_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/location_criterion_service.rb +32 -0
- data/lib/adwords_api/v201109/location_criterion_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/media_service.rb +36 -0
- data/lib/adwords_api/v201109/media_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/mutate_job_service.rb +40 -0
- data/lib/adwords_api/v201109/mutate_job_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/report_definition_service.rb +45 -0
- data/lib/adwords_api/v201109/report_definition_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/serviced_account_service.rb +32 -0
- data/lib/adwords_api/v201109/serviced_account_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/targeting_idea_service.rb +36 -0
- data/lib/adwords_api/v201109/targeting_idea_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/traffic_estimator_service.rb +32 -0
- data/lib/adwords_api/v201109/traffic_estimator_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/user_list_service.rb +36 -0
- data/lib/adwords_api/v201109/user_list_service_registry.rb +44 -0
- data/test/bugs/test_issue_00000031.rb +78 -0
- metadata +467 -342
- data/examples/v201101/download_mcc_report.rb +0 -113
- data/examples/v201101/download_mcc_report_as_file.rb +0 -114
- data/lib/adwords_api/v13/traffic_estimator_service.rb +0 -44
- data/lib/adwords_api/v13/traffic_estimator_service_registry.rb +0 -39
@@ -0,0 +1,177 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
|
+
#
|
7
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
+
# implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
# This code sample illustrates how to perform asynchronous requests using the
|
21
|
+
# MutateJobService.
|
22
|
+
#
|
23
|
+
# Tags: MutateJobService.mutate, MutateJobService.get,
|
24
|
+
# MutateJobService.getResult
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'adwords_api'
|
28
|
+
|
29
|
+
API_VERSION = :v201109
|
30
|
+
RETRY_INTERVAL = 30
|
31
|
+
RETRIES_COUNT = 30
|
32
|
+
KEYWORD_NUMBER = 100
|
33
|
+
|
34
|
+
def perform_mutate_job()
|
35
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
36
|
+
# when called without parameters.
|
37
|
+
adwords = AdwordsApi::Api.new
|
38
|
+
|
39
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
40
|
+
# the configuration file or provide your own logger:
|
41
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
42
|
+
|
43
|
+
mutate_job_srv = adwords.service(:MutateJobService, API_VERSION)
|
44
|
+
|
45
|
+
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
46
|
+
|
47
|
+
# Create list of all operations for the job.
|
48
|
+
operations = []
|
49
|
+
|
50
|
+
# Create an AdGroupAdOperation to add a text ad.
|
51
|
+
operations << {
|
52
|
+
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
53
|
+
# being created. It's only necessary when you must provide an explicit
|
54
|
+
# type that the client library can't infer.
|
55
|
+
:xsi_type => 'AdGroupAdOperation',
|
56
|
+
:operator => 'ADD',
|
57
|
+
:operand => {
|
58
|
+
:ad_group_id => ad_group_id,
|
59
|
+
:ad => {
|
60
|
+
:xsi_type => 'TextAd',
|
61
|
+
:headline => 'Luxury Cruise to Mars',
|
62
|
+
:description1 => 'Visit the Red Planet in style.',
|
63
|
+
:description2 => 'Low-gravity fun for everyone!',
|
64
|
+
:url => 'http://www.example.com',
|
65
|
+
:display_url => 'www.example.com',
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
# Create AdGroupCriterionOperations to add keywords.
|
71
|
+
KEYWORD_NUMBER.times do |index|
|
72
|
+
operations << {
|
73
|
+
:xsi_type => 'AdGroupCriterionOperation',
|
74
|
+
:operator => 'ADD',
|
75
|
+
:operand => {
|
76
|
+
:xsi_type => 'BiddableAdGroupCriterion',
|
77
|
+
:ad_group_id => ad_group_id,
|
78
|
+
:criterion => {
|
79
|
+
:xsi_type => 'Keyword',
|
80
|
+
:match_type => 'BROAD',
|
81
|
+
:text => "mars%d" % index
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
# You can specify up to 3 job IDs that must successfully complete before
|
88
|
+
# this job can be processed.
|
89
|
+
policy = {:prerequisite_job_ids => []}
|
90
|
+
|
91
|
+
# Call mutate to create a new job.
|
92
|
+
response = mutate_job_srv.mutate(operations, policy)
|
93
|
+
|
94
|
+
raise StandardError, 'Failed to submit a job; aborting.' unless response
|
95
|
+
|
96
|
+
job_id = response[:id]
|
97
|
+
puts "Job ID %d was successfully created." % job_id
|
98
|
+
|
99
|
+
# Creating selector to retrive hob status and wait for it to complete.
|
100
|
+
selector = {
|
101
|
+
:xsi_type => 'BulkMutateJobSelector',
|
102
|
+
:job_ids => [job_id]
|
103
|
+
}
|
104
|
+
|
105
|
+
status = nil
|
106
|
+
|
107
|
+
# Poll for job status until it's finished.
|
108
|
+
puts 'Retrieving job status...'
|
109
|
+
RETRIES_COUNT.times do |retry_attempt|
|
110
|
+
job_status_response = mutate_job_srv.get(selector)
|
111
|
+
if job_status_response
|
112
|
+
status = job_status_response.first[:status]
|
113
|
+
case status
|
114
|
+
when 'FAILED'
|
115
|
+
raise StandardError, "Job failed with reason: '%s'" %
|
116
|
+
job_status_response.first[:failure_reason]
|
117
|
+
when 'COMPLETED'
|
118
|
+
puts "[%d] Job finished with status '%s'" % [retry_attempt, status]
|
119
|
+
break
|
120
|
+
else
|
121
|
+
puts "[%d] Current status is '%s', waiting %d seconds to retry..." %
|
122
|
+
[retry_attempt, status, RETRY_INTERVAL]
|
123
|
+
sleep(RETRY_INTERVAL)
|
124
|
+
end
|
125
|
+
else
|
126
|
+
raise StandardError, 'Error retrieving job status; aborting.'
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
if status == 'COMPLETED'
|
131
|
+
# Get the job result. Here we re-use the same selector.
|
132
|
+
result_response = mutate_job_srv.get_result(selector)
|
133
|
+
|
134
|
+
if result_response and result_response[:simple_mutate_result]
|
135
|
+
results = result_response[:simple_mutate_result][:results]
|
136
|
+
if results
|
137
|
+
results.each_with_index do |result, index|
|
138
|
+
result_message = result.include?(:place_holder) ?
|
139
|
+
'FAILED' : 'SUCCEEDED'
|
140
|
+
puts "Operation [%d] - %s" % [index, result_message]
|
141
|
+
end
|
142
|
+
end
|
143
|
+
errors = result_response[:simple_mutate_result][:errors]
|
144
|
+
if errors
|
145
|
+
errors.each do |error|
|
146
|
+
puts "Error, reason: '%s', trigger: '%s', field path: '%s'" %
|
147
|
+
[error[:reason], error[:trigger], error[:field_path]]
|
148
|
+
end
|
149
|
+
end
|
150
|
+
else
|
151
|
+
raise StandardError, 'Error retrieving job results; aborting.'
|
152
|
+
end
|
153
|
+
else
|
154
|
+
puts "Job failed to complete after %d retries" % RETRY_COUNT
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
if __FILE__ == $0
|
159
|
+
begin
|
160
|
+
perform_mutate_job()
|
161
|
+
|
162
|
+
# HTTP errors.
|
163
|
+
rescue AdsCommon::Errors::HttpError => e
|
164
|
+
puts "HTTP Error: %s" % e
|
165
|
+
|
166
|
+
# API errors.
|
167
|
+
rescue AdwordsApi::Errors::ApiException => e
|
168
|
+
puts "Message: %s" % e.message
|
169
|
+
puts 'Errors:'
|
170
|
+
e.errors.each_with_index do |error, index|
|
171
|
+
puts "\tError [%d]:" % (index + 1)
|
172
|
+
error.each do |field, value|
|
173
|
+
puts "\t\t%s: %s" % [field, value]
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
|
+
#
|
7
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
+
# implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
# This example promotes an experiment, which permanently applies all the
|
21
|
+
# experiment changes made to its related ad groups, criteria and ads. To get
|
22
|
+
# experiments, run get_all_experiments.rb.
|
23
|
+
#
|
24
|
+
# Tags: ExperimentService.mutate
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'adwords_api'
|
28
|
+
|
29
|
+
API_VERSION = :v201109
|
30
|
+
|
31
|
+
def promote_experiment()
|
32
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
33
|
+
# when called without parameters.
|
34
|
+
adwords = AdwordsApi::Api.new
|
35
|
+
|
36
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
37
|
+
# the configuration file or provide your own logger:
|
38
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
39
|
+
|
40
|
+
experiment_srv = adwords.service(:ExperimentService, API_VERSION)
|
41
|
+
|
42
|
+
experiment_id = 'INSERT_EXPERIMENT_ID_HERE'.to_i
|
43
|
+
|
44
|
+
# Prepare for updating experiment.
|
45
|
+
operation = {
|
46
|
+
:operator => 'SET',
|
47
|
+
:operand => {
|
48
|
+
:id => experiment_id,
|
49
|
+
:status => 'PROMOTED',
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
# Update experiment.
|
54
|
+
response = experiment_srv.mutate([operation])
|
55
|
+
experiment = response[:value].first
|
56
|
+
puts 'Experiment with name "%s" and id %d was promoted.' %
|
57
|
+
[experiment[:name], experiment[:id]]
|
58
|
+
end
|
59
|
+
|
60
|
+
if __FILE__ == $0
|
61
|
+
begin
|
62
|
+
promote_experiment()
|
63
|
+
|
64
|
+
# HTTP errors.
|
65
|
+
rescue AdsCommon::Errors::HttpError => e
|
66
|
+
puts "HTTP Error: %s" % e
|
67
|
+
|
68
|
+
# API errors.
|
69
|
+
rescue AdwordsApi::Errors::ApiException => e
|
70
|
+
puts "Message: %s" % e.message
|
71
|
+
puts 'Errors:'
|
72
|
+
e.errors.each_with_index do |error, index|
|
73
|
+
puts "\tError [%d]:" % (index + 1)
|
74
|
+
error.each do |field, value|
|
75
|
+
puts "\t\t%s: %s" % [field, value]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
|
+
#
|
7
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
+
# implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
# This example illustrates how to create a text ad with ad parameters. To add an
|
21
|
+
# ad group, run add_ad_group.rb. To add an ad group criterion, run
|
22
|
+
# add_ad_group_criterion.rb.
|
23
|
+
#
|
24
|
+
# Tags: AdGroupAdService.mutate, AdParamService.mutate
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'adwords_api'
|
28
|
+
|
29
|
+
API_VERSION = :v201109
|
30
|
+
|
31
|
+
def set_ad_params()
|
32
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
33
|
+
# when called without parameters.
|
34
|
+
adwords = AdwordsApi::Api.new
|
35
|
+
|
36
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
37
|
+
# the configuration file or provide your own logger:
|
38
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
39
|
+
|
40
|
+
ad_group_ad_srv = adwords.service(:AdGroupAdService, API_VERSION)
|
41
|
+
ad_param_srv = adwords.service(:AdParamService, API_VERSION)
|
42
|
+
|
43
|
+
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
44
|
+
criterion_id = 'INSERT_CRITERION_ID_HERE'.to_i
|
45
|
+
|
46
|
+
# Prepare for adding ad.
|
47
|
+
ad_operation = {
|
48
|
+
:operator => 'ADD',
|
49
|
+
:operand => {
|
50
|
+
:ad_group_id => ad_group_id,
|
51
|
+
:ad => {
|
52
|
+
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
53
|
+
# being created. It's only necessary when you must provide an explicit
|
54
|
+
# type that the client library can't infer.
|
55
|
+
:xsi_type => 'TextAd',
|
56
|
+
:headline => 'Luxury Mars Cruises',
|
57
|
+
:description1 => 'Low-gravity fun for {param1:cheap}.',
|
58
|
+
:description2 => 'Only {param2:a few} seats left!',
|
59
|
+
:url => 'http://www.example.com',
|
60
|
+
:display_url => 'www.example.com'
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
# Add ad.
|
66
|
+
response = ad_group_ad_srv.mutate([ad_operation])
|
67
|
+
ad = response[:value].first[:ad]
|
68
|
+
puts 'Text ad id %d was successfully added.' % ad[:id]
|
69
|
+
|
70
|
+
# Prepare for setting ad parameters.
|
71
|
+
price_operation = {
|
72
|
+
:operator => 'SET',
|
73
|
+
:operand => {
|
74
|
+
:ad_group_id => ad_group_id,
|
75
|
+
:criterion_id => criterion_id,
|
76
|
+
:param_index => 1,
|
77
|
+
:insertion_text => "$100"
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
seat_operation = {
|
82
|
+
:operator => 'SET',
|
83
|
+
:operand => {
|
84
|
+
:ad_group_id => ad_group_id,
|
85
|
+
:criterion_id => criterion_id,
|
86
|
+
:param_index => 2,
|
87
|
+
:insertion_text => "50"
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
# Set ad parameters.
|
92
|
+
response = ad_param_srv.mutate([price_operation, seat_operation])
|
93
|
+
puts 'Parameters were successfully updated.'
|
94
|
+
end
|
95
|
+
|
96
|
+
if __FILE__ == $0
|
97
|
+
begin
|
98
|
+
set_ad_params()
|
99
|
+
|
100
|
+
# HTTP errors.
|
101
|
+
rescue AdsCommon::Errors::HttpError => e
|
102
|
+
puts "HTTP Error: %s" % e
|
103
|
+
|
104
|
+
# API errors.
|
105
|
+
rescue AdwordsApi::Errors::ApiException => e
|
106
|
+
puts "Message: %s" % e.message
|
107
|
+
puts 'Errors:'
|
108
|
+
e.errors.each_with_index do |error, index|
|
109
|
+
puts "\tError [%d]:" % (index + 1)
|
110
|
+
error.each do |field, value|
|
111
|
+
puts "\t\t%s: %s" % [field, value]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
|
+
#
|
7
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
+
# implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
# This example illustrates how to update an ad, setting its status to 'PAUSED'.
|
21
|
+
# To create ads, run add_ads.rb.
|
22
|
+
#
|
23
|
+
# Tags: AdGroupAdService.mutate
|
24
|
+
|
25
|
+
require 'rubygems'
|
26
|
+
require 'adwords_api'
|
27
|
+
|
28
|
+
API_VERSION = :v201109
|
29
|
+
|
30
|
+
def update_ad()
|
31
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
32
|
+
# when called without parameters.
|
33
|
+
adwords = AdwordsApi::Api.new
|
34
|
+
|
35
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
36
|
+
# the configuration file or provide your own logger:
|
37
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
38
|
+
|
39
|
+
ad_group_ad_srv = adwords.service(:AdGroupAdService, API_VERSION)
|
40
|
+
|
41
|
+
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
42
|
+
ad_id = 'INSERT_AD_ID_HERE'.to_i
|
43
|
+
|
44
|
+
# Prepare for updating ad.
|
45
|
+
operation = {
|
46
|
+
:operator => 'SET',
|
47
|
+
:operand => {
|
48
|
+
:ad_group_id => ad_group_id,
|
49
|
+
:status => 'PAUSED',
|
50
|
+
:ad => {
|
51
|
+
:id => ad_id
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
# Update ad.
|
57
|
+
response = ad_group_ad_srv.mutate([operation])
|
58
|
+
if response and response[:value]
|
59
|
+
ad = response[:value].first
|
60
|
+
puts 'Ad id %d was successfully updated, status set to %s.' %
|
61
|
+
[ad[:ad][:id], ad[:status]]
|
62
|
+
else
|
63
|
+
puts 'No ads were updated.'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
if __FILE__ == $0
|
68
|
+
begin
|
69
|
+
update_ad()
|
70
|
+
|
71
|
+
# HTTP errors.
|
72
|
+
rescue AdsCommon::Errors::HttpError => e
|
73
|
+
puts "HTTP Error: %s" % e
|
74
|
+
|
75
|
+
# API errors.
|
76
|
+
rescue AdwordsApi::Errors::ApiException => e
|
77
|
+
puts "Message: %s" % e.message
|
78
|
+
puts 'Errors:'
|
79
|
+
e.errors.each_with_index do |error, index|
|
80
|
+
puts "\tError [%d]:" % (index + 1)
|
81
|
+
error.each do |field, value|
|
82
|
+
puts "\t\t%s: %s" % [field, value]
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|