google-dfp-api 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/ChangeLog +6 -0
- data/examples/{v201311 → v201411}/activity_group_service/create_activity_groups.rb +1 -1
- data/examples/{v201311 → v201411}/activity_group_service/get_active_activity_groups.rb +18 -27
- data/examples/{v201311 → v201411}/activity_group_service/get_all_activity_groups.rb +13 -23
- data/examples/{v201311 → v201411}/activity_group_service/update_activity_groups.rb +25 -14
- data/examples/{v201311 → v201411}/activity_service/create_activities.rb +1 -1
- data/examples/{v201311 → v201411}/activity_service/get_active_activities.rb +15 -27
- data/examples/{v201311 → v201411}/activity_service/get_all_activities.rb +10 -21
- data/examples/{v201311 → v201411}/activity_service/update_activities.rb +32 -16
- data/examples/{v201311 → v201411}/audience_segment_service/create_audience_segments.rb +1 -1
- data/examples/{v201311 → v201411}/audience_segment_service/get_all_audience_segments.rb +10 -19
- data/examples/{v201311 → v201411}/audience_segment_service/get_first_party_audience_segments.rb +14 -21
- data/examples/{v201311 → v201411}/audience_segment_service/populate_first_party_audience_segments.rb +16 -13
- data/examples/{v201311 → v201411}/audience_segment_service/update_audience_segments.rb +12 -11
- data/examples/{v201311 → v201411}/common/error_handling.rb +1 -1
- data/examples/{v201311 → v201411}/common/oauth2_jwt_handling.rb +9 -17
- data/examples/{v201311 → v201411}/common/setup_oauth2.rb +1 -1
- data/examples/{v201311 → v201411}/company_service/create_companies.rb +1 -1
- data/examples/{v201311 → v201411}/company_service/get_all_companies.rb +10 -18
- data/examples/{v201311 → v201411}/company_service/get_companies_by_statement.rb +21 -16
- data/examples/{v201311 → v201411}/company_service/update_companies.rb +17 -11
- data/examples/{v201311 → v201411}/contact_service/create_contacts.rb +1 -1
- data/examples/{v201311 → v201411}/contact_service/get_all_contacts.rb +11 -19
- data/examples/{v201311 → v201411}/contact_service/get_uninvited_contacts.rb +18 -22
- data/examples/{v201311 → v201411}/contact_service/update_contacts.rb +33 -17
- data/examples/v201411/content_metadata_key_hierarchy_service/create_content_metadata_key_hierarchies.rb +96 -0
- data/examples/v201411/content_metadata_key_hierarchy_service/delete_content_metadata_key_hierarchies.rb +106 -0
- data/examples/v201411/content_metadata_key_hierarchy_service/get_all_content_metadata_key_hierarchies.rb +89 -0
- data/examples/v201411/content_metadata_key_hierarchy_service/update_content_metadata_key_hierarchies.rb +115 -0
- data/examples/{v201311 → v201411}/content_service/get_all_content.rb +9 -18
- data/examples/{v201311 → v201411}/content_service/get_content_by_category.rb +18 -28
- data/examples/{v201311 → v201411}/creative_service/copy_image_creatives.rb +7 -7
- data/examples/{v201311 → v201411}/creative_service/create_creative_from_template.rb +1 -1
- data/examples/{v201311 → v201411}/creative_service/create_creatives.rb +1 -1
- data/examples/{v201311 → v201411}/creative_service/create_custom_creative.rb +1 -1
- data/examples/{v201311 → v201411}/creative_service/get_all_creatives.rb +8 -17
- data/examples/{v201311 → v201411}/creative_service/get_creatives_by_statement.rb +18 -13
- data/examples/{v201311 → v201411}/creative_service/update_creatives.rb +16 -11
- data/examples/{v201311 → v201411}/creative_set_service/associate_creative_set_to_line_item.rb +1 -1
- data/examples/{v201311 → v201411}/creative_set_service/create_creative_set.rb +1 -1
- data/examples/{v201311 → v201411}/creative_set_service/get_all_creative_sets.rb +9 -17
- data/examples/{v201311 → v201411}/creative_set_service/get_creative_sets_by_statement.rb +20 -14
- data/examples/{v201311 → v201411}/creative_set_service/update_creative_sets.rb +33 -15
- data/examples/{v201311 → v201411}/creative_template_service/get_all_creative_templates.rb +9 -17
- data/examples/{v201311/creative_template_service/get_creative_templates_by_statement.rb → v201411/creative_template_service/get_system_defined_creative_templates.rb} +24 -13
- data/examples/{v201311 → v201411}/creative_wrapper_service/create_creative_wrappers.rb +1 -1
- data/examples/{v201311 → v201411}/creative_wrapper_service/deactivate_creative_wrapper.rb +9 -7
- data/examples/{v201311 → v201411}/creative_wrapper_service/get_all_creative_wrappers.rb +10 -18
- data/examples/{v201311 → v201411}/creative_wrapper_service/get_creative_wrappers_by_statement.rb +17 -12
- data/examples/{v201311 → v201411}/creative_wrapper_service/update_creative_wrappers.rb +34 -16
- data/examples/{v201311 → v201411}/custom_field_service/create_custom_field_options.rb +1 -1
- data/examples/{v201311 → v201411}/custom_field_service/create_custom_fields.rb +1 -1
- data/examples/{v201311 → v201411}/custom_field_service/deactivate_all_line_item_custom_fields.rb +13 -23
- data/examples/{v201311 → v201411}/custom_field_service/get_all_custom_fields.rb +11 -19
- data/examples/{v201311 → v201411}/custom_field_service/get_all_line_item_custom_fields.rb +19 -14
- data/examples/{v201311 → v201411}/custom_field_service/set_line_item_custom_field_value.rb +59 -11
- data/examples/{v201311 → v201411}/custom_field_service/update_custom_fields.rb +33 -15
- data/examples/{v201311 → v201411}/custom_targeting_service/create_custom_targeting_keys_and_values.rb +1 -1
- data/examples/{v201311 → v201411}/custom_targeting_service/delete_custom_targeting_keys.rb +16 -20
- data/examples/{v201311 → v201411}/custom_targeting_service/delete_custom_targeting_values.rb +23 -21
- data/examples/{v201311 → v201411}/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +15 -36
- data/examples/{v201311 → v201411}/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +20 -16
- data/examples/{v201311 → v201411}/custom_targeting_service/get_custom_targeting_values_by_statement.rb +19 -15
- data/examples/{v201311 → v201411}/custom_targeting_service/update_custom_targeting_keys.rb +4 -3
- data/examples/{v201311 → v201411}/custom_targeting_service/update_custom_targeting_values.rb +34 -30
- data/examples/{v201311 → v201411}/forecast_service/get_forecast.rb +6 -3
- data/examples/{v201311 → v201411}/forecast_service/get_forecast_by_id.rb +1 -1
- data/examples/{v201311 → v201411}/inventory_service/create_ad_units.rb +1 -1
- data/examples/{v201311 → v201411}/inventory_service/create_mobile_ad_unit.rb +1 -1
- data/examples/{v201311 → v201411}/inventory_service/create_video_ad_unit.rb +1 -1
- data/examples/{v201311 → v201411}/inventory_service/deactivate_ad_units.rb +19 -23
- data/examples/{v201311 → v201411}/inventory_service/get_ad_unit_sizes.rb +7 -14
- data/examples/{v201311 → v201411}/inventory_service/get_ad_units_by_statement.rb +18 -13
- data/examples/{v201311 → v201411}/inventory_service/get_all_ad_units.rb +8 -17
- data/examples/{v201311 → v201411}/inventory_service/update_ad_units.rb +23 -11
- data/examples/{v201311 → v201411}/label_service/create_labels.rb +1 -1
- data/examples/{v201311 → v201411}/label_service/deactivate_labels.rb +15 -22
- data/examples/{v201311 → v201411}/label_service/get_all_labels.rb +9 -18
- data/examples/{v201311 → v201411}/label_service/get_labels_by_statement.rb +16 -11
- data/examples/{v201311 → v201411}/label_service/update_labels.rb +24 -26
- data/examples/{v201311 → v201411}/line_item_creative_association_service/create_licas.rb +1 -1
- data/examples/{v201311 → v201411}/line_item_creative_association_service/deactivate_licas.rb +15 -24
- data/examples/{v201311 → v201411}/line_item_creative_association_service/get_all_licas.rb +8 -17
- data/examples/{v201311 → v201411}/line_item_creative_association_service/get_licas_by_statement.rb +10 -8
- data/examples/{v201311 → v201411}/line_item_creative_association_service/update_licas.rb +16 -7
- data/examples/{v201311 → v201411}/line_item_service/activate_line_items.rb +13 -21
- data/examples/{v201311 → v201411}/line_item_service/create_line_items.rb +6 -3
- data/examples/{v201311 → v201411}/line_item_service/create_video_line_item.rb +8 -2
- data/examples/{v201311 → v201411}/line_item_service/get_all_line_items.rb +9 -17
- data/examples/{v201311 → v201411}/line_item_service/get_line_items_by_statement.rb +19 -17
- data/examples/{v201311 → v201411}/line_item_service/get_recently_updated_line_items.rb +19 -13
- data/examples/{v201311 → v201411}/line_item_service/target_custom_criteria.rb +31 -15
- data/examples/{v201311 → v201411}/line_item_service/update_line_items.rb +9 -9
- data/examples/{v201311 → v201411}/network_service/get_all_networks.rb +1 -1
- data/examples/{v201311 → v201411}/network_service/get_current_network.rb +1 -1
- data/examples/{v201311 → v201411}/network_service/make_test_network.rb +1 -1
- data/examples/{v201311 → v201411}/order_service/approve_orders.rb +16 -24
- data/examples/{v201311 → v201411}/order_service/create_orders.rb +1 -1
- data/examples/{v201311 → v201411}/order_service/get_all_orders.rb +8 -17
- data/examples/{v201311 → v201411}/order_service/get_orders_by_statement.rb +18 -14
- data/examples/{v201311 → v201411}/order_service/update_orders.rb +15 -7
- data/examples/{v201311 → v201411}/placement_service/create_placements.rb +4 -2
- data/examples/{v201311 → v201411}/placement_service/deactivate_placements.rb +14 -22
- data/examples/{v201311 → v201411}/placement_service/get_all_placements.rb +9 -17
- data/examples/{v201311 → v201411}/placement_service/get_placements_by_statement.rb +18 -13
- data/examples/{v201311 → v201411}/placement_service/update_placements.rb +16 -6
- data/examples/{v201311 → v201411}/publisher_query_language_service/fetch_match_tables.rb +9 -11
- data/examples/{v201311 → v201411}/publisher_query_language_service/get_all_line_items.rb +8 -9
- data/examples/{v201311 → v201411}/publisher_query_language_service/get_geo_targets.rb +10 -10
- data/examples/{v201311 → v201411}/publisher_query_language_service/get_line_items_named_like.rb +10 -10
- data/examples/{v201311 → v201411}/report_service/display_report.rb +1 -1
- data/examples/{v201311 → v201411}/report_service/download_report.rb +1 -1
- data/examples/{v201311 → v201411}/report_service/run_delivery_report.rb +1 -1
- data/examples/{v201311 → v201411}/report_service/run_inventory_report.rb +4 -4
- data/examples/{v201311 → v201411}/report_service/run_reach_report.rb +1 -1
- data/examples/{v201311/report_service/run_merged_delivery_report.rb → v201411/report_service/run_report_with_custom_fields.rb} +12 -14
- data/examples/{v201311 → v201411}/report_service/run_sales_report.rb +1 -1
- data/examples/{v201311 → v201411}/suggested_ad_unit_service/approve_all_suggested_ad_units.rb +25 -21
- data/examples/{v201311 → v201411}/suggested_ad_unit_service/get_all_suggested_ad_units.rb +9 -18
- data/examples/{v201311 → v201411}/suggested_ad_unit_service/get_suggested_ad_units_by_statement.rb +24 -21
- data/examples/{v201311 → v201411}/team_service/create_teams.rb +1 -1
- data/examples/{v201311 → v201411}/team_service/get_all_teams.rb +8 -17
- data/examples/{v201311 → v201411}/team_service/get_teams_by_statement.rb +15 -11
- data/examples/{v201311 → v201411}/team_service/update_teams.rb +4 -3
- data/examples/{v201311 → v201411}/user_service/create_users.rb +1 -1
- data/examples/{v201311 → v201411}/user_service/deactivate_users.rb +7 -7
- data/examples/{v201311 → v201411}/user_service/get_all_roles.rb +1 -1
- data/examples/{v201311 → v201411}/user_service/get_all_users.rb +8 -18
- data/examples/{v201311 → v201411}/user_service/get_current_user.rb +1 -1
- data/examples/{v201311 → v201411}/user_service/get_users_by_statement.rb +17 -12
- data/examples/{v201311 → v201411}/user_service/update_users.rb +15 -6
- data/examples/{v201311 → v201411}/user_team_association_service/create_user_team_associations.rb +1 -1
- data/examples/{v201311 → v201411}/user_team_association_service/delete_user_team_associations.rb +13 -21
- data/examples/{v201311 → v201411}/user_team_association_service/get_all_user_team_associations.rb +10 -17
- data/examples/{v201311 → v201411}/user_team_association_service/get_user_team_associations_by_statement.rb +20 -16
- data/examples/{v201311 → v201411}/user_team_association_service/update_user_team_associations.rb +8 -7
- data/lib/dfp_api/api_config.rb +26 -3
- data/lib/dfp_api/{v201302 → v201411}/activity_group_service.rb +6 -18
- data/lib/dfp_api/v201411/activity_group_service_registry.rb +46 -0
- data/lib/dfp_api/{v201302 → v201411}/activity_service.rb +6 -18
- data/lib/dfp_api/v201411/activity_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/ad_exclusion_rule_service.rb +46 -0
- data/lib/dfp_api/v201411/ad_exclusion_rule_service_registry.rb +46 -0
- data/lib/dfp_api/{v201302 → v201411}/ad_rule_service.rb +6 -18
- data/lib/dfp_api/v201411/ad_rule_service_registry.rb +46 -0
- data/lib/dfp_api/{v201208 → v201411}/audience_segment_service.rb +18 -6
- data/lib/dfp_api/v201411/audience_segment_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/base_rate_service.rb +46 -0
- data/lib/dfp_api/v201411/base_rate_service_registry.rb +46 -0
- data/lib/dfp_api/{v201208 → v201411}/company_service.rb +6 -18
- data/lib/dfp_api/v201411/company_service_registry.rb +46 -0
- data/lib/dfp_api/{v201302 → v201411}/contact_service.rb +6 -18
- data/lib/dfp_api/v201411/contact_service_registry.rb +46 -0
- data/lib/dfp_api/{v201302 → v201411}/content_bundle_service.rb +6 -18
- data/lib/dfp_api/v201411/content_bundle_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/content_metadata_key_hierarchy_service.rb +46 -0
- data/lib/dfp_api/v201411/content_metadata_key_hierarchy_service_registry.rb +46 -0
- data/lib/dfp_api/{v201302 → v201411}/content_service.rb +6 -6
- data/lib/dfp_api/v201411/content_service_registry.rb +46 -0
- data/lib/dfp_api/{v201208 → v201411}/creative_service.rb +6 -18
- data/lib/dfp_api/v201411/creative_service_registry.rb +46 -0
- data/lib/dfp_api/{v201208 → v201411}/creative_set_service.rb +6 -10
- data/lib/dfp_api/v201411/creative_set_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/creative_template_service.rb +6 -10
- data/lib/dfp_api/v201411/creative_template_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/creative_wrapper_service.rb +6 -18
- data/lib/dfp_api/v201411/creative_wrapper_service_registry.rb +46 -0
- data/lib/dfp_api/{v201302 → v201411}/custom_field_service.rb +6 -26
- data/lib/dfp_api/v201411/custom_field_service_registry.rb +46 -0
- data/lib/dfp_api/{v201208 → v201411}/custom_targeting_service.rb +6 -6
- data/lib/dfp_api/v201411/custom_targeting_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/exchange_rate_service.rb +46 -0
- data/lib/dfp_api/v201411/exchange_rate_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/forecast_service.rb +6 -6
- data/lib/dfp_api/v201411/forecast_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/inventory_service.rb +6 -18
- data/lib/dfp_api/v201411/inventory_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/label_service.rb +6 -18
- data/lib/dfp_api/v201411/label_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/line_item_creative_association_service.rb +6 -18
- data/lib/dfp_api/v201411/line_item_creative_association_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/line_item_service.rb +6 -18
- data/lib/dfp_api/v201411/line_item_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/line_item_template_service.rb +34 -0
- data/lib/dfp_api/v201411/line_item_template_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/live_stream_event_service.rb +46 -0
- data/lib/dfp_api/v201411/live_stream_event_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/network_service.rb +6 -6
- data/lib/dfp_api/v201411/network_service_registry.rb +46 -0
- data/lib/dfp_api/{v201302 → v201411}/order_service.rb +6 -18
- data/lib/dfp_api/v201411/order_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/placement_service.rb +6 -18
- data/lib/dfp_api/v201411/placement_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/premium_rate_service.rb +42 -0
- data/lib/dfp_api/v201411/premium_rate_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/product_service.rb +42 -0
- data/lib/dfp_api/v201411/product_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/product_template_service.rb +46 -0
- data/lib/dfp_api/v201411/product_template_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/proposal_line_item_service.rb +46 -0
- data/lib/dfp_api/v201411/proposal_line_item_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/proposal_service.rb +46 -0
- data/lib/dfp_api/v201411/proposal_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/publisher_query_language_service.rb +6 -6
- data/lib/dfp_api/v201411/publisher_query_language_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/rate_card_service.rb +46 -0
- data/lib/dfp_api/v201411/rate_card_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/reconciliation_order_report_service.rb +38 -0
- data/lib/dfp_api/v201411/reconciliation_order_report_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/reconciliation_report_row_service.rb +38 -0
- data/lib/dfp_api/v201411/reconciliation_report_row_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/reconciliation_report_service.rb +38 -0
- data/lib/dfp_api/v201411/reconciliation_report_service_registry.rb +46 -0
- data/lib/dfp_api/{v201302 → v201411}/report_service.rb +6 -6
- data/lib/dfp_api/v201411/report_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/shared_ad_unit_service.rb +38 -0
- data/lib/dfp_api/v201411/shared_ad_unit_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/suggested_ad_unit_service.rb +6 -10
- data/lib/dfp_api/v201411/suggested_ad_unit_service_registry.rb +46 -0
- data/lib/dfp_api/{v201302 → v201411}/team_service.rb +6 -18
- data/lib/dfp_api/v201411/team_service_registry.rb +46 -0
- data/lib/dfp_api/{v201208 → v201411}/user_service.rb +6 -18
- data/lib/dfp_api/v201411/user_service_registry.rb +46 -0
- data/lib/dfp_api/{v201211 → v201411}/user_team_association_service.rb +6 -18
- data/lib/dfp_api/v201411/user_team_association_service_registry.rb +46 -0
- data/lib/dfp_api/v201411/workflow_request_service.rb +38 -0
- data/lib/dfp_api/v201411/workflow_request_service_registry.rb +46 -0
- data/lib/dfp_api/version.rb +1 -1
- data/lib/dfp_api_statement.rb +5 -1
- metadata +1118 -1190
- data/examples/v201311/company_service/get_company.rb +0 -72
- data/examples/v201311/creative_service/get_creative.rb +0 -72
- data/examples/v201311/creative_template_service/get_creative_template.rb +0 -74
- data/examples/v201311/inventory_service/get_ad_unit.rb +0 -72
- data/examples/v201311/label_service/get_label.rb +0 -76
- data/examples/v201311/line_item_creative_association_service/get_lica.rb +0 -77
- data/examples/v201311/line_item_service/create_mobile_line_item.rb +0 -135
- data/examples/v201311/line_item_service/get_line_item.rb +0 -74
- data/examples/v201311/order_service/get_order.rb +0 -74
- data/examples/v201311/placement_service/get_placement.rb +0 -74
- data/examples/v201311/report_service/run_report_with_custom_fields.rb +0 -135
- data/examples/v201311/suggested_ad_unit_service/get_suggested_ad_unit.rb +0 -75
- data/examples/v201311/team_service/get_team.rb +0 -74
- data/examples/v201311/user_service/get_user.rb +0 -73
- data/examples/v201311/user_team_association_service/get_user_team_association.rb +0 -76
- data/lib/dfp_api/v201208/audience_segment_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/company_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/content_service.rb +0 -42
- data/lib/dfp_api/v201208/content_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/creative_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/creative_set_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/creative_template_service.rb +0 -38
- data/lib/dfp_api/v201208/creative_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/custom_field_service.rb +0 -78
- data/lib/dfp_api/v201208/custom_field_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/custom_targeting_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/forecast_service.rb +0 -38
- data/lib/dfp_api/v201208/forecast_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/inventory_service.rb +0 -62
- data/lib/dfp_api/v201208/inventory_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/label_service.rb +0 -58
- data/lib/dfp_api/v201208/label_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/line_item_creative_association_service.rb +0 -62
- data/lib/dfp_api/v201208/line_item_creative_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/line_item_service.rb +0 -58
- data/lib/dfp_api/v201208/line_item_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/network_service.rb +0 -46
- data/lib/dfp_api/v201208/network_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/order_service.rb +0 -58
- data/lib/dfp_api/v201208/order_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/placement_service.rb +0 -58
- data/lib/dfp_api/v201208/placement_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/publisher_query_language_service.rb +0 -34
- data/lib/dfp_api/v201208/publisher_query_language_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/report_service.rb +0 -46
- data/lib/dfp_api/v201208/report_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/suggested_ad_unit_service.rb +0 -42
- data/lib/dfp_api/v201208/suggested_ad_unit_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/team_service.rb +0 -54
- data/lib/dfp_api/v201208/team_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/third_party_slot_service.rb +0 -46
- data/lib/dfp_api/v201208/third_party_slot_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/user_service_registry.rb +0 -46
- data/lib/dfp_api/v201208/user_team_association_service.rb +0 -58
- data/lib/dfp_api/v201208/user_team_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/audience_segment_service.rb +0 -34
- data/lib/dfp_api/v201211/audience_segment_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/company_service.rb +0 -54
- data/lib/dfp_api/v201211/company_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/content_service.rb +0 -42
- data/lib/dfp_api/v201211/content_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/creative_service.rb +0 -54
- data/lib/dfp_api/v201211/creative_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/creative_set_service.rb +0 -46
- data/lib/dfp_api/v201211/creative_set_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/creative_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/creative_wrapper_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/custom_field_service.rb +0 -78
- data/lib/dfp_api/v201211/custom_field_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/custom_targeting_service.rb +0 -62
- data/lib/dfp_api/v201211/custom_targeting_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/forecast_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/inventory_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/label_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/line_item_creative_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/line_item_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/network_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/order_service.rb +0 -58
- data/lib/dfp_api/v201211/order_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/placement_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/publisher_query_language_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/report_service.rb +0 -46
- data/lib/dfp_api/v201211/report_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/suggested_ad_unit_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/team_service.rb +0 -54
- data/lib/dfp_api/v201211/team_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/third_party_slot_service.rb +0 -46
- data/lib/dfp_api/v201211/third_party_slot_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/user_service.rb +0 -66
- data/lib/dfp_api/v201211/user_service_registry.rb +0 -46
- data/lib/dfp_api/v201211/user_team_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/activity_group_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/activity_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/ad_rule_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/audience_segment_service.rb +0 -34
- data/lib/dfp_api/v201302/audience_segment_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/company_service.rb +0 -54
- data/lib/dfp_api/v201302/company_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/contact_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/content_bundle_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/content_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/creative_service.rb +0 -54
- data/lib/dfp_api/v201302/creative_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/creative_set_service.rb +0 -46
- data/lib/dfp_api/v201302/creative_set_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/creative_template_service.rb +0 -38
- data/lib/dfp_api/v201302/creative_template_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/creative_wrapper_service.rb +0 -58
- data/lib/dfp_api/v201302/creative_wrapper_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/custom_field_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/custom_targeting_service.rb +0 -62
- data/lib/dfp_api/v201302/custom_targeting_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/forecast_service.rb +0 -38
- data/lib/dfp_api/v201302/forecast_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/inventory_service.rb +0 -62
- data/lib/dfp_api/v201302/inventory_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/label_service.rb +0 -58
- data/lib/dfp_api/v201302/label_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/line_item_creative_association_service.rb +0 -62
- data/lib/dfp_api/v201302/line_item_creative_association_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/line_item_service.rb +0 -58
- data/lib/dfp_api/v201302/line_item_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/network_service.rb +0 -46
- data/lib/dfp_api/v201302/network_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/order_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/placement_service.rb +0 -58
- data/lib/dfp_api/v201302/placement_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/publisher_query_language_service.rb +0 -34
- data/lib/dfp_api/v201302/publisher_query_language_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/report_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/suggested_ad_unit_service.rb +0 -42
- data/lib/dfp_api/v201302/suggested_ad_unit_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/team_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/third_party_slot_service.rb +0 -46
- data/lib/dfp_api/v201302/third_party_slot_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/user_service.rb +0 -66
- data/lib/dfp_api/v201302/user_service_registry.rb +0 -46
- data/lib/dfp_api/v201302/user_team_association_service.rb +0 -58
- data/lib/dfp_api/v201302/user_team_association_service_registry.rb +0 -46
@@ -25,8 +25,9 @@
|
|
25
25
|
# Tags: CreativeWrapperService.updateCreativeWrappers
|
26
26
|
|
27
27
|
require 'dfp_api'
|
28
|
+
require 'dfp_api_statement'
|
28
29
|
|
29
|
-
API_VERSION = :
|
30
|
+
API_VERSION = :v201411
|
30
31
|
|
31
32
|
def update_creative_wrappers()
|
32
33
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -42,25 +43,42 @@ def update_creative_wrappers()
|
|
42
43
|
# Set the ID of the creative wrapper to get.
|
43
44
|
creative_wrapper_id = 'INSERT_CREATIVE_WRAPPER_ID_HERE'.to_i
|
44
45
|
|
45
|
-
#
|
46
|
-
|
47
|
-
|
46
|
+
# Create a statement to only select a single creative wrapper.
|
47
|
+
statement = DfpApiStatement::FilterStatement.new(
|
48
|
+
'WHERE id = :id',
|
49
|
+
[
|
50
|
+
{:key => 'id',
|
51
|
+
:value => {:value => creative_wrapper_id, :xsi_type => 'NumberValue'}
|
52
|
+
}
|
53
|
+
],
|
54
|
+
1
|
55
|
+
)
|
48
56
|
|
49
|
-
#
|
50
|
-
|
57
|
+
# Get creative wrappers by statement.
|
58
|
+
page = creative_wrapper_service.get_creative_wrappers_by_statement(
|
59
|
+
statement.toStatement())
|
51
60
|
|
52
|
-
|
53
|
-
|
54
|
-
creative_wrapper_service.update_creative_wrappers([creative_wrapper])
|
61
|
+
if page[:results]
|
62
|
+
creative_wrappers = page[:results]
|
55
63
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
64
|
+
creative_wrappers.each do |creative_wrapper|
|
65
|
+
# Update local creative wrapper object by changing its ordering.
|
66
|
+
creative_wrapper[:ordering] = 'OUTER'
|
67
|
+
end
|
68
|
+
|
69
|
+
# Update the creative wrapper on the server.
|
70
|
+
return_creative_wrappers =
|
71
|
+
creative_wrapper_service.update_creative_wrappers([creative_wrapper])
|
72
|
+
|
73
|
+
if return_creative_wrappers
|
74
|
+
return_creative_wrappers.each do |creative_wrapper|
|
75
|
+
puts ("Creative wrapper ID: %d, label ID: %d was updated with order" +
|
76
|
+
" '%s'") % [creative_wrapper[:id], creative_wrapper[:label_id],
|
77
|
+
creative_wrapper[:ordering]]
|
78
|
+
end
|
79
|
+
else
|
80
|
+
puts 'No creative wrappers found to update.'
|
61
81
|
end
|
62
|
-
else
|
63
|
-
puts 'No creative wrappers found to update.'
|
64
82
|
end
|
65
83
|
end
|
66
84
|
|
data/examples/{v201311 → v201411}/custom_field_service/deactivate_all_line_item_custom_fields.rb
RENAMED
@@ -25,9 +25,9 @@
|
|
25
25
|
# Tags: CustomFieldService.performCustomFieldAction
|
26
26
|
|
27
27
|
require 'dfp_api'
|
28
|
+
require 'dfp_api_statement'
|
28
29
|
|
29
|
-
API_VERSION = :
|
30
|
-
PAGE_SIZE = 500
|
30
|
+
API_VERSION = :v201411
|
31
31
|
|
32
32
|
def deactivate_all_line_item_custom_fields()
|
33
33
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -41,46 +41,36 @@ def deactivate_all_line_item_custom_fields()
|
|
41
41
|
custom_field_service = dfp.service(:CustomFieldService, API_VERSION)
|
42
42
|
|
43
43
|
# Create statement text to select active ad units.
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
statement = DfpApiStatement::FilterStatement.new(
|
45
|
+
'WHERE entityType = :entity_type AND isActive = :is_active',
|
46
|
+
[
|
47
47
|
{:key => 'entity_type',
|
48
48
|
:value => {:value => 'LINE_ITEM', :xsi_type => 'TextValue'}},
|
49
49
|
{:key => 'is_active',
|
50
50
|
:value => {:value => true, :xsi_type => 'BooleanValue'}}
|
51
51
|
]
|
52
|
-
|
53
|
-
|
54
|
-
# Define initial values.
|
55
|
-
offset = 0
|
56
|
-
page = {}
|
52
|
+
)
|
57
53
|
|
58
54
|
begin
|
59
|
-
# Create a statement to get one page with the current offset.
|
60
|
-
statement[:query] = statement_text +
|
61
|
-
" LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]
|
62
|
-
|
63
55
|
# Get custom fields by statement.
|
64
|
-
page = custom_field_service.get_custom_fields_by_statement(
|
56
|
+
page = custom_field_service.get_custom_fields_by_statement(
|
57
|
+
statement.toStatement())
|
65
58
|
|
66
59
|
if page[:results]
|
67
|
-
# Increase query offset by page size.
|
68
|
-
offset += PAGE_SIZE
|
69
|
-
start_index = page[:start_index]
|
70
|
-
|
71
60
|
page[:results].each_with_index do |custom_field, index|
|
72
61
|
puts "%d) Custom field with ID: %d and name: '%s' will be deactivated" %
|
73
|
-
[index +
|
62
|
+
[index + statement.offset, custom_field[:id], custom_field[:name]]
|
74
63
|
end
|
75
64
|
end
|
76
|
-
|
65
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
66
|
+
end while statement.offset < page[:total_result_set_size]
|
77
67
|
|
78
68
|
# Update statement for action.
|
79
|
-
statement
|
69
|
+
statement.toStatementForAction()
|
80
70
|
|
81
71
|
# Perform action.
|
82
72
|
result = custom_field_service.perform_custom_field_action(
|
83
|
-
{:xsi_type => 'DeactivateCustomFields'}, statement)
|
73
|
+
{:xsi_type => 'DeactivateCustomFields'}, statement.toStatement())
|
84
74
|
|
85
75
|
# Display results.
|
86
76
|
if result and result[:num_changes] > 0
|
@@ -24,9 +24,9 @@
|
|
24
24
|
# Tags: CustomFieldService.getCustomFieldsByStatement
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
|
+
require 'dfp_api_statement'
|
27
28
|
|
28
|
-
API_VERSION = :
|
29
|
-
PAGE_SIZE = 500
|
29
|
+
API_VERSION = :v201411
|
30
30
|
|
31
31
|
def get_all_custom_fields()
|
32
32
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -39,40 +39,32 @@ def get_all_custom_fields()
|
|
39
39
|
# Get the CustomFieldService.
|
40
40
|
custom_field_service = dfp.service(:CustomFieldService, API_VERSION)
|
41
41
|
|
42
|
-
#
|
43
|
-
|
44
|
-
page = {}
|
42
|
+
# Create a statement to get one page with current offset.
|
43
|
+
statement = DfpApiStatement::FilterStatement.new('ORDER BY id')
|
45
44
|
|
46
45
|
begin
|
47
|
-
# Create a statement to get one page with current offset.
|
48
|
-
statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]}
|
49
|
-
|
50
46
|
# Get custom fields by statement.
|
51
|
-
page = custom_field_service.get_custom_fields_by_statement(
|
47
|
+
page = custom_field_service.get_custom_fields_by_statement(
|
48
|
+
statement.toStatement())
|
52
49
|
|
53
50
|
if page[:results]
|
54
|
-
# Increase query offset by page size.
|
55
|
-
offset += PAGE_SIZE
|
56
|
-
|
57
|
-
# Get the start index for printout.
|
58
|
-
start_index = page[:start_index]
|
59
|
-
|
60
51
|
# Print details about each custom field in results.
|
61
52
|
page[:results].each_with_index do |custom_field, index|
|
62
53
|
if custom_field[:custom_field_type].eql?('DropDownCustomField')
|
63
54
|
drop_down_custom_field_strings = custom_field.include?(:options) ?
|
64
55
|
custom_field[:options].map {|option| option[:display_name]} : []
|
65
|
-
|
56
|
+
puts ("%d) Drop-down custom field with ID %d, name '%s', and " +
|
66
57
|
"options [%s] was found.") %
|
67
|
-
[index +
|
58
|
+
[index + statement.offset, custom_field[:id], custom_field[:name],
|
68
59
|
drop_down_custom_field_strings.join(', ')]
|
69
60
|
else
|
70
61
|
puts "%d) Custom field ID: %d and name: '%s' was found" %
|
71
|
-
[index +
|
62
|
+
[index + statement.offset, custom_field[:id], custom_field[:name]]
|
72
63
|
end
|
73
64
|
end
|
74
65
|
end
|
75
|
-
|
66
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
67
|
+
end while statement.offset < page[:total_result_set_size]
|
76
68
|
|
77
69
|
# Print a footer.
|
78
70
|
if page.include?(:total_result_set_size)
|
@@ -24,8 +24,9 @@
|
|
24
24
|
# Tags: CustomFieldService.getCustomFieldsByStatement
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
|
+
require 'dfp_api_statement'
|
27
28
|
|
28
|
-
API_VERSION = :
|
29
|
+
API_VERSION = :v201411
|
29
30
|
|
30
31
|
def get_all_line_item_custom_fields()
|
31
32
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -39,24 +40,28 @@ def get_all_line_item_custom_fields()
|
|
39
40
|
custom_field_service = dfp.service(:CustomFieldService, API_VERSION)
|
40
41
|
|
41
42
|
# Create statement to select only custom fields that apply to line items.
|
42
|
-
statement =
|
43
|
-
|
44
|
-
|
43
|
+
statement = DfpApiStatement::FilterStatement.new(
|
44
|
+
'WHERE entityType = :entity_type ORDER BY id ASC',
|
45
|
+
[
|
45
46
|
{:key => 'entity_type',
|
46
47
|
:value => {:value => 'LINE_ITEM', :xsi_type => 'TextValue'}}
|
47
48
|
]
|
48
|
-
|
49
|
+
)
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
page[:results]
|
56
|
-
|
57
|
-
|
51
|
+
begin
|
52
|
+
# Get custom fields by statement.
|
53
|
+
page = custom_field_service.get_custom_fields_by_statement(
|
54
|
+
statement.toStatement())
|
55
|
+
|
56
|
+
if page[:results]
|
57
|
+
# Print details about each custom field in results.
|
58
|
+
page[:results].each_with_index do |custom_field, index|
|
59
|
+
puts "%d) Custom field with ID %d and name: '%s' was found." %
|
60
|
+
[index + statement.offset, custom_field[:id], custom_field[:name]]
|
61
|
+
end
|
58
62
|
end
|
59
|
-
|
63
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
64
|
+
end while statement.offset < page[:total_result_set_size]
|
60
65
|
|
61
66
|
# Print a footer.
|
62
67
|
if page.include?(:total_result_set_size)
|
@@ -23,11 +23,13 @@
|
|
23
23
|
# items exist, run get_all_line_items.rb. To create custom field options, run
|
24
24
|
# create_custom_field_options.rb.
|
25
25
|
#
|
26
|
-
# Tags: CustomFieldService.
|
26
|
+
# Tags: CustomFieldService.getCustomFieldsByStatement,
|
27
|
+
# LineItemService.getLineItemsByStatement
|
27
28
|
|
28
29
|
require 'dfp_api'
|
30
|
+
require 'dfp_api_statement'
|
29
31
|
|
30
|
-
API_VERSION = :
|
32
|
+
API_VERSION = :v201411
|
31
33
|
|
32
34
|
def set_line_item_custom_field_value()
|
33
35
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -49,15 +51,61 @@ def set_line_item_custom_field_value()
|
|
49
51
|
custom_field_option_id = 'INSERT_CUSTOM_FIELD_OPTION_ID_HERE'.to_i
|
50
52
|
line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i
|
51
53
|
|
52
|
-
#
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
54
|
+
# Create a statement to only select a single custom field.
|
55
|
+
custom_field_statement = DfpApiStatement::FilterStatement.new(
|
56
|
+
'WHERE id = :id ORDER BY id ASC',
|
57
|
+
[
|
58
|
+
{:key => 'id',
|
59
|
+
:value => {:value => custom_field_id, :xsi_type => 'NumberValue'}}
|
60
|
+
],
|
61
|
+
1
|
62
|
+
)
|
63
|
+
|
64
|
+
# Create a statement to only select a single drop down custom field.
|
65
|
+
drop_down_custom_field_statement = DfpApiStatement::FilterStatement.new(
|
66
|
+
'WHERE id = :id ORDER BY id ASC',
|
67
|
+
[
|
68
|
+
{:key => 'id',
|
69
|
+
:value => {:value => drop_down_custom_field_id,
|
70
|
+
:xsi_type => 'NumberValue'}}
|
71
|
+
],
|
72
|
+
1
|
73
|
+
)
|
74
|
+
|
75
|
+
# Create a statement to only select a single line item.
|
76
|
+
line_item_statement = DfpApiStatement::FilterStatement.new(
|
77
|
+
'WHERE id = :id ORDER BY id ASC',
|
78
|
+
[
|
79
|
+
{:key => 'id',
|
80
|
+
:value => {:value => line_item_id, :xsi_type => 'NumberValue'}}
|
81
|
+
],
|
82
|
+
1
|
83
|
+
)
|
84
|
+
|
85
|
+
# Get custom fields by statement.
|
86
|
+
custom_fields_page = custom_field_service.get_custom_fields_by_statement(
|
87
|
+
custom_field_statement.toStatement())
|
88
|
+
|
89
|
+
# Get drop down custom fields by statement.
|
90
|
+
drop_down_custom_fields_page = (
|
91
|
+
custom_field_service.get_custom_fields_by_statement(
|
92
|
+
drop_down_custom_field_statement.toStatement()))
|
93
|
+
|
94
|
+
# Get line items by statement.
|
95
|
+
line_items_page = line_item_service.get_line_items_by_statement(
|
96
|
+
line_item_statement.toStatement())
|
97
|
+
|
98
|
+
# Get singular custom field.
|
99
|
+
if custom_field_page[:results]
|
100
|
+
custom_field = custom_fields_page[:results].first
|
101
|
+
|
102
|
+
# Get singular drop down custom field.
|
103
|
+
if drop_down_custom_field_page[:results]
|
104
|
+
drop_down_custom_field = drop_down_custom_fields_page[:results].first
|
105
|
+
|
106
|
+
# Get singular line item.
|
107
|
+
if line_item_page[:results]
|
108
|
+
line_item = line_items_page[:results].first
|
61
109
|
|
62
110
|
if custom_field and drop_down_custom_field and line_item
|
63
111
|
# Create custom field values.
|
@@ -24,8 +24,9 @@
|
|
24
24
|
# Tags: CustomFieldService.updateCustomFields
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
|
+
require 'dfp_api_statement'
|
27
28
|
|
28
|
-
API_VERSION = :
|
29
|
+
API_VERSION = :v201411
|
29
30
|
|
30
31
|
def update_custom_fields()
|
31
32
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -41,24 +42,41 @@ def update_custom_fields()
|
|
41
42
|
# Set the ID of the custom field to update.
|
42
43
|
custom_field_id = 'INSERT_CUSTOM_FIELD_ID_HERE'.to_i
|
43
44
|
|
44
|
-
#
|
45
|
-
|
45
|
+
# Create a statement to only select a single custom field.
|
46
|
+
statement = DfpApiStatement::FilterStatement.new(
|
47
|
+
'WHERE id = :id',
|
48
|
+
[
|
49
|
+
{:key => 'id',
|
50
|
+
:value => {:value => custom_field_id, :xsi_type => 'NumberValue'}}
|
51
|
+
],
|
52
|
+
1
|
53
|
+
)
|
46
54
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
custom_field[:description] +=' Updated.'
|
55
|
+
# Get custom fields by statement.
|
56
|
+
page = custom_field_service.get_custom_fields_by_statement(
|
57
|
+
statement.toStatement())
|
51
58
|
|
52
|
-
|
53
|
-
|
54
|
-
custom_field_service.update_custom_fields([custom_field])
|
59
|
+
if page[:results]
|
60
|
+
custom_fields = page[:results]
|
55
61
|
|
56
|
-
|
57
|
-
|
58
|
-
|
62
|
+
custom_fields.each do |custom_field|
|
63
|
+
# Update local custom field object.
|
64
|
+
custom_field[:description] = '' if custom_field[:description].nil?
|
65
|
+
custom_field[:description] +=' Updated.'
|
66
|
+
|
67
|
+
# Update the custom field on the server.
|
68
|
+
return_custom_fields =
|
69
|
+
custom_field_service.update_custom_fields([custom_field])
|
70
|
+
|
71
|
+
return_custom_fields.each do |custom_field|
|
72
|
+
puts "Custom field ID: " +
|
73
|
+
"%d, name: '%s' and description '%s' was updated." % [
|
74
|
+
custom_field[:id], custom_field[:name],
|
75
|
+
custom_field[:description]]
|
76
|
+
end
|
77
|
+
else
|
78
|
+
puts 'No custom fields were found to update.'
|
59
79
|
end
|
60
|
-
else
|
61
|
-
puts 'No custom fields were found to update.'
|
62
80
|
end
|
63
81
|
end
|
64
82
|
|
@@ -25,9 +25,9 @@
|
|
25
25
|
# Tags: CustomTargetingService.performCustomTargetingKeyAction
|
26
26
|
|
27
27
|
require 'dfp_api'
|
28
|
+
require 'dfp_api_statement'
|
28
29
|
|
29
|
-
API_VERSION = :
|
30
|
-
PAGE_SIZE = 500
|
30
|
+
API_VERSION = :v201411
|
31
31
|
|
32
32
|
def delete_custom_targeting_keys()
|
33
33
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -43,39 +43,33 @@ def delete_custom_targeting_keys()
|
|
43
43
|
# Set the name of the custom targeting key to delete.
|
44
44
|
custom_targeting_key_name = 'INSERT_CUSTOM_TARGETING_KEY_NAME_HERE'
|
45
45
|
|
46
|
-
# Create statement to only select custom targeting key by the given name.
|
47
|
-
statement_text = 'WHERE name = :name'
|
48
46
|
|
49
47
|
# Define initial values.
|
50
|
-
offset = 0
|
51
|
-
page = {}
|
52
48
|
custom_target_key_ids = []
|
53
|
-
|
54
|
-
|
49
|
+
|
50
|
+
# Create statement to only select custom targeting key by the given name.
|
51
|
+
statement = DfpApiStatement::FilterStatement.new(
|
52
|
+
'WHERE name = :name',
|
53
|
+
[
|
55
54
|
{:key => 'name',
|
56
55
|
:value => {:value => custom_targeting_key_name,
|
57
56
|
:xsi_type => 'TextValue'}
|
58
57
|
}
|
59
58
|
]
|
60
|
-
|
59
|
+
)
|
61
60
|
|
62
61
|
begin
|
63
|
-
# Create a statement to page through custom targeting keys.
|
64
|
-
statement[:query] = statement_text + " LIMIT %d OFFSET %d" %
|
65
|
-
[PAGE_SIZE, offset]
|
66
|
-
|
67
62
|
page = custom_targeting_service.get_custom_targeting_keys_by_statement(
|
68
|
-
statement)
|
63
|
+
statement.toStatement())
|
69
64
|
|
70
65
|
if page[:results]
|
71
|
-
# Increase query offset by page size.
|
72
|
-
offset += PAGE_SIZE
|
73
66
|
page[:results].each do |key|
|
74
67
|
# Add key ID to the list for deletion.
|
75
68
|
custom_target_key_ids << key[:id]
|
76
69
|
end
|
77
70
|
end
|
78
|
-
|
71
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
72
|
+
end while statement.offset < page[:total_result_set_size]
|
79
73
|
|
80
74
|
# Print a footer.
|
81
75
|
puts "Number of custom targeting keys to be deleted: %d" %
|
@@ -83,12 +77,14 @@ def delete_custom_targeting_keys()
|
|
83
77
|
|
84
78
|
if !(custom_target_key_ids.empty?)
|
85
79
|
# Modify statement for action.
|
86
|
-
statement =
|
87
|
-
|
80
|
+
statement = DfpApiStatement::FilterStatement.new(
|
81
|
+
"WHERE id IN (%s)" %
|
82
|
+
[custom_target_key_ids.join(', ')]
|
83
|
+
)
|
88
84
|
|
89
85
|
# Perform action.
|
90
86
|
result = custom_targeting_service.perform_custom_targeting_key_action(
|
91
|
-
{:xsi_type => 'DeleteCustomTargetingKeys'}, statement)
|
87
|
+
{:xsi_type => 'DeleteCustomTargetingKeys'}, statement.toStatement())
|
92
88
|
|
93
89
|
# Display results.
|
94
90
|
if result and result[:num_changes] > 0
|