google-adwords-api 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,72 @@
|
|
|
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 gets the list of possible report fields for a report type.
|
|
21
|
+
#
|
|
22
|
+
# Tags: ReportDefinitionService.getReportFields
|
|
23
|
+
|
|
24
|
+
require 'rubygems'
|
|
25
|
+
require 'adwords_api'
|
|
26
|
+
|
|
27
|
+
API_VERSION = :v201109
|
|
28
|
+
|
|
29
|
+
def get_report_fields()
|
|
30
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
|
31
|
+
# when called without parameters.
|
|
32
|
+
adwords = AdwordsApi::Api.new
|
|
33
|
+
|
|
34
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
|
35
|
+
# the configuration file or provide your own logger:
|
|
36
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
|
37
|
+
|
|
38
|
+
report_def_srv = adwords.service(:ReportDefinitionService, API_VERSION)
|
|
39
|
+
|
|
40
|
+
report_type = 'INSERT_REPORT_TYPE_HERE'
|
|
41
|
+
|
|
42
|
+
# Get report fields.
|
|
43
|
+
fields = report_def_srv.get_report_fields(report_type)
|
|
44
|
+
if fields
|
|
45
|
+
puts 'Report type \'%s\' contains the following fields:' % report_type
|
|
46
|
+
fields.each do |field|
|
|
47
|
+
puts ' - %s (%s)' % [field[:field_name], field[:field_type]]
|
|
48
|
+
puts ' := [%s]' % field[:enum_values].join(', ') if field[:enum_values]
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
if __FILE__ == $0
|
|
54
|
+
begin
|
|
55
|
+
get_report_fields()
|
|
56
|
+
|
|
57
|
+
# HTTP errors.
|
|
58
|
+
rescue AdsCommon::Errors::HttpError => e
|
|
59
|
+
puts "HTTP Error: %s" % e
|
|
60
|
+
|
|
61
|
+
# API errors.
|
|
62
|
+
rescue AdwordsApi::Errors::ApiException => e
|
|
63
|
+
puts "Message: %s" % e.message
|
|
64
|
+
puts 'Errors:'
|
|
65
|
+
e.errors.each_with_index do |error, index|
|
|
66
|
+
puts "\tError [%d]:" % (index + 1)
|
|
67
|
+
error.each do |field, value|
|
|
68
|
+
puts "\t\t%s: %s" % [field, value]
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
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 retrieve the total number of API units that
|
|
21
|
+
# can be used by the developer token making the call, for the current month.
|
|
22
|
+
#
|
|
23
|
+
# Tags: InfoService.get
|
|
24
|
+
|
|
25
|
+
require 'rubygems'
|
|
26
|
+
require 'adwords_api'
|
|
27
|
+
|
|
28
|
+
API_VERSION = :v201109
|
|
29
|
+
|
|
30
|
+
def get_total_usage_units_per_month()
|
|
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
|
+
info_srv = adwords.service(:InfoService, API_VERSION)
|
|
40
|
+
|
|
41
|
+
selector = {
|
|
42
|
+
:api_usage_type => 'TOTAL_USAGE_API_UNITS_PER_MONTH'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# Get the usage info.
|
|
46
|
+
adwords.use_mcc do
|
|
47
|
+
info = info_srv.get(selector)
|
|
48
|
+
if info
|
|
49
|
+
puts 'The total number of API units available this month is %d.' %
|
|
50
|
+
info[:cost]
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
if __FILE__ == $0
|
|
56
|
+
begin
|
|
57
|
+
get_total_usage_units_per_month()
|
|
58
|
+
|
|
59
|
+
# HTTP errors.
|
|
60
|
+
rescue AdsCommon::Errors::HttpError => e
|
|
61
|
+
puts "HTTP Error: %s" % e
|
|
62
|
+
|
|
63
|
+
# API errors.
|
|
64
|
+
rescue AdwordsApi::Errors::ApiException => e
|
|
65
|
+
puts "Message: %s" % e.message
|
|
66
|
+
puts 'Errors:'
|
|
67
|
+
e.errors.each_with_index do |error, index|
|
|
68
|
+
puts "\tError [%d]:" % (index + 1)
|
|
69
|
+
error.each do |field, value|
|
|
70
|
+
puts "\t\t%s: %s" % [field, value]
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,129 @@
|
|
|
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 example gets keyword traffic estimates.
|
|
21
|
+
#
|
|
22
|
+
# Tags: TrafficEstimatorService.get
|
|
23
|
+
|
|
24
|
+
require 'rubygems'
|
|
25
|
+
require 'adwords_api'
|
|
26
|
+
|
|
27
|
+
API_VERSION = :v201109
|
|
28
|
+
|
|
29
|
+
def get_traffic_estimates()
|
|
30
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
|
31
|
+
# when called without parameters.
|
|
32
|
+
adwords = AdwordsApi::Api.new
|
|
33
|
+
|
|
34
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
|
35
|
+
# the configuration file or provide your own logger:
|
|
36
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
|
37
|
+
|
|
38
|
+
traffic_estimator_srv = adwords.service(:TrafficEstimatorService, API_VERSION)
|
|
39
|
+
|
|
40
|
+
# Create keywords. Up to 2000 keywords can be passed in a single request.
|
|
41
|
+
keywords = [
|
|
42
|
+
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
|
43
|
+
# being created. It's only necessary when you must provide an explicit
|
|
44
|
+
# type that the client library can't infer.
|
|
45
|
+
{:xsi_type => 'Keyword', :text => 'mars cruise', :match_type => 'BROAD'},
|
|
46
|
+
{:xsi_type => 'Keyword', :text => 'cheap cruise', :match_type => 'PHRASE'},
|
|
47
|
+
{:xsi_type => 'Keyword', :text => 'cruise', :match_type => 'EXACT'},
|
|
48
|
+
{:xsi_type => 'Keyword', :text => 'moon walk', :match_type => 'BROAD'}
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
# Create a keyword estimate request for each keyword.
|
|
52
|
+
keyword_requests = keywords.map {|keyword| {:keyword => keyword}}
|
|
53
|
+
|
|
54
|
+
# Negative keywords don't return estimates, but adjust the estimates of the
|
|
55
|
+
# other keywords in the hypothetical ad group. To specify a negative keyword
|
|
56
|
+
# set the is_negative field to true.
|
|
57
|
+
keyword_requests[3][:is_negative] = true
|
|
58
|
+
|
|
59
|
+
# Create ad group estimate requests.
|
|
60
|
+
ad_group_request = {
|
|
61
|
+
:keyword_estimate_requests => keyword_requests,
|
|
62
|
+
:max_cpc => {
|
|
63
|
+
:micro_amount => 1000000
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# Create campaign estimate requests.
|
|
68
|
+
campaign_request = {
|
|
69
|
+
:ad_group_estimate_requests => [ad_group_request],
|
|
70
|
+
# Set targeting criteria. Only locations and languages are supported.
|
|
71
|
+
:criteria => [
|
|
72
|
+
{:xsi_type => 'Location', :id => 2840}, # United States
|
|
73
|
+
{:xsi_type => 'Language', :id => 1000} # English
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# Create selector and retrieve reults.
|
|
78
|
+
selector = {:campaign_estimate_requests => [campaign_request]}
|
|
79
|
+
response = traffic_estimator_srv.get(selector)
|
|
80
|
+
|
|
81
|
+
if response and response[:campaign_estimates]
|
|
82
|
+
campaign_estimates = response[:campaign_estimates]
|
|
83
|
+
keyword_estimates =
|
|
84
|
+
campaign_estimates.first[:ad_group_estimates].first[:keyword_estimates]
|
|
85
|
+
keyword_estimates.each_with_index do |estimate, index|
|
|
86
|
+
keyword = keyword_requests[index][:keyword]
|
|
87
|
+
|
|
88
|
+
# Find the mean of the min and max values.
|
|
89
|
+
mean_avg_cpc = (estimate[:min][:average_cpc][:micro_amount] +
|
|
90
|
+
estimate[:max][:average_cpc][:micro_amount]) / 2
|
|
91
|
+
mean_avg_position = (estimate[:min][:average_position] +
|
|
92
|
+
estimate[:max][:average_position]) / 2
|
|
93
|
+
mean_clicks = (estimate[:min][:clicks_per_day] +
|
|
94
|
+
estimate[:max][:clicks_per_day]) / 2
|
|
95
|
+
mean_total_cost = (estimate[:min][:total_cost][:micro_amount] +
|
|
96
|
+
estimate[:max][:total_cost][:micro_amount]) / 2
|
|
97
|
+
|
|
98
|
+
puts "Results for the keyword with text '%s' and match type %s:" %
|
|
99
|
+
[keyword[:text], keyword[:match_type]]
|
|
100
|
+
puts "\tEstimated average CPC: %d" % mean_avg_cpc
|
|
101
|
+
puts "\tEstimated ad position: %.2f" % mean_avg_position
|
|
102
|
+
puts "\tEstimated daily clicks: %d" % mean_clicks
|
|
103
|
+
puts "\tEstimated daily cost: %d" % mean_total_cost
|
|
104
|
+
end
|
|
105
|
+
else
|
|
106
|
+
puts 'No traffic estimates were returned.'
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if __FILE__ == $0
|
|
111
|
+
begin
|
|
112
|
+
get_traffic_estimates()
|
|
113
|
+
|
|
114
|
+
# HTTP errors.
|
|
115
|
+
rescue AdsCommon::Errors::HttpError => e
|
|
116
|
+
puts "HTTP Error: %s" % e
|
|
117
|
+
|
|
118
|
+
# API errors.
|
|
119
|
+
rescue AdwordsApi::Errors::ApiException => e
|
|
120
|
+
puts "Message: %s" % e.message
|
|
121
|
+
puts 'Errors:'
|
|
122
|
+
e.errors.each_with_index do |error, index|
|
|
123
|
+
puts "\tError [%d]:" % (index + 1)
|
|
124
|
+
error.each do |field, value|
|
|
125
|
+
puts "\t\t%s: %s" % [field, value]
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
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 example illustrates how to retrieve the number of API units recorded for
|
|
21
|
+
# the developer token over the given date range as well as for the current call.
|
|
22
|
+
#
|
|
23
|
+
# Tags: InfoService.get
|
|
24
|
+
|
|
25
|
+
require 'rubygems'
|
|
26
|
+
require 'adwords_api'
|
|
27
|
+
|
|
28
|
+
API_VERSION = :v201109
|
|
29
|
+
|
|
30
|
+
def get_unit_count()
|
|
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
|
+
info_srv = adwords.service(:InfoService, API_VERSION)
|
|
40
|
+
|
|
41
|
+
start_date = Time.now.strftime('%Y%m01')
|
|
42
|
+
end_date = Time.now.strftime('%Y%m%d')
|
|
43
|
+
|
|
44
|
+
selector = {
|
|
45
|
+
:api_usage_type => 'UNIT_COUNT',
|
|
46
|
+
:date_range => {
|
|
47
|
+
:min => start_date,
|
|
48
|
+
:max => end_date
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# Get the unit info.
|
|
53
|
+
adwords.use_mcc do
|
|
54
|
+
info_srv.get(selector) do |header, response|
|
|
55
|
+
puts "Total number of units consumed from %s to %s is %d." %
|
|
56
|
+
[start_date, end_date, response[:cost]]
|
|
57
|
+
puts "Number of units consumed by this request is %d" % header[:units]
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
if __FILE__ == $0
|
|
63
|
+
begin
|
|
64
|
+
get_unit_count()
|
|
65
|
+
|
|
66
|
+
# HTTP errors.
|
|
67
|
+
rescue AdsCommon::Errors::HttpError => e
|
|
68
|
+
puts "HTTP Error: %s" % e
|
|
69
|
+
|
|
70
|
+
# API errors.
|
|
71
|
+
rescue AdwordsApi::Errors::ApiException => e
|
|
72
|
+
puts "Message: %s" % e.message
|
|
73
|
+
puts 'Errors:'
|
|
74
|
+
e.errors.each_with_index do |error, index|
|
|
75
|
+
puts "\tError [%d]:" % (index + 1)
|
|
76
|
+
error.each do |field, value|
|
|
77
|
+
puts "\t\t%s: %s" % [field, value]
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,127 @@
|
|
|
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 demonstrates how to handle partial failures.
|
|
21
|
+
#
|
|
22
|
+
# Tags: AdGroupCriterionService.mutate
|
|
23
|
+
|
|
24
|
+
require 'rubygems'
|
|
25
|
+
require 'adwords_api'
|
|
26
|
+
require 'adwords_api/utils'
|
|
27
|
+
|
|
28
|
+
API_VERSION = :v201109
|
|
29
|
+
|
|
30
|
+
def handle_partial_failures()
|
|
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_criterion_srv =
|
|
40
|
+
adwords.service(:AdGroupCriterionService, API_VERSION)
|
|
41
|
+
|
|
42
|
+
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
|
43
|
+
|
|
44
|
+
# Set partial failures flag.
|
|
45
|
+
adwords.partial_failure = true
|
|
46
|
+
|
|
47
|
+
# Create keywords.
|
|
48
|
+
keyword_text = ['mars cruise', 'inv@lid cruise', 'venus cruise',
|
|
49
|
+
'b(a)d keyword cruise']
|
|
50
|
+
keywords = []
|
|
51
|
+
keyword_text.each do |text|
|
|
52
|
+
keyword = {
|
|
53
|
+
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
|
54
|
+
# being created. It's only necessary when you must provide an explicit
|
|
55
|
+
# type that the client library can't infer.
|
|
56
|
+
:xsi_type => 'Keyword',
|
|
57
|
+
:match_type => 'BROAD',
|
|
58
|
+
:text => text
|
|
59
|
+
}
|
|
60
|
+
keywords << keyword
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Create biddable ad group criteria and operations.
|
|
64
|
+
operations = []
|
|
65
|
+
keywords.each do |kwd|
|
|
66
|
+
operation = {
|
|
67
|
+
:operator => 'ADD',
|
|
68
|
+
:operand => {
|
|
69
|
+
:xsi_type => 'BiddableAdGroupCriterion',
|
|
70
|
+
:ad_group_id => ad_group_id,
|
|
71
|
+
:criterion => kwd
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
operations << operation
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Add criteria.
|
|
78
|
+
response = ad_group_criterion_srv.mutate(operations)
|
|
79
|
+
if response and response[:value]
|
|
80
|
+
ad_group_criteria = response[:value]
|
|
81
|
+
ad_group_criteria.each do |ad_group_criterion|
|
|
82
|
+
if ad_group_criterion[:criterion]
|
|
83
|
+
puts "Ad group criterion with ad group id " +
|
|
84
|
+
"#{ad_group_criterion[:ad_group_id]}, criterion id "+
|
|
85
|
+
"#{ad_group_criterion[:criterion][:id]} and keyword \"" +
|
|
86
|
+
"#{ad_group_criterion[:criterion][:text]}\" was added."
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
else
|
|
90
|
+
puts "No criteria were added."
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Check partial failures.
|
|
94
|
+
if response and response[:partial_failure_errors]
|
|
95
|
+
response[:partial_failure_errors].each do |error|
|
|
96
|
+
operation_index = AdwordsApi::Utils.operation_index_for_error(error)
|
|
97
|
+
if operation_index
|
|
98
|
+
ad_group_criterion = operations[operation_index][:operand]
|
|
99
|
+
puts "Ad group criterion with ad group id " +
|
|
100
|
+
"#{ad_group_criterion[:ad_group_id]} and keyword \"" +
|
|
101
|
+
"#{ad_group_criterion[:criterion][:text]}\" triggered an error " +
|
|
102
|
+
"for the following reason: \"#{error[:error_string]}\"."
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if __FILE__ == $0
|
|
109
|
+
begin
|
|
110
|
+
handle_partial_failures()
|
|
111
|
+
|
|
112
|
+
# HTTP errors.
|
|
113
|
+
rescue AdsCommon::Errors::HttpError => e
|
|
114
|
+
puts "HTTP Error: %s" % e
|
|
115
|
+
|
|
116
|
+
# API errors.
|
|
117
|
+
rescue AdwordsApi::Errors::ApiException => e
|
|
118
|
+
puts "Message: %s" % e.message
|
|
119
|
+
puts 'Errors:'
|
|
120
|
+
e.errors.each_with_index do |error, index|
|
|
121
|
+
puts "\tError [%d]:" % (index + 1)
|
|
122
|
+
error.each do |field, value|
|
|
123
|
+
puts "\t\t%s: %s" % [field, value]
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|