google-dfp-api 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +7 -0
- data/examples/{v201403 → v201502}/activity_group_service/create_activity_groups.rb +1 -1
- data/examples/{v201403 → v201502}/activity_group_service/get_active_activity_groups.rb +18 -27
- data/examples/{v201403 → v201502}/activity_group_service/get_all_activity_groups.rb +13 -23
- data/examples/{v201403 → v201502}/activity_group_service/update_activity_groups.rb +11 -9
- data/examples/{v201403 → v201502}/activity_service/create_activities.rb +1 -1
- data/examples/{v201403 → v201502}/activity_service/get_active_activities.rb +15 -27
- data/examples/{v201403 → v201502}/activity_service/get_all_activities.rb +10 -21
- data/examples/{v201403 → v201502}/activity_service/update_activities.rb +9 -7
- data/examples/{v201403 → v201502}/audience_segment_service/create_audience_segments.rb +1 -1
- data/examples/{v201403 → v201502}/audience_segment_service/get_all_audience_segments.rb +10 -19
- data/examples/{v201403 → v201502}/audience_segment_service/get_first_party_audience_segments.rb +14 -21
- data/examples/{v201403 → v201502}/audience_segment_service/populate_first_party_audience_segments.rb +16 -14
- data/examples/{v201403 → v201502}/audience_segment_service/update_audience_segments.rb +12 -11
- data/examples/{v201403 → v201502}/common/error_handling.rb +1 -1
- data/examples/{v201403 → v201502}/common/oauth2_jwt_handling.rb +9 -17
- data/examples/{v201403 → v201502}/common/setup_oauth2.rb +1 -1
- data/examples/{v201403 → v201502}/company_service/create_companies.rb +1 -1
- data/examples/{v201403 → v201502}/company_service/get_all_companies.rb +10 -18
- data/examples/{v201403 → v201502}/company_service/get_companies_by_statement.rb +21 -16
- data/examples/{v201403 → v201502}/company_service/update_companies.rb +13 -10
- data/examples/{v201403 → v201502}/contact_service/create_contacts.rb +1 -1
- data/examples/{v201403 → v201502}/contact_service/get_all_contacts.rb +11 -19
- data/examples/{v201403 → v201502}/contact_service/get_uninvited_contacts.rb +18 -22
- data/examples/{v201403 → v201502}/contact_service/update_contacts.rb +9 -7
- data/examples/{v201403 → v201502}/content_metadata_key_hierarchy_service/create_content_metadata_key_hierarchies.rb +1 -1
- data/examples/{v201403 → v201502}/content_metadata_key_hierarchy_service/delete_content_metadata_key_hierarchies.rb +11 -8
- data/examples/{v201403 → v201502}/content_metadata_key_hierarchy_service/get_all_content_metadata_key_hierarchies.rb +8 -18
- data/examples/{v201403 → v201502}/content_metadata_key_hierarchy_service/update_content_metadata_key_hierarchies.rb +9 -7
- data/examples/{v201403 → v201502}/content_service/get_all_content.rb +9 -18
- data/examples/{v201403 → v201502}/content_service/get_content_by_category.rb +18 -28
- data/examples/{v201403 → v201502}/creative_service/copy_image_creatives.rb +7 -7
- data/examples/{v201403 → v201502}/creative_service/create_creative_from_template.rb +1 -1
- data/examples/{v201403 → v201502}/creative_service/create_creatives.rb +1 -1
- data/examples/{v201403 → v201502}/creative_service/create_custom_creative.rb +1 -1
- data/examples/{v201403 → v201502}/creative_service/get_all_creatives.rb +8 -17
- data/examples/{v201403 → v201502}/creative_service/get_creatives_by_statement.rb +18 -13
- data/examples/{v201403 → v201502}/creative_service/update_creatives.rb +16 -11
- data/examples/{v201403 → v201502}/creative_set_service/associate_creative_set_to_line_item.rb +1 -1
- data/examples/{v201403 → v201502}/creative_set_service/create_creative_set.rb +1 -1
- data/examples/{v201403 → v201502}/creative_set_service/get_all_creative_sets.rb +9 -17
- data/examples/{v201403 → v201502}/creative_set_service/get_creative_sets_by_statement.rb +20 -14
- data/examples/{v201403 → v201502}/creative_set_service/update_creative_sets.rb +10 -7
- data/examples/{v201403 → v201502}/creative_template_service/get_all_creative_templates.rb +9 -17
- data/examples/{v201403/creative_template_service/get_creative_templates_by_statement.rb → v201502/creative_template_service/get_system_defined_creative_templates.rb} +24 -13
- data/examples/{v201403 → v201502}/creative_wrapper_service/create_creative_wrappers.rb +1 -1
- data/examples/{v201403 → v201502}/creative_wrapper_service/deactivate_creative_wrapper.rb +9 -7
- data/examples/{v201403 → v201502}/creative_wrapper_service/get_all_creative_wrappers.rb +10 -18
- data/examples/{v201403 → v201502}/creative_wrapper_service/get_creative_wrappers_by_statement.rb +17 -12
- data/examples/{v201403 → v201502}/creative_wrapper_service/update_creative_wrappers.rb +10 -7
- data/examples/{v201403 → v201502}/custom_field_service/create_custom_field_options.rb +1 -1
- data/examples/{v201403 → v201502}/custom_field_service/create_custom_fields.rb +1 -1
- data/examples/{v201403 → v201502}/custom_field_service/deactivate_all_line_item_custom_fields.rb +13 -23
- data/examples/{v201403 → v201502}/custom_field_service/get_all_custom_fields.rb +11 -19
- data/examples/{v201403 → v201502}/custom_field_service/get_all_line_item_custom_fields.rb +19 -14
- data/examples/{v201403 → v201502}/custom_field_service/set_line_item_custom_field_value.rb +24 -19
- data/examples/{v201403 → v201502}/custom_field_service/update_custom_fields.rb +10 -7
- data/examples/{v201403 → v201502}/custom_targeting_service/create_custom_targeting_keys_and_values.rb +1 -1
- data/examples/{v201403 → v201502}/custom_targeting_service/delete_custom_targeting_keys.rb +16 -20
- data/examples/{v201403 → v201502}/custom_targeting_service/delete_custom_targeting_values.rb +23 -21
- data/examples/{v201403 → v201502}/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +15 -36
- data/examples/{v201403 → v201502}/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +20 -16
- data/examples/{v201403 → v201502}/custom_targeting_service/get_custom_targeting_values_by_statement.rb +19 -15
- data/examples/{v201403 → v201502}/custom_targeting_service/update_custom_targeting_keys.rb +4 -3
- data/examples/{v201403 → v201502}/custom_targeting_service/update_custom_targeting_values.rb +34 -30
- data/examples/{v201403/forecast_service/get_forecast.rb → v201502/forecast_service/get_availability_forecast.rb} +39 -15
- data/examples/{v201403/forecast_service/get_forecast_by_id.rb → v201502/forecast_service/get_availability_forecast_for_line_item.rb} +18 -11
- data/examples/v201502/forecast_service/get_delivery_forecast_for_line_items.rb +81 -0
- data/examples/{v201403 → v201502}/inventory_service/create_ad_units.rb +1 -1
- data/examples/{v201403 → v201502}/inventory_service/create_mobile_ad_unit.rb +1 -1
- data/examples/{v201403 → v201502}/inventory_service/create_video_ad_unit.rb +1 -1
- data/examples/{v201403 → v201502}/inventory_service/deactivate_ad_units.rb +19 -23
- data/examples/{v201403 → v201502}/inventory_service/get_ad_unit_sizes.rb +7 -14
- data/examples/{v201403 → v201502}/inventory_service/get_ad_units_by_statement.rb +18 -13
- data/examples/{v201403 → v201502}/inventory_service/get_all_ad_units.rb +8 -17
- data/examples/{v201403 → v201502}/inventory_service/update_ad_units.rb +23 -11
- data/examples/{v201403 → v201502}/label_service/create_labels.rb +1 -1
- data/examples/{v201403 → v201502}/label_service/deactivate_labels.rb +15 -22
- data/examples/{v201403 → v201502}/label_service/get_all_labels.rb +9 -18
- data/examples/{v201403 → v201502}/label_service/get_labels_by_statement.rb +16 -11
- data/examples/{v201403 → v201502}/label_service/update_labels.rb +24 -26
- data/examples/{v201403 → v201502}/line_item_creative_association_service/create_licas.rb +1 -1
- data/examples/{v201403 → v201502}/line_item_creative_association_service/deactivate_licas.rb +15 -24
- data/examples/{v201403 → v201502}/line_item_creative_association_service/get_all_licas.rb +8 -17
- data/examples/{v201403 → v201502}/line_item_creative_association_service/get_licas_by_statement.rb +10 -8
- data/examples/{v201403 → v201502}/line_item_creative_association_service/update_licas.rb +16 -7
- data/examples/{v201403 → v201502}/line_item_service/activate_line_items.rb +13 -21
- data/examples/{v201403 → v201502}/line_item_service/create_line_items.rb +6 -3
- data/examples/{v201403 → v201502}/line_item_service/create_video_line_item.rb +8 -2
- data/examples/{v201403 → v201502}/line_item_service/get_all_line_items.rb +9 -17
- data/examples/{v201403 → v201502}/line_item_service/get_line_items_by_statement.rb +19 -17
- data/examples/{v201403 → v201502}/line_item_service/get_recently_updated_line_items.rb +19 -13
- data/examples/{v201403 → v201502}/line_item_service/target_custom_criteria.rb +9 -7
- data/examples/{v201403 → v201502}/line_item_service/update_line_items.rb +9 -9
- data/examples/{v201403 → v201502}/network_service/get_all_networks.rb +1 -1
- data/examples/{v201403 → v201502}/network_service/get_current_network.rb +1 -1
- data/examples/{v201403 → v201502}/network_service/make_test_network.rb +1 -1
- data/examples/{v201403 → v201502}/order_service/approve_orders.rb +16 -24
- data/examples/{v201403 → v201502}/order_service/create_orders.rb +1 -1
- data/examples/{v201403 → v201502}/order_service/get_all_orders.rb +8 -17
- data/examples/{v201403 → v201502}/order_service/get_orders_by_statement.rb +18 -14
- data/examples/{v201403 → v201502}/order_service/update_orders.rb +15 -7
- data/examples/{v201403 → v201502}/placement_service/create_placements.rb +4 -2
- data/examples/{v201403 → v201502}/placement_service/deactivate_placements.rb +14 -22
- data/examples/{v201403 → v201502}/placement_service/get_all_placements.rb +9 -17
- data/examples/{v201403 → v201502}/placement_service/get_placements_by_statement.rb +18 -13
- data/examples/{v201403 → v201502}/placement_service/update_placements.rb +16 -6
- data/examples/{v201403 → v201502}/publisher_query_language_service/fetch_match_tables.rb +8 -11
- data/examples/{v201403 → v201502}/publisher_query_language_service/get_all_line_items.rb +8 -9
- data/examples/{v201403 → v201502}/publisher_query_language_service/get_geo_targets.rb +10 -10
- data/examples/{v201403 → v201502}/publisher_query_language_service/get_line_items_named_like.rb +10 -10
- data/examples/{v201403 → v201502}/report_service/display_report.rb +1 -1
- data/examples/{v201403 → v201502}/report_service/download_report.rb +1 -1
- data/examples/{v201403 → v201502}/report_service/run_delivery_report.rb +1 -1
- data/examples/{v201403 → v201502}/report_service/run_inventory_report.rb +4 -4
- data/examples/{v201403 → v201502}/report_service/run_reach_report.rb +1 -1
- data/examples/{v201403/report_service/run_merged_delivery_report.rb → v201502/report_service/run_report_with_custom_fields.rb} +12 -14
- data/examples/{v201403 → v201502}/report_service/run_sales_report.rb +1 -1
- data/examples/{v201403 → v201502}/suggested_ad_unit_service/approve_all_suggested_ad_units.rb +25 -21
- data/examples/{v201403 → v201502}/suggested_ad_unit_service/get_all_suggested_ad_units.rb +9 -18
- data/examples/{v201403 → v201502}/suggested_ad_unit_service/get_suggested_ad_units_by_statement.rb +24 -21
- data/examples/{v201403 → v201502}/team_service/create_teams.rb +1 -1
- data/examples/{v201403 → v201502}/team_service/get_all_teams.rb +8 -17
- data/examples/{v201403 → v201502}/team_service/get_teams_by_statement.rb +15 -11
- data/examples/{v201403 → v201502}/team_service/update_teams.rb +4 -3
- data/examples/{v201403 → v201502}/user_service/create_users.rb +1 -1
- data/examples/{v201403 → v201502}/user_service/deactivate_users.rb +7 -7
- data/examples/{v201403 → v201502}/user_service/get_all_roles.rb +1 -1
- data/examples/{v201403 → v201502}/user_service/get_all_users.rb +8 -18
- data/examples/{v201403 → v201502}/user_service/get_current_user.rb +1 -1
- data/examples/{v201403 → v201502}/user_service/get_users_by_statement.rb +17 -12
- data/examples/{v201403 → v201502}/user_service/update_users.rb +15 -6
- data/examples/{v201403 → v201502}/user_team_association_service/create_user_team_associations.rb +1 -1
- data/examples/{v201403 → v201502}/user_team_association_service/delete_user_team_associations.rb +13 -21
- data/examples/{v201403 → v201502}/user_team_association_service/get_all_user_team_associations.rb +10 -17
- data/examples/{v201403 → v201502}/user_team_association_service/get_user_team_associations_by_statement.rb +20 -16
- data/examples/{v201403 → v201502}/user_team_association_service/update_user_team_associations.rb +8 -7
- data/lib/dfp_api.rb +0 -10
- data/lib/dfp_api/api_config.rb +22 -67
- data/lib/dfp_api/{v201308 → v201502}/activity_group_service.rb +6 -18
- data/lib/dfp_api/v201502/activity_group_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/activity_service.rb +6 -18
- data/lib/dfp_api/v201502/activity_service_registry.rb +45 -0
- data/lib/dfp_api/v201502/ad_exclusion_rule_service.rb +46 -0
- data/lib/dfp_api/v201502/ad_exclusion_rule_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/ad_rule_service.rb +6 -18
- data/lib/dfp_api/v201502/ad_rule_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/audience_segment_service.rb +6 -6
- data/lib/dfp_api/v201502/audience_segment_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/base_rate_service.rb +6 -18
- data/lib/dfp_api/v201502/base_rate_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/company_service.rb +6 -18
- data/lib/dfp_api/v201502/company_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/contact_service.rb +6 -18
- data/lib/dfp_api/v201502/contact_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/content_bundle_service.rb +6 -18
- data/lib/dfp_api/v201502/content_bundle_service_registry.rb +45 -0
- data/lib/dfp_api/v201502/content_metadata_key_hierarchy_service.rb +46 -0
- data/lib/dfp_api/v201502/content_metadata_key_hierarchy_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/content_service.rb +6 -6
- data/lib/dfp_api/v201502/content_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/creative_service.rb +6 -18
- data/lib/dfp_api/v201502/creative_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/creative_set_service.rb +6 -10
- data/lib/dfp_api/v201502/creative_set_service_registry.rb +45 -0
- data/lib/dfp_api/{v201306 → v201502}/creative_template_service.rb +6 -10
- data/lib/dfp_api/v201502/creative_template_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/creative_wrapper_service.rb +6 -18
- data/lib/dfp_api/v201502/creative_wrapper_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/custom_field_service.rb +6 -26
- data/lib/dfp_api/v201502/custom_field_service_registry.rb +45 -0
- data/lib/dfp_api/{v201306 → v201502}/custom_targeting_service.rb +6 -6
- data/lib/dfp_api/v201502/custom_targeting_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/exchange_rate_service.rb +6 -10
- data/lib/dfp_api/v201502/exchange_rate_service_registry.rb +45 -0
- data/lib/dfp_api/v201502/forecast_service.rb +46 -0
- data/lib/dfp_api/v201502/forecast_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/inventory_service.rb +6 -18
- data/lib/dfp_api/v201502/inventory_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/label_service.rb +6 -18
- data/lib/dfp_api/v201502/label_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/line_item_creative_association_service.rb +6 -18
- data/lib/dfp_api/v201502/line_item_creative_association_service_registry.rb +45 -0
- data/lib/dfp_api/{v201306 → v201502}/line_item_service.rb +6 -18
- data/lib/dfp_api/v201502/line_item_service_registry.rb +45 -0
- data/lib/dfp_api/{v201306 → v201502}/line_item_template_service.rb +6 -6
- data/lib/dfp_api/v201502/line_item_template_service_registry.rb +45 -0
- data/lib/dfp_api/v201502/live_stream_event_service.rb +46 -0
- data/lib/dfp_api/v201502/live_stream_event_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/network_service.rb +6 -6
- data/lib/dfp_api/v201502/network_service_registry.rb +45 -0
- data/lib/dfp_api/{v201306 → v201502}/order_service.rb +6 -18
- data/lib/dfp_api/v201502/order_service_registry.rb +45 -0
- data/lib/dfp_api/v201502/package_service.rb +46 -0
- data/lib/dfp_api/v201502/package_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/placement_service.rb +6 -18
- data/lib/dfp_api/v201502/placement_service_registry.rb +45 -0
- data/lib/dfp_api/v201502/premium_rate_service.rb +42 -0
- data/lib/dfp_api/v201502/premium_rate_service_registry.rb +45 -0
- data/lib/dfp_api/v201502/product_package_item_service.rb +46 -0
- data/lib/dfp_api/v201502/product_package_item_service_registry.rb +45 -0
- data/lib/dfp_api/v201502/product_package_service.rb +46 -0
- data/lib/dfp_api/v201502/product_package_service_registry.rb +45 -0
- data/lib/dfp_api/{v201306 → v201502}/product_service.rb +6 -14
- data/lib/dfp_api/v201502/product_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/product_template_service.rb +6 -18
- data/lib/dfp_api/v201502/product_template_service_registry.rb +45 -0
- data/lib/dfp_api/{v201306 → v201502}/proposal_line_item_service.rb +6 -18
- data/lib/dfp_api/v201502/proposal_line_item_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/proposal_service.rb +6 -18
- data/lib/dfp_api/v201502/proposal_service_registry.rb +45 -0
- data/lib/dfp_api/{v201306 → v201502}/publisher_query_language_service.rb +6 -6
- data/lib/dfp_api/v201502/publisher_query_language_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/rate_card_service.rb +6 -18
- data/lib/dfp_api/v201502/rate_card_service_registry.rb +45 -0
- data/lib/dfp_api/{v201306 → v201502}/reconciliation_order_report_service.rb +6 -10
- data/lib/dfp_api/v201502/reconciliation_order_report_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/reconciliation_report_row_service.rb +6 -6
- data/lib/dfp_api/v201502/reconciliation_report_row_service_registry.rb +45 -0
- data/lib/dfp_api/{v201306 → v201502}/reconciliation_report_service.rb +6 -14
- data/lib/dfp_api/v201502/reconciliation_report_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/report_service.rb +6 -6
- data/lib/dfp_api/v201502/report_service_registry.rb +45 -0
- data/lib/dfp_api/v201502/shared_ad_unit_service.rb +38 -0
- data/lib/dfp_api/v201502/shared_ad_unit_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/suggested_ad_unit_service.rb +6 -10
- data/lib/dfp_api/v201502/suggested_ad_unit_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/team_service.rb +6 -18
- data/lib/dfp_api/v201502/team_service_registry.rb +45 -0
- data/lib/dfp_api/{v201308 → v201502}/user_service.rb +6 -18
- data/lib/dfp_api/v201502/user_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/user_team_association_service.rb +6 -18
- data/lib/dfp_api/v201502/user_team_association_service_registry.rb +45 -0
- data/lib/dfp_api/{v201311 → v201502}/workflow_request_service.rb +6 -6
- data/lib/dfp_api/v201502/workflow_request_service_registry.rb +45 -0
- data/lib/dfp_api/version.rb +1 -1
- metadata +909 -1057
- checksums.yaml +0 -15
- data/examples/v201403/creative_template_service/get_creative_template.rb +0 -74
- data/examples/v201403/line_item_service/create_mobile_line_item.rb +0 -135
- data/examples/v201403/report_service/run_report_with_custom_fields.rb +0 -135
- data/examples/v201403/suggested_ad_unit_service/get_suggested_ad_unit.rb +0 -75
- data/lib/dfp_api/client_login_header_handler.rb +0 -52
- data/lib/dfp_api/v201306/activity_group_service.rb +0 -54
- data/lib/dfp_api/v201306/activity_group_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/activity_service.rb +0 -54
- data/lib/dfp_api/v201306/activity_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/ad_rule_service.rb +0 -58
- data/lib/dfp_api/v201306/ad_rule_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/audience_segment_service.rb +0 -34
- data/lib/dfp_api/v201306/audience_segment_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/base_rate_service.rb +0 -58
- data/lib/dfp_api/v201306/base_rate_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/company_service.rb +0 -54
- data/lib/dfp_api/v201306/company_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/contact_service.rb +0 -54
- data/lib/dfp_api/v201306/contact_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/content_bundle_service.rb +0 -58
- data/lib/dfp_api/v201306/content_bundle_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/content_service.rb +0 -38
- data/lib/dfp_api/v201306/content_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/creative_service.rb +0 -54
- data/lib/dfp_api/v201306/creative_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/creative_set_service.rb +0 -46
- data/lib/dfp_api/v201306/creative_set_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/creative_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/creative_wrapper_service.rb +0 -58
- data/lib/dfp_api/v201306/creative_wrapper_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/custom_field_service.rb +0 -78
- data/lib/dfp_api/v201306/custom_field_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/custom_targeting_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/forecast_service.rb +0 -38
- data/lib/dfp_api/v201306/forecast_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/inventory_service.rb +0 -62
- data/lib/dfp_api/v201306/inventory_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/label_service.rb +0 -58
- data/lib/dfp_api/v201306/label_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/line_item_creative_association_service.rb +0 -62
- data/lib/dfp_api/v201306/line_item_creative_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/line_item_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/line_item_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/network_service.rb +0 -46
- data/lib/dfp_api/v201306/network_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/order_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/placement_service.rb +0 -58
- data/lib/dfp_api/v201306/placement_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/product_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/product_template_service.rb +0 -58
- data/lib/dfp_api/v201306/product_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/proposal_line_item_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/proposal_service.rb +0 -58
- data/lib/dfp_api/v201306/proposal_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/publisher_query_language_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/rate_card_customization_service.rb +0 -58
- data/lib/dfp_api/v201306/rate_card_customization_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/rate_card_service.rb +0 -58
- data/lib/dfp_api/v201306/rate_card_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/reconciliation_order_report_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/reconciliation_report_row_service.rb +0 -38
- data/lib/dfp_api/v201306/reconciliation_report_row_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/reconciliation_report_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/report_service.rb +0 -46
- data/lib/dfp_api/v201306/report_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/suggested_ad_unit_service.rb +0 -42
- data/lib/dfp_api/v201306/suggested_ad_unit_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/team_service.rb +0 -54
- data/lib/dfp_api/v201306/team_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/user_service.rb +0 -66
- data/lib/dfp_api/v201306/user_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/user_team_association_service.rb +0 -58
- data/lib/dfp_api/v201306/user_team_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201306/workflow_action_service.rb +0 -38
- data/lib/dfp_api/v201306/workflow_action_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/activity_group_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/activity_service.rb +0 -54
- data/lib/dfp_api/v201308/activity_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/ad_rule_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/audience_segment_service.rb +0 -46
- data/lib/dfp_api/v201308/audience_segment_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/base_rate_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/company_service.rb +0 -54
- data/lib/dfp_api/v201308/company_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/contact_service.rb +0 -54
- data/lib/dfp_api/v201308/contact_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/content_bundle_service.rb +0 -58
- data/lib/dfp_api/v201308/content_bundle_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/content_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/creative_service.rb +0 -54
- data/lib/dfp_api/v201308/creative_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/creative_set_service.rb +0 -46
- data/lib/dfp_api/v201308/creative_set_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/creative_template_service.rb +0 -38
- data/lib/dfp_api/v201308/creative_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/creative_wrapper_service.rb +0 -58
- data/lib/dfp_api/v201308/creative_wrapper_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/custom_field_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/custom_targeting_service.rb +0 -62
- data/lib/dfp_api/v201308/custom_targeting_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/forecast_service.rb +0 -38
- data/lib/dfp_api/v201308/forecast_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/inventory_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/label_service.rb +0 -58
- data/lib/dfp_api/v201308/label_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/line_item_creative_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/line_item_service.rb +0 -58
- data/lib/dfp_api/v201308/line_item_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/line_item_template_service.rb +0 -34
- data/lib/dfp_api/v201308/line_item_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/network_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/order_service.rb +0 -58
- data/lib/dfp_api/v201308/order_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/placement_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/product_service.rb +0 -50
- data/lib/dfp_api/v201308/product_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/product_template_service.rb +0 -58
- data/lib/dfp_api/v201308/product_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/proposal_line_item_service.rb +0 -58
- data/lib/dfp_api/v201308/proposal_line_item_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/proposal_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/publisher_query_language_service.rb +0 -34
- data/lib/dfp_api/v201308/publisher_query_language_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/rate_card_customization_service.rb +0 -58
- data/lib/dfp_api/v201308/rate_card_customization_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/rate_card_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/reconciliation_order_report_service.rb +0 -42
- data/lib/dfp_api/v201308/reconciliation_order_report_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/reconciliation_report_row_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/reconciliation_report_service.rb +0 -46
- data/lib/dfp_api/v201308/reconciliation_report_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/report_service.rb +0 -46
- data/lib/dfp_api/v201308/report_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/suggested_ad_unit_service.rb +0 -42
- data/lib/dfp_api/v201308/suggested_ad_unit_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/team_service.rb +0 -54
- data/lib/dfp_api/v201308/team_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/user_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/user_team_association_service.rb +0 -58
- data/lib/dfp_api/v201308/user_team_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201308/workflow_action_service.rb +0 -38
- data/lib/dfp_api/v201308/workflow_action_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/activity_group_service.rb +0 -54
- data/lib/dfp_api/v201311/activity_group_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/activity_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/ad_rule_service.rb +0 -58
- data/lib/dfp_api/v201311/ad_rule_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/audience_segment_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/base_rate_service.rb +0 -58
- data/lib/dfp_api/v201311/base_rate_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/company_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/contact_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/content_bundle_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/content_metadata_key_hierarchy_service.rb +0 -34
- data/lib/dfp_api/v201311/content_metadata_key_hierarchy_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/content_service.rb +0 -38
- data/lib/dfp_api/v201311/content_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/creative_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/creative_set_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/creative_template_service.rb +0 -38
- data/lib/dfp_api/v201311/creative_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/creative_wrapper_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/custom_field_service.rb +0 -78
- data/lib/dfp_api/v201311/custom_field_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/custom_targeting_service.rb +0 -62
- data/lib/dfp_api/v201311/custom_targeting_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/exchange_rate_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/forecast_service.rb +0 -38
- data/lib/dfp_api/v201311/forecast_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/inventory_service.rb +0 -62
- data/lib/dfp_api/v201311/inventory_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/label_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/line_item_creative_association_service.rb +0 -62
- data/lib/dfp_api/v201311/line_item_creative_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/line_item_service.rb +0 -58
- data/lib/dfp_api/v201311/line_item_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/line_item_template_service.rb +0 -34
- data/lib/dfp_api/v201311/line_item_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/network_service.rb +0 -46
- data/lib/dfp_api/v201311/network_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/order_service.rb +0 -58
- data/lib/dfp_api/v201311/order_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/placement_service.rb +0 -58
- data/lib/dfp_api/v201311/placement_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/product_service.rb +0 -50
- data/lib/dfp_api/v201311/product_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/product_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/proposal_line_item_service.rb +0 -58
- data/lib/dfp_api/v201311/proposal_line_item_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/proposal_service.rb +0 -58
- data/lib/dfp_api/v201311/proposal_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/publisher_query_language_service.rb +0 -34
- data/lib/dfp_api/v201311/publisher_query_language_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/rate_card_customization_service.rb +0 -58
- data/lib/dfp_api/v201311/rate_card_customization_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/rate_card_service.rb +0 -58
- data/lib/dfp_api/v201311/rate_card_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/reconciliation_order_report_service.rb +0 -42
- data/lib/dfp_api/v201311/reconciliation_order_report_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/reconciliation_report_row_service.rb +0 -38
- data/lib/dfp_api/v201311/reconciliation_report_row_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/reconciliation_report_service.rb +0 -46
- data/lib/dfp_api/v201311/reconciliation_report_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/report_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/suggested_ad_unit_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/team_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/user_service.rb +0 -66
- data/lib/dfp_api/v201311/user_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/user_team_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201311/workflow_request_service_registry.rb +0 -46
@@ -25,9 +25,9 @@
|
|
25
25
|
# Tags: CustomTargetingService.getCustomTargetingValuesByStatement
|
26
26
|
|
27
27
|
require 'dfp_api'
|
28
|
+
require 'dfp_api_statement'
|
28
29
|
|
29
|
-
API_VERSION = :
|
30
|
-
PAGE_SIZE = 500
|
30
|
+
API_VERSION = :v201502
|
31
31
|
|
32
32
|
def get_all_custom_targeting_keys_and_values()
|
33
33
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -40,29 +40,19 @@ def get_all_custom_targeting_keys_and_values()
|
|
40
40
|
# Get the CustomTargetingService.
|
41
41
|
custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION)
|
42
42
|
|
43
|
-
# Define initial values.
|
44
|
-
offset = 0
|
45
|
-
page = {}
|
46
|
-
|
47
43
|
begin
|
48
44
|
# Create a statement to get one page with current offset.
|
49
|
-
statement =
|
45
|
+
statement = DfpApiStatement::FilterStatement.new('ORDER BY id ASC')
|
50
46
|
|
51
47
|
# Get custom targeting keys by statement.
|
52
48
|
page = custom_targeting_service.get_custom_targeting_keys_by_statement(
|
53
|
-
statement)
|
49
|
+
statement.toStatement())
|
54
50
|
|
55
51
|
if page[:results]
|
56
|
-
# Increase query offset by page size.
|
57
|
-
offset += PAGE_SIZE
|
58
|
-
|
59
|
-
# Get the start index for printout.
|
60
|
-
start_index = page[:start_index]
|
61
|
-
|
62
52
|
# Print details about each key in results.
|
63
53
|
page[:results].each_with_index do |custom_targeting_key, index|
|
64
54
|
puts ("%d) Custom targeting key ID: %d, name: %s, displayName: %s, " +
|
65
|
-
"type: %s") % [index +
|
55
|
+
"type: %s") % [index + statement.offset,
|
66
56
|
custom_targeting_key[:id],
|
67
57
|
custom_targeting_key[:name],
|
68
58
|
custom_targeting_key[:display_name],
|
@@ -70,7 +60,8 @@ def get_all_custom_targeting_keys_and_values()
|
|
70
60
|
print_all_values_for_key(custom_targeting_service, custom_targeting_key)
|
71
61
|
end
|
72
62
|
end
|
73
|
-
|
63
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
64
|
+
end while statement.offset < page[:total_result_set_size]
|
74
65
|
|
75
66
|
# Print a footer.
|
76
67
|
if page.include?(:total_result_set_size)
|
@@ -80,45 +71,33 @@ def get_all_custom_targeting_keys_and_values()
|
|
80
71
|
end
|
81
72
|
|
82
73
|
def print_all_values_for_key(custom_targeting_service, custom_targeting_key)
|
83
|
-
# Define initial values.
|
84
|
-
offset = 0
|
85
|
-
page = {}
|
86
|
-
|
87
74
|
# Create a statement to get values for given key.
|
88
|
-
|
89
|
-
|
90
|
-
|
75
|
+
statement = DfpApiStatement::FilterStatement.new(
|
76
|
+
'WHERE customTargetingKeyId = :key_id',
|
77
|
+
[
|
91
78
|
{:key => 'key_id',
|
92
79
|
:value => {:value => custom_targeting_key[:id],
|
93
80
|
:xsi_type => 'NumberValue'}}
|
94
81
|
]
|
95
|
-
|
82
|
+
)
|
96
83
|
|
97
84
|
begin
|
98
|
-
# Modify statement to get the next page.
|
99
|
-
statement[:query] = statement_text + " OFFSET %d" % offset
|
100
|
-
|
101
85
|
# Get custom targeting values by statement.
|
102
86
|
page = custom_targeting_service.get_custom_targeting_values_by_statement(
|
103
|
-
statement)
|
87
|
+
statement.toStatement())
|
104
88
|
|
105
89
|
if page[:results]
|
106
|
-
# Increase query offset by page size.
|
107
|
-
offset += PAGE_SIZE
|
108
|
-
|
109
|
-
# Get the start index for printout.
|
110
|
-
start_index = page[:start_index]
|
111
|
-
|
112
90
|
# Print details about each value in results.
|
113
91
|
page[:results].each_with_index do |custom_targeting_value, index|
|
114
92
|
puts ("\t%d) Custom targeting value ID: %d, name: %s, displayName: %s") %
|
115
|
-
[index +
|
93
|
+
[index + statement.offset,
|
116
94
|
custom_targeting_value[:id],
|
117
95
|
custom_targeting_value[:name],
|
118
96
|
custom_targeting_value[:display_name]]
|
119
97
|
end
|
120
98
|
end
|
121
|
-
|
99
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
100
|
+
end while statement.offset < page[:total_result_set_size]
|
122
101
|
|
123
102
|
# Print a footer.
|
124
103
|
if page.include?(:total_result_set_size)
|
data/examples/{v201403 → v201502}/custom_targeting_service/get_custom_targeting_keys_by_statement.rb
RENAMED
@@ -25,8 +25,9 @@
|
|
25
25
|
# Tags: CustomTargetingService.getCustomTargetingKeysByStatement
|
26
26
|
|
27
27
|
require 'dfp_api'
|
28
|
+
require 'dfp_api_statement'
|
28
29
|
|
29
|
-
API_VERSION = :
|
30
|
+
API_VERSION = :v201502
|
30
31
|
|
31
32
|
def get_custom_targeting_keys_by_statement()
|
32
33
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -40,29 +41,32 @@ def get_custom_targeting_keys_by_statement()
|
|
40
41
|
custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION)
|
41
42
|
|
42
43
|
# Create a statement to only select predefined custom targeting keys.
|
43
|
-
statement =
|
44
|
-
|
45
|
-
|
44
|
+
statement = DfpApiStatement::FilterStatement.new(
|
45
|
+
'WHERE type = :type ORDER BY id ASC',
|
46
|
+
[
|
46
47
|
{:key => 'type',
|
47
48
|
:value => {:value => 'PREDEFINED', :xsi_type => 'TextValue'}}
|
48
49
|
]
|
49
|
-
|
50
|
+
)
|
50
51
|
|
51
52
|
# Get custom targeting keys by statement.
|
52
53
|
page = custom_targeting_service.get_custom_targeting_keys_by_statement(
|
53
|
-
statement)
|
54
|
+
statement.toStatement())
|
54
55
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
begin
|
57
|
+
if page[:results]
|
58
|
+
# Print details about each key in results.
|
59
|
+
page[:results].each_with_index do |custom_targeting_key, index|
|
60
|
+
puts ("%d) Custom targeting key with ID [%d], name: %s," +
|
61
|
+
" displayName: %s type: %s") % [index + statement.offset,
|
62
|
+
custom_targeting_key[:id],
|
63
|
+
custom_targeting_key[:name],
|
64
|
+
custom_targeting_key[:display_name],
|
65
|
+
custom_targeting_key[:type]]
|
66
|
+
end
|
64
67
|
end
|
65
|
-
|
68
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
69
|
+
end while statement.offset < page[:total_result_set_size]
|
66
70
|
|
67
71
|
# Print a footer.
|
68
72
|
if page.include?(:total_result_set_size)
|
@@ -27,8 +27,9 @@
|
|
27
27
|
# Tags: CustomTargetingService.getCustomTargetingValuesByStatement
|
28
28
|
|
29
29
|
require 'dfp_api'
|
30
|
+
require 'dfp_api_statement'
|
30
31
|
|
31
|
-
API_VERSION = :
|
32
|
+
API_VERSION = :v201502
|
32
33
|
|
33
34
|
def get_custom_targeting_values_by_statement()
|
34
35
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -45,30 +46,33 @@ def get_custom_targeting_values_by_statement()
|
|
45
46
|
custom_targeting_key_id = 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i
|
46
47
|
|
47
48
|
# Create a statement to only select custom targeting values for a given key.
|
48
|
-
statement =
|
49
|
-
|
50
|
-
|
49
|
+
statement = DfpApiStatement::FilterStatement.new(
|
50
|
+
'WHERE customTargetingKeyId = :key_id ORDER BY id',
|
51
|
+
[
|
51
52
|
{:key => 'key_id',
|
52
53
|
:value => {:value => custom_targeting_key_id,
|
53
54
|
:xsi_type => 'NumberValue'}
|
54
55
|
}
|
55
56
|
]
|
56
|
-
|
57
|
+
)
|
57
58
|
|
58
59
|
# Get custom targeting values by statement.
|
59
60
|
page = custom_targeting_service.get_custom_targeting_values_by_statement(
|
60
|
-
statement)
|
61
|
+
statement.toStatement())
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
63
|
+
begin
|
64
|
+
if page[:results]
|
65
|
+
# Print details about each value in results.
|
66
|
+
page[:results].each_with_index do |custom_targeting_value, index|
|
67
|
+
puts ("%d) Custom targeting value with ID [%d], name: %s," +
|
68
|
+
" displayName: %s") % [index + statement.offset,
|
69
|
+
custom_targeting_value[:id],
|
70
|
+
custom_targeting_value[:name],
|
71
|
+
custom_targeting_value[:display_name]]
|
72
|
+
end
|
70
73
|
end
|
71
|
-
|
74
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
75
|
+
end while statement.offset < page[:total_result_set_size]
|
72
76
|
|
73
77
|
# Print a footer.
|
74
78
|
if page.include?(:total_result_set_size)
|
@@ -26,8 +26,9 @@
|
|
26
26
|
# Tags: CustomTargetingService.updateCustomTargetingKeys
|
27
27
|
|
28
28
|
require 'dfp_api'
|
29
|
+
require 'dfp_api_statement'
|
29
30
|
|
30
|
-
API_VERSION = :
|
31
|
+
API_VERSION = :v201502
|
31
32
|
|
32
33
|
def update_custom_targeting_keys()
|
33
34
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -40,8 +41,8 @@ def update_custom_targeting_keys()
|
|
40
41
|
# Get the CustomTargetingService.
|
41
42
|
custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION)
|
42
43
|
|
43
|
-
# Create a statement to get
|
44
|
-
statement =
|
44
|
+
# Create a statement to get all custom targeting keys.
|
45
|
+
statement = DfpApiStatement::FilterStatement.new('ORDER BY id ASC')
|
45
46
|
|
46
47
|
# Get custom targeting keys by statement.
|
47
48
|
page = custom_targeting_service.get_custom_targeting_keys_by_statement(
|
data/examples/{v201403 → v201502}/custom_targeting_service/update_custom_targeting_values.rb
RENAMED
@@ -18,16 +18,17 @@
|
|
18
18
|
# See the License for the specific language governing permissions and
|
19
19
|
# limitations under the License.
|
20
20
|
#
|
21
|
-
# This example updates the display name of each custom targeting value
|
22
|
-
#
|
21
|
+
# This example updates the display name of each custom targeting value belonging
|
22
|
+
# to a single key. To determine which custom targeting keys exist, run
|
23
23
|
# get_all_custom_targeting_keys_and_values.rb.
|
24
24
|
#
|
25
25
|
# Tags: CustomTargetingService.getCustomTargetingValuesByStatement
|
26
26
|
# Tags: CustomTargetingService.updateCustomTargetingValues
|
27
27
|
|
28
28
|
require 'dfp_api'
|
29
|
+
require 'dfp_api_statement'
|
29
30
|
|
30
|
-
API_VERSION = :
|
31
|
+
API_VERSION = :v201502
|
31
32
|
|
32
33
|
def update_custom_targeting_values()
|
33
34
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -44,44 +45,47 @@ def update_custom_targeting_values()
|
|
44
45
|
custom_targeting_key_id = 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE'.to_i
|
45
46
|
|
46
47
|
# Create a statement to get first 500 custom targeting keys.
|
47
|
-
statement =
|
48
|
-
:query => 'WHERE customTargetingKeyId = :key_id
|
48
|
+
statement = DfpApiStatement::FilterStatement.new(
|
49
|
+
:query => 'WHERE customTargetingKeyId = :key_id',
|
49
50
|
:values => [
|
50
51
|
{:key => 'key_id',
|
51
52
|
:value => {:value => custom_targeting_key_id,
|
52
53
|
:xsi_type => 'NumberValue'}
|
53
54
|
}
|
54
55
|
]
|
55
|
-
|
56
|
+
)
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
raise 'No targeting values found to update' if !values || values.empty?
|
58
|
+
begin
|
59
|
+
# Get custom targeting keys by statement.
|
60
|
+
page = custom_targeting_service.get_custom_targeting_values_by_statement(
|
61
|
+
statement.toStatement())
|
63
62
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
63
|
+
if page[:results]
|
64
|
+
# Update each local custom targeting values object by changing its display
|
65
|
+
# name.
|
66
|
+
page[:results].each do |value|
|
67
|
+
display_name = (value[:display_name].nil?) ?
|
68
|
+
value[:name] : value[:display_name]
|
69
|
+
value[:display_name] = display_name + ' (Deprecated)'
|
70
|
+
end
|
71
71
|
|
72
|
-
|
73
|
-
|
72
|
+
# Update the custom targeting keys on the server.
|
73
|
+
result_values = custom_targeting_service.update_custom_targeting_values(
|
74
|
+
values)
|
74
75
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
76
|
+
if result_values
|
77
|
+
# Print details about each value in results.
|
78
|
+
result_values.each_with_index do |custom_targeting_value, index|
|
79
|
+
puts ("%d) Custom targeting key with ID [%d], name: %s," +
|
80
|
+
" displayName: %s was updated") % [
|
81
|
+
index + statement.offset, custom_targeting_value[:id],
|
82
|
+
custom_targeting_value[:name],
|
83
|
+
custom_targeting_value[:display_name]]
|
84
|
+
end
|
85
|
+
end
|
81
86
|
end
|
82
|
-
|
83
|
-
|
84
|
-
end
|
87
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
88
|
+
end while statement.offset < page[:total_result_set_size]
|
85
89
|
end
|
86
90
|
|
87
91
|
if __FILE__ == $0
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
5
5
|
#
|
6
|
-
# Copyright:: Copyright
|
6
|
+
# Copyright:: Copyright 2015, Google Inc. All Rights Reserved.
|
7
7
|
#
|
8
8
|
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
9
9
|
# you may not use this file except in compliance with the License.
|
@@ -21,13 +21,13 @@
|
|
21
21
|
# This example gets a forecast for a prospective line item. To determine which
|
22
22
|
# placements exist, run get_all_placements.rb.
|
23
23
|
#
|
24
|
-
# Tags: ForecastService.
|
24
|
+
# Tags: ForecastService.getAvailabilityForecast
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
27
|
|
28
|
-
API_VERSION = :
|
28
|
+
API_VERSION = :v201502
|
29
29
|
|
30
|
-
def
|
30
|
+
def get_availability_forecast()
|
31
31
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
32
32
|
dfp = DfpApi::Api.new
|
33
33
|
|
@@ -35,21 +35,31 @@ def get_forecast()
|
|
35
35
|
# the configuration file or provide your own logger:
|
36
36
|
# dfp.logger = Logger.new('dfp_xml.log')
|
37
37
|
|
38
|
-
# Get the
|
38
|
+
# Get the ForecastService.
|
39
39
|
forecast_service = dfp.service(:ForecastService, API_VERSION)
|
40
40
|
|
41
|
-
#
|
42
|
-
|
41
|
+
# Get the NetworkService.
|
42
|
+
network_service = dfp.service(:NetworkService, API_VERSION)
|
43
|
+
|
44
|
+
# Set the root ad unit to target the entire network.
|
45
|
+
root_ad_unit_id = (
|
46
|
+
network_service.get_current_network()[:effective_root_ad_unit_id].to_i)
|
43
47
|
|
44
48
|
# Create targeting.
|
45
49
|
targeting = {
|
46
|
-
|
47
|
-
|
50
|
+
:inventory_targeting => {
|
51
|
+
:targeted_ad_units => [
|
52
|
+
{
|
53
|
+
:include_descendants => True,
|
54
|
+
:ad_unit_id => root_ad_unit_id
|
55
|
+
}
|
56
|
+
]
|
57
|
+
}
|
48
58
|
}
|
49
59
|
|
50
60
|
# Create the creative placeholder.
|
51
61
|
creative_placeholder = {
|
52
|
-
|
62
|
+
:size => {:width => 300, :height => 250, :is_aspect_ratio => false}
|
53
63
|
}
|
54
64
|
|
55
65
|
# Create prospective line item.
|
@@ -62,14 +72,28 @@ def get_forecast()
|
|
62
72
|
:start_date_time_type => 'IMMEDIATELY',
|
63
73
|
:end_date_time => Time.utc(2014, 01, 01),
|
64
74
|
# Set the line item to use 50% of the impressions.
|
65
|
-
:
|
66
|
-
|
75
|
+
:primary_goal => {:goal => {
|
76
|
+
:units => '50',
|
77
|
+
:unit_type => 'IMPRESSIONS',
|
78
|
+
:goal_type => 'DAILY'}
|
79
|
+
},
|
67
80
|
# Set the cost type to match the unit type.
|
68
81
|
:cost_type => 'CPM'
|
69
82
|
}
|
70
83
|
|
84
|
+
prospective_line_item = {
|
85
|
+
:line_item => line_item
|
86
|
+
}
|
87
|
+
|
88
|
+
# Set forecasting options.
|
89
|
+
forecast_options = {
|
90
|
+
:include_contending_line_items => True,
|
91
|
+
:include_targeting_criteria_breakdown => True,
|
92
|
+
}
|
93
|
+
|
71
94
|
# Get forecast for the line item.
|
72
|
-
forecast = forecast_service.
|
95
|
+
forecast = forecast_service.get_availability_forecast(
|
96
|
+
prospective_line_item, forecast_options)
|
73
97
|
|
74
98
|
if forecast
|
75
99
|
# Display results.
|
@@ -78,17 +102,17 @@ def get_forecast()
|
|
78
102
|
unit_type = forecast[:unit_type].to_s.downcase
|
79
103
|
puts "%.2f %s matched." % [matched, unit_type]
|
80
104
|
puts "%.2f%% %s available." % [available_percent, unit_type]
|
105
|
+
puts "%d contending line items." % forecast[:contending_line_items].size
|
81
106
|
if forecast[:possible_units]
|
82
107
|
possible_percent = forecast[:possible_units] * 100.0 / matched
|
83
108
|
puts "%.2f%% %s possible." % [possible_percent, unit_type]
|
84
109
|
end
|
85
|
-
puts "%d contending line items." % forecast[:contending_line_items].size
|
86
110
|
end
|
87
111
|
end
|
88
112
|
|
89
113
|
if __FILE__ == $0
|
90
114
|
begin
|
91
|
-
|
115
|
+
get_availability_forecast()
|
92
116
|
|
93
117
|
# HTTP errors.
|
94
118
|
rescue AdsCommon::Errors::HttpError => e
|