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,103 @@
|
|
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 location criteria by name.
|
21
|
+
#
|
22
|
+
# Tags: LocationCriterionService.get
|
23
|
+
|
24
|
+
require 'rubygems'
|
25
|
+
require 'adwords_api'
|
26
|
+
|
27
|
+
API_VERSION = :v201109
|
28
|
+
|
29
|
+
def get_location_criteria()
|
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
|
+
location_criterion_srv =
|
39
|
+
adwords.service(:LocationCriterionService, API_VERSION)
|
40
|
+
|
41
|
+
# List of locations to look up.
|
42
|
+
location_names = ['Paris', 'Quebec', 'Spain', 'Deutschland']
|
43
|
+
# Locale to retrieve names in.
|
44
|
+
locale = 'en'
|
45
|
+
|
46
|
+
# Get the criteria by names.
|
47
|
+
selector = {
|
48
|
+
:fields => ['Id', 'LocationName', 'CanonicalName', 'DisplayType',
|
49
|
+
'ParentLocations', 'Reach'],
|
50
|
+
:predicates => [
|
51
|
+
# Location names must match exactly, only EQUALS and IN are supported.
|
52
|
+
{:field => 'LocationName',
|
53
|
+
:operator => 'IN',
|
54
|
+
:values => location_names},
|
55
|
+
# Set the locale of the returned location names.
|
56
|
+
{:field => 'Locale', :operator => 'EQUALS', :values => locale}
|
57
|
+
]
|
58
|
+
}
|
59
|
+
criteria = location_criterion_srv.get(selector)
|
60
|
+
|
61
|
+
if criteria
|
62
|
+
criteria.each do |criterion|
|
63
|
+
# Extract all parent location names as one comma-separated string.
|
64
|
+
parent_location = if criterion[:location][:parent_locations] and
|
65
|
+
!criterion[:location][:parent_locations].empty?
|
66
|
+
locations_array = criterion[:location][:parent_locations].map do |loc|
|
67
|
+
loc[:location_name]
|
68
|
+
end
|
69
|
+
locations_array.join(', ')
|
70
|
+
else
|
71
|
+
'N/A'
|
72
|
+
end
|
73
|
+
puts ("The search term '%s' returned the location '%s' of type '%s' " +
|
74
|
+
"with ID %d, parent locations '%s' and reach %d") %
|
75
|
+
[criterion[:search_term], criterion[:location][:location_name],
|
76
|
+
criterion[:location][:criterion_type], criterion[:location][:id],
|
77
|
+
parent_location, criterion[:reach]]
|
78
|
+
end
|
79
|
+
else
|
80
|
+
puts 'No criteria were returned.'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if __FILE__ == $0
|
85
|
+
begin
|
86
|
+
get_location_criteria()
|
87
|
+
|
88
|
+
# HTTP errors.
|
89
|
+
rescue AdsCommon::Errors::HttpError => e
|
90
|
+
puts "HTTP Error: %s" % e
|
91
|
+
|
92
|
+
# API errors.
|
93
|
+
rescue AdwordsApi::Errors::ApiException => e
|
94
|
+
puts "Message: %s" % e.message
|
95
|
+
puts 'Errors:'
|
96
|
+
e.errors.each_with_index do |error, index|
|
97
|
+
puts "\tError [%d]:" % (index + 1)
|
98
|
+
error.each do |field, value|
|
99
|
+
puts "\t\t%s: %s" % [field, value]
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,87 @@
|
|
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 cost, in API units of operation,
|
21
|
+
# of the given method, on a specified date.
|
22
|
+
#
|
23
|
+
# Tags: InfoService.get
|
24
|
+
|
25
|
+
require 'rubygems'
|
26
|
+
require 'adwords_api'
|
27
|
+
|
28
|
+
API_VERSION = :v201109
|
29
|
+
|
30
|
+
def get_method_cost()
|
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
|
+
date = Time.now
|
42
|
+
service_name = 'AdGroupService'
|
43
|
+
method_name = 'mutate'
|
44
|
+
operator = 'SET'
|
45
|
+
|
46
|
+
selector = {
|
47
|
+
:api_usage_type => 'METHOD_COST',
|
48
|
+
:service_name => service_name,
|
49
|
+
:method_name => method_name,
|
50
|
+
:operator => operator,
|
51
|
+
:date_range => {
|
52
|
+
:min => date.strftime('%Y%m%d'),
|
53
|
+
:max => date.strftime('%Y%m%d')
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
# Get the unit info.
|
58
|
+
adwords.use_mcc do
|
59
|
+
info = info_srv.get(selector)
|
60
|
+
if info
|
61
|
+
puts 'The cost of the %s.%s %s method during %s is %d.' %
|
62
|
+
[service_name, method_name, operator, selector[:date_range][:min],
|
63
|
+
info[:cost]]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
if __FILE__ == $0
|
69
|
+
begin
|
70
|
+
get_method_cost()
|
71
|
+
|
72
|
+
# HTTP errors.
|
73
|
+
rescue AdsCommon::Errors::HttpError => e
|
74
|
+
puts "HTTP Error: %s" % e
|
75
|
+
|
76
|
+
# API errors.
|
77
|
+
rescue AdwordsApi::Errors::ApiException => e
|
78
|
+
puts "Message: %s" % e.message
|
79
|
+
puts 'Errors:'
|
80
|
+
e.errors.each_with_index do |error, index|
|
81
|
+
puts "\tError [%d]:" % (index + 1)
|
82
|
+
error.each do |field, value|
|
83
|
+
puts "\t\t%s: %s" % [field, value]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
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 illustrates how to retrieve the number of operations recorded for
|
21
|
+
# the developer token being used to make this call over the given date range.
|
22
|
+
#
|
23
|
+
# Tags: InfoService.get
|
24
|
+
|
25
|
+
require 'rubygems'
|
26
|
+
require 'adwords_api'
|
27
|
+
|
28
|
+
API_VERSION = :v201109
|
29
|
+
|
30
|
+
def get_operation_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
|
+
selector = {
|
42
|
+
:api_usage_type => 'OPERATION_COUNT',
|
43
|
+
:date_range => {
|
44
|
+
:min => Time.now.strftime('%Y%m01'),
|
45
|
+
:max => Time.now.strftime('%Y%m%d')
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
# Get the operation info.
|
50
|
+
adwords.use_mcc do
|
51
|
+
info = info_srv.get(selector)
|
52
|
+
if info
|
53
|
+
puts 'The total number of operations performed from %s to %s is %d.' %
|
54
|
+
[selector[:date_range][:min], selector[:date_range][:max],
|
55
|
+
info[:cost]]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
if __FILE__ == $0
|
61
|
+
begin
|
62
|
+
get_operation_count()
|
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,108 @@
|
|
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 retrieves keywords that are related to a given keyword.
|
21
|
+
#
|
22
|
+
# Tags: TargetingIdeaService.get
|
23
|
+
|
24
|
+
require 'rubygems'
|
25
|
+
require 'adwords_api'
|
26
|
+
require 'adwords_api/utils'
|
27
|
+
|
28
|
+
API_VERSION = :v201109
|
29
|
+
PAGE_SIZE = 100
|
30
|
+
|
31
|
+
def get_related_keywords()
|
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
|
+
targeting_idea_srv = adwords.service(:TargetingIdeaService, API_VERSION)
|
41
|
+
|
42
|
+
keyword_text = 'INSERT_KEYWORD_TEXT_HERE'
|
43
|
+
|
44
|
+
# Construct selector object.
|
45
|
+
selector = {
|
46
|
+
:idea_type => 'KEYWORD',
|
47
|
+
:request_type => 'IDEAS',
|
48
|
+
:requested_attribute_types => ['CRITERION'],
|
49
|
+
:search_parameters => [{
|
50
|
+
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
51
|
+
# being created. It's only necessary when you must provide an explicit
|
52
|
+
# type that the client library can't infer.
|
53
|
+
:xsi_type => 'RelatedToKeywordSearchParameter',
|
54
|
+
:keywords => [{
|
55
|
+
:text => keyword_text,
|
56
|
+
:match_type => 'EXACT'
|
57
|
+
}]
|
58
|
+
}],
|
59
|
+
:paging => {
|
60
|
+
:start_index => 0,
|
61
|
+
:number_results => PAGE_SIZE
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
# Define initial values.
|
66
|
+
offset = 0
|
67
|
+
results = []
|
68
|
+
|
69
|
+
begin
|
70
|
+
# Perform request.
|
71
|
+
page = targeting_idea_srv.get(selector)
|
72
|
+
results += page[:entries] if page and page[:entries]
|
73
|
+
|
74
|
+
# Prepare next page request.
|
75
|
+
offset += PAGE_SIZE
|
76
|
+
selector[:paging][:start_index] = offset
|
77
|
+
end while offset < page[:total_num_entries]
|
78
|
+
|
79
|
+
# Display results.
|
80
|
+
results.each do |result|
|
81
|
+
data = AdwordsApi::Utils.map(result[:data])
|
82
|
+
keyword = data['CRITERION'][:value]
|
83
|
+
puts "Found keyword with text \"%s\" and match type \"%s\"" %
|
84
|
+
[keyword[:text], keyword[:match_type]]
|
85
|
+
end
|
86
|
+
puts "Total keywords related to \"%s\": %d." % [keyword_text, results.length]
|
87
|
+
end
|
88
|
+
|
89
|
+
if __FILE__ == $0
|
90
|
+
begin
|
91
|
+
get_related_keywords()
|
92
|
+
|
93
|
+
# HTTP errors.
|
94
|
+
rescue AdsCommon::Errors::HttpError => e
|
95
|
+
puts "HTTP Error: %s" % e
|
96
|
+
|
97
|
+
# API errors.
|
98
|
+
rescue AdwordsApi::Errors::ApiException => e
|
99
|
+
puts "Message: %s" % e.message
|
100
|
+
puts 'Errors:'
|
101
|
+
e.errors.each_with_index do |error, index|
|
102
|
+
puts "\tError [%d]:" % (index + 1)
|
103
|
+
error.each do |field, value|
|
104
|
+
puts "\t\t%s: %s" % [field, value]
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,107 @@
|
|
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 retrieves URLs that have content keywords related to a given
|
21
|
+
# website.
|
22
|
+
#
|
23
|
+
# Tags: TargetingIdeaService.get
|
24
|
+
|
25
|
+
require 'rubygems'
|
26
|
+
require 'adwords_api'
|
27
|
+
require 'adwords_api/utils'
|
28
|
+
|
29
|
+
API_VERSION = :v201109
|
30
|
+
PAGE_SIZE = 100
|
31
|
+
|
32
|
+
def get_related_placements()
|
33
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
34
|
+
# when called without parameters.
|
35
|
+
adwords = AdwordsApi::Api.new
|
36
|
+
|
37
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
38
|
+
# the configuration file or provide your own logger:
|
39
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
40
|
+
|
41
|
+
targeting_idea_srv = adwords.service(:TargetingIdeaService, API_VERSION)
|
42
|
+
|
43
|
+
url = 'INSERT_PLACEMENT_URL_HERE'
|
44
|
+
|
45
|
+
# Construct selector.
|
46
|
+
selector = {
|
47
|
+
:idea_type => 'PLACEMENT',
|
48
|
+
:request_type => 'IDEAS',
|
49
|
+
:requested_attribute_types => ['CRITERION'],
|
50
|
+
:search_parameters => [{
|
51
|
+
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
52
|
+
# being created. It's only necessary when you must provide an explicit
|
53
|
+
# type that the client library can't infer.
|
54
|
+
:xsi_type => 'RelatedToUrlSearchParameter',
|
55
|
+
:urls => [url],
|
56
|
+
:include_sub_urls => false
|
57
|
+
}],
|
58
|
+
:paging => {
|
59
|
+
:start_index => 0,
|
60
|
+
:number_results => PAGE_SIZE
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
# Define initial values.
|
65
|
+
offset = 0
|
66
|
+
results = []
|
67
|
+
|
68
|
+
begin
|
69
|
+
# Perform request.
|
70
|
+
page = targeting_idea_srv.get(selector)
|
71
|
+
results += page[:entries] if page and page[:entries]
|
72
|
+
|
73
|
+
# Prepare next page request.
|
74
|
+
offset += PAGE_SIZE
|
75
|
+
selector[:paging][:start_index] = offset
|
76
|
+
end while offset < page[:total_num_entries]
|
77
|
+
|
78
|
+
# Display results.
|
79
|
+
results.each do |result|
|
80
|
+
data = AdwordsApi::Utils.map(result[:data])
|
81
|
+
placement = data['CRITERION'][:value]
|
82
|
+
puts "Related content keywords found at URL [%s]" % placement[:url]
|
83
|
+
end
|
84
|
+
puts "Total URLs found with keywords related to keywords at [%s]: %d." %
|
85
|
+
[url, results.length]
|
86
|
+
end
|
87
|
+
|
88
|
+
if __FILE__ == $0
|
89
|
+
begin
|
90
|
+
get_related_placements()
|
91
|
+
|
92
|
+
# HTTP errors.
|
93
|
+
rescue AdsCommon::Errors::HttpError => e
|
94
|
+
puts "HTTP Error: %s" % e
|
95
|
+
|
96
|
+
# API errors.
|
97
|
+
rescue AdwordsApi::Errors::ApiException => e
|
98
|
+
puts "Message: %s" % e.message
|
99
|
+
puts 'Errors:'
|
100
|
+
e.errors.each_with_index do |error, index|
|
101
|
+
puts "\tError [%d]:" % (index + 1)
|
102
|
+
error.each do |field, value|
|
103
|
+
puts "\t\t%s: %s" % [field, value]
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|