google-dfp-api 0.2.8 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/README +4 -6
- data/dfp_api.yml +5 -1
- data/examples/{v201104/order_service/get_all_orders.rb → v201203/audience_segment_service/get_all_audience_segments.rb} +18 -17
- data/examples/{v201103 → v201203}/common/error_handling.rb +1 -1
- data/examples/{v201107 → v201203}/common/oauth_handling.rb +1 -1
- data/examples/{v201107 → v201203}/company_service/create_companies.rb +1 -1
- data/examples/{v201107 → v201203}/company_service/get_all_companies.rb +1 -1
- data/examples/{v201104 → v201203}/company_service/get_companies_by_statement.rb +1 -1
- data/examples/{v201104 → v201203}/company_service/get_company.rb +1 -1
- data/examples/{v201107 → v201203}/company_service/update_companies.rb +1 -1
- data/examples/{v201103/user_service/get_all_users.rb → v201203/content_service/get_all_content.rb} +16 -15
- data/examples/v201203/content_service/get_content_by_category.rb +135 -0
- data/examples/{v201107 → v201203}/creative_service/copy_image_creatives.rb +1 -1
- data/examples/v201203/creative_service/create_creative_from_template.rb +138 -0
- data/examples/{v201107 → v201203}/creative_service/create_creatives.rb +1 -1
- data/examples/{v201103/creative_service/create_creatives.rb → v201203/creative_service/create_custom_creative.rb} +28 -30
- data/examples/{v201103 → v201203}/creative_service/get_all_creatives.rb +1 -1
- data/examples/{v201104 → v201203}/creative_service/get_creative.rb +1 -1
- data/examples/{v201107 → v201203}/creative_service/get_creatives_by_statement.rb +1 -1
- data/examples/{v201103 → v201203}/creative_service/update_creatives.rb +1 -1
- data/examples/{v201103/inventory_service/get_all_ad_units.rb → v201203/creative_template_service/get_all_creative_templates.rb} +16 -15
- data/examples/{v201103/creative_service/get_creative.rb → v201203/creative_template_service/get_creative_template.rb} +17 -15
- data/examples/{v201107/user_service/get_users_by_statement.rb → v201203/creative_template_service/get_creative_templates_by_statement.rb} +18 -17
- data/examples/{v201107 → v201203}/custom_targeting_service/create_custom_targeting_keys_and_values.rb +28 -6
- data/examples/{v201103 → v201203}/custom_targeting_service/delete_custom_targeting_keys.rb +1 -1
- data/examples/{v201107 → v201203}/custom_targeting_service/delete_custom_targeting_values.rb +1 -1
- data/examples/{v201103 → v201203}/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +1 -1
- data/examples/{v201104 → v201203}/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +1 -1
- data/examples/{v201104 → v201203}/custom_targeting_service/get_custom_targeting_values_by_statement.rb +1 -1
- data/examples/{v201107 → v201203}/custom_targeting_service/update_custom_targeting_keys.rb +1 -1
- data/examples/{v201103 → v201203}/custom_targeting_service/update_custom_targeting_values.rb +1 -1
- data/examples/{v201104 → v201203}/forecast_service/get_forecast.rb +8 -4
- data/examples/{v201107 → v201203}/forecast_service/get_forecast_by_id.rb +1 -1
- data/examples/{v201107 → v201203}/inventory_service/create_ad_units.rb +9 -3
- data/examples/{v201103/inventory_service/create_ad_units.rb → v201203/inventory_service/create_mobile_ad_unit.rb} +27 -22
- data/examples/{v201104/inventory_service/create_ad_units.rb → v201203/inventory_service/create_video_ad_unit.rb} +35 -22
- data/examples/{v201103 → v201203}/inventory_service/deactivate_ad_units.rb +1 -1
- data/examples/{v201103 → v201203}/inventory_service/get_ad_unit.rb +1 -1
- data/examples/{v201107 → v201203}/inventory_service/get_ad_unit_sizes.rb +20 -7
- data/examples/{v201104 → v201203}/inventory_service/get_ad_units_by_statement.rb +1 -1
- data/examples/{v201104 → v201203}/inventory_service/get_all_ad_units.rb +1 -1
- data/examples/{v201104 → v201203}/inventory_service/update_ad_units.rb +1 -1
- data/examples/{v201107 → v201203}/label_service/create_labels.rb +6 -5
- data/examples/{v201107 → v201203}/label_service/deactivate_labels.rb +1 -1
- data/examples/{v201107 → v201203}/label_service/get_all_labels.rb +6 -4
- data/examples/{v201107 → v201203}/label_service/get_label.rb +5 -4
- data/examples/{v201107 → v201203}/label_service/get_labels_by_statement.rb +9 -18
- data/examples/{v201107 → v201203}/label_service/update_labels.rb +12 -13
- data/examples/{v201107 → v201203}/line_item_creative_association_service/create_licas.rb +1 -1
- data/examples/{v201104 → v201203}/line_item_creative_association_service/deactivate_licas.rb +1 -1
- data/examples/{v201104 → v201203}/line_item_creative_association_service/get_all_licas.rb +1 -1
- data/examples/{v201104 → v201203}/line_item_creative_association_service/get_lica.rb +1 -1
- data/examples/{v201107 → v201203}/line_item_creative_association_service/get_licas_by_statement.rb +1 -1
- data/examples/{v201107 → v201203}/line_item_creative_association_service/update_licas.rb +1 -1
- data/examples/{v201103 → v201203}/line_item_service/activate_line_items.rb +1 -1
- data/examples/{v201107 → v201203}/line_item_service/create_line_items.rb +19 -9
- data/examples/v201203/line_item_service/create_mobile_line_item.rb +134 -0
- data/examples/v201203/line_item_service/create_video_line_item.rb +155 -0
- data/examples/{v201107 → v201203}/line_item_service/get_all_line_items.rb +1 -1
- data/examples/{v201107 → v201203}/line_item_service/get_line_item.rb +1 -1
- data/examples/{v201107 → v201203}/line_item_service/get_line_items_by_statement.rb +11 -7
- data/examples/{v201103/line_item_service/get_line_items_by_statement.rb → v201203/line_item_service/get_recently_updated_line_items.rb} +23 -14
- data/examples/{v201107 → v201203}/line_item_service/target_custom_criteria.rb +1 -1
- data/examples/{v201103 → v201203}/line_item_service/update_line_items.rb +1 -1
- data/examples/{v201103 → v201203}/network_service/get_all_networks.rb +1 -1
- data/examples/{v201103 → v201203}/network_service/get_current_network.rb +1 -1
- data/examples/{v201107/network_service/get_current_network.rb → v201203/network_service/make_test_network.rb} +21 -10
- data/examples/{v201104 → v201203}/order_service/approve_orders.rb +24 -18
- data/examples/{v201107 → v201203}/order_service/create_orders.rb +1 -1
- data/examples/{v201107 → v201203}/order_service/get_all_orders.rb +1 -1
- data/examples/{v201103 → v201203}/order_service/get_order.rb +1 -1
- data/examples/{v201103 → v201203}/order_service/get_orders_by_statement.rb +1 -1
- data/examples/{v201107 → v201203}/order_service/update_orders.rb +1 -1
- data/examples/{v201103 → v201203}/placement_service/create_placements.rb +3 -2
- data/examples/{v201107 → v201203}/placement_service/deactivate_placements.rb +1 -1
- data/examples/{v201103 → v201203}/placement_service/get_all_placements.rb +1 -1
- data/examples/{v201104 → v201203}/placement_service/get_placement.rb +1 -1
- data/examples/{v201107 → v201203}/placement_service/get_placements_by_statement.rb +1 -1
- data/examples/{v201103 → v201203}/placement_service/update_placements.rb +1 -1
- data/examples/{v201104 → v201203}/publisher_query_language_service/get_all_cities.rb +7 -2
- data/examples/{v201107 → v201203}/report_service/download_report.rb +1 -1
- data/examples/{v201104 → v201203}/report_service/run_delivery_report.rb +17 -3
- data/examples/{v201104 → v201203}/report_service/run_inventory_report.rb +4 -2
- data/examples/{v201107/report_service/run_delivery_report.rb → v201203/report_service/run_merged_delivery_report.rb} +12 -7
- data/examples/{v201107 → v201203}/report_service/run_sales_report.rb +1 -1
- data/examples/v201203/suggested_ad_unit_service/approve_all_suggested_ad_units.rb +108 -0
- data/examples/{v201107/inventory_service/get_all_ad_units.rb → v201203/suggested_ad_unit_service/get_all_suggested_ad_units.rb} +17 -14
- data/examples/{v201104/inventory_service/get_ad_unit.rb → v201203/suggested_ad_unit_service/get_suggested_ad_unit.rb} +17 -14
- data/examples/{v201107/inventory_service/get_ad_units_by_statement.rb → v201203/suggested_ad_unit_service/get_suggested_ad_units_by_statement.rb} +22 -26
- data/examples/{v201103/user_service/create_users.rb → v201203/team_service/create_teams.rb} +31 -28
- data/examples/{v201107/user_service/get_all_users.rb → v201203/team_service/get_all_teams.rb} +16 -17
- data/examples/{v201104/network_service/get_current_network.rb → v201203/team_service/get_team.rb} +21 -13
- data/examples/{v201103/user_service/update_users.rb → v201203/team_service/get_teams_by_statement.rb} +27 -29
- data/examples/{v201104/user_service/update_users.rb → v201203/team_service/update_teams.rb} +38 -23
- data/examples/v201203/third_party_slot_service/archive_third_party_slots.rb +124 -0
- data/examples/{v201103/company_service/get_company.rb → v201203/third_party_slot_service/create_third_party_slot.rb} +33 -14
- data/examples/{v201103/order_service/get_all_orders.rb → v201203/third_party_slot_service/get_all_third_party_slots.rb} +15 -15
- data/examples/{v201104/placement_service/get_placements_by_statement.rb → v201203/third_party_slot_service/get_third_party_slot_by_statement.rb} +16 -16
- data/examples/{v201103/placement_service/get_placements_by_statement.rb → v201203/third_party_slot_service/update_third_party_slots.rb} +32 -23
- data/examples/{v201104 → v201203}/user_service/create_users.rb +1 -1
- data/examples/{v201104 → v201203}/user_service/deactivate_users.rb +1 -1
- data/examples/{v201103 → v201203}/user_service/get_all_roles.rb +1 -1
- data/examples/{v201104 → v201203}/user_service/get_all_users.rb +1 -1
- data/examples/{v201107 → v201203}/user_service/get_current_user.rb +1 -1
- data/examples/{v201103 → v201203}/user_service/get_user.rb +1 -1
- data/examples/{v201103 → v201203}/user_service/get_users_by_statement.rb +1 -1
- data/examples/{v201107 → v201203}/user_service/update_users.rb +1 -1
- data/lib/dfp_api/api_config.rb +14 -36
- data/lib/dfp_api/v201108/company_service.rb +18 -16
- data/lib/dfp_api/v201108/company_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/creative_service.rb +10 -8
- data/lib/dfp_api/v201108/creative_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/custom_targeting_service.rb +22 -20
- data/lib/dfp_api/v201108/custom_targeting_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/forecast_service.rb +10 -8
- data/lib/dfp_api/v201108/forecast_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/inventory_service.rb +22 -20
- data/lib/dfp_api/v201108/inventory_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/label_service.rb +18 -16
- data/lib/dfp_api/v201108/label_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/line_item_creative_association_service.rb +14 -12
- data/lib/dfp_api/v201108/line_item_creative_association_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/line_item_service.rb +18 -16
- data/lib/dfp_api/v201108/line_item_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/network_service.rb +6 -4
- data/lib/dfp_api/v201108/network_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/order_service.rb +10 -8
- data/lib/dfp_api/v201108/order_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/placement_service.rb +18 -16
- data/lib/dfp_api/v201108/placement_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/publisher_query_language_service.rb +6 -4
- data/lib/dfp_api/v201108/publisher_query_language_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/report_service.rb +6 -4
- data/lib/dfp_api/v201108/report_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/third_party_slot_service.rb +6 -4
- data/lib/dfp_api/v201108/third_party_slot_service_registry.rb +8 -6
- data/lib/dfp_api/v201108/user_service.rb +18 -16
- data/lib/dfp_api/v201108/user_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/company_service.rb +18 -16
- data/lib/dfp_api/v201111/company_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/content_service.rb +6 -4
- data/lib/dfp_api/v201111/content_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/creative_service.rb +10 -8
- data/lib/dfp_api/v201111/creative_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/creative_template_service.rb +6 -4
- data/lib/dfp_api/v201111/creative_template_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/custom_targeting_service.rb +22 -20
- data/lib/dfp_api/v201111/custom_targeting_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/forecast_service.rb +10 -8
- data/lib/dfp_api/v201111/forecast_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/inventory_service.rb +22 -20
- data/lib/dfp_api/v201111/inventory_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/label_service.rb +18 -16
- data/lib/dfp_api/v201111/label_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/line_item_creative_association_service.rb +18 -16
- data/lib/dfp_api/v201111/line_item_creative_association_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/line_item_service.rb +18 -16
- data/lib/dfp_api/v201111/line_item_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/network_service.rb +6 -4
- data/lib/dfp_api/v201111/network_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/order_service.rb +10 -8
- data/lib/dfp_api/v201111/order_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/placement_service.rb +18 -16
- data/lib/dfp_api/v201111/placement_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/publisher_query_language_service.rb +6 -4
- data/lib/dfp_api/v201111/publisher_query_language_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/report_service.rb +6 -4
- data/lib/dfp_api/v201111/report_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/suggested_ad_unit_service.rb +6 -4
- data/lib/dfp_api/v201111/suggested_ad_unit_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/third_party_slot_service.rb +6 -4
- data/lib/dfp_api/v201111/third_party_slot_service_registry.rb +8 -6
- data/lib/dfp_api/v201111/user_service.rb +18 -16
- data/lib/dfp_api/v201111/user_service_registry.rb +8 -6
- data/lib/dfp_api/v201201/company_service.rb +1 -1
- data/lib/dfp_api/v201201/company_service_registry.rb +2 -2
- data/lib/dfp_api/v201201/content_service.rb +1 -1
- data/lib/dfp_api/v201201/content_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/creative_service.rb +1 -1
- data/lib/dfp_api/v201201/creative_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/creative_template_service.rb +1 -1
- data/lib/dfp_api/v201201/creative_template_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/custom_targeting_service.rb +1 -1
- data/lib/dfp_api/v201201/custom_targeting_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/forecast_service.rb +1 -1
- data/lib/dfp_api/v201201/forecast_service_registry.rb +2 -2
- data/lib/dfp_api/v201201/inventory_service.rb +1 -1
- data/lib/dfp_api/v201201/inventory_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/label_service.rb +1 -1
- data/lib/dfp_api/v201201/label_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/line_item_creative_association_service.rb +1 -1
- data/lib/dfp_api/v201201/line_item_creative_association_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/line_item_service.rb +1 -1
- data/lib/dfp_api/v201201/line_item_service_registry.rb +2 -2
- data/lib/dfp_api/v201201/network_service.rb +1 -1
- data/lib/dfp_api/v201201/network_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/order_service.rb +1 -1
- data/lib/dfp_api/v201201/order_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/placement_service.rb +1 -1
- data/lib/dfp_api/v201201/placement_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/publisher_query_language_service.rb +1 -1
- data/lib/dfp_api/v201201/publisher_query_language_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/report_service.rb +1 -1
- data/lib/dfp_api/v201201/report_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/suggested_ad_unit_service.rb +1 -1
- data/lib/dfp_api/v201201/suggested_ad_unit_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/team_service.rb +1 -1
- data/lib/dfp_api/v201201/team_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/third_party_slot_service.rb +1 -1
- data/lib/dfp_api/v201201/third_party_slot_service_registry.rb +1 -1
- data/lib/dfp_api/v201201/user_service.rb +1 -1
- data/lib/dfp_api/v201201/user_service_registry.rb +1 -1
- data/lib/dfp_api/v201203/audience_segment_service.rb +34 -0
- data/lib/dfp_api/v201203/audience_segment_service_registry.rb +46 -0
- data/lib/dfp_api/{v201103 → v201203}/company_service.rb +23 -21
- data/lib/dfp_api/v201203/company_service_registry.rb +46 -0
- data/lib/dfp_api/v201203/content_service.rb +42 -0
- data/lib/dfp_api/v201203/content_service_registry.rb +46 -0
- data/lib/dfp_api/{v201103 → v201203}/creative_service.rb +15 -13
- data/lib/dfp_api/v201203/creative_service_registry.rb +46 -0
- data/lib/dfp_api/v201203/creative_template_service.rb +38 -0
- data/lib/dfp_api/v201203/creative_template_service_registry.rb +46 -0
- data/lib/dfp_api/{v201107 → v201203}/custom_targeting_service.rb +27 -25
- data/lib/dfp_api/v201203/custom_targeting_service_registry.rb +46 -0
- data/lib/dfp_api/{v201107 → v201203}/forecast_service.rb +15 -13
- data/lib/dfp_api/v201203/forecast_service_registry.rb +46 -0
- data/lib/dfp_api/{v201107 → v201203}/inventory_service.rb +29 -23
- data/lib/dfp_api/v201203/inventory_service_registry.rb +46 -0
- data/lib/dfp_api/{v201107 → v201203}/label_service.rb +23 -21
- data/lib/dfp_api/v201203/label_service_registry.rb +46 -0
- data/lib/dfp_api/{v201103 → v201203}/line_item_creative_association_service.rb +23 -17
- data/lib/dfp_api/v201203/line_item_creative_association_service_registry.rb +46 -0
- data/lib/dfp_api/{v201107 → v201203}/line_item_service.rb +23 -21
- data/lib/dfp_api/v201203/line_item_service_registry.rb +46 -0
- data/lib/dfp_api/{v201104 → v201203}/network_service.rb +15 -9
- data/lib/dfp_api/v201203/network_service_registry.rb +46 -0
- data/lib/dfp_api/{v201103 → v201203}/order_service.rb +15 -13
- data/lib/dfp_api/v201203/order_service_registry.rb +46 -0
- data/lib/dfp_api/{v201107 → v201203}/placement_service.rb +23 -21
- data/lib/dfp_api/v201203/placement_service_registry.rb +46 -0
- data/lib/dfp_api/{v201104 → v201203}/publisher_query_language_service.rb +11 -9
- data/lib/dfp_api/v201203/publisher_query_language_service_registry.rb +46 -0
- data/lib/dfp_api/{v201103 → v201203}/report_service.rb +11 -9
- data/lib/dfp_api/v201203/report_service_registry.rb +46 -0
- data/lib/dfp_api/v201203/suggested_ad_unit_service.rb +42 -0
- data/lib/dfp_api/v201203/suggested_ad_unit_service_registry.rb +46 -0
- data/lib/dfp_api/v201203/team_service.rb +54 -0
- data/lib/dfp_api/v201203/team_service_registry.rb +46 -0
- data/lib/dfp_api/v201203/third_party_slot_service.rb +46 -0
- data/lib/dfp_api/v201203/third_party_slot_service_registry.rb +46 -0
- data/lib/dfp_api/{v201107 → v201203}/user_service.rb +23 -21
- data/lib/dfp_api/v201203/user_service_registry.rb +46 -0
- data/lib/dfp_api/version.rb +1 -1
- data/test/bugs/test_issue_00000016.rb +3 -3
- data/test/dfp_api/test_config.yml +0 -2
- data/test/dfp_api/test_dfp_api.rb +0 -4
- metadata +484 -649
- data/examples/v201103/common/oauth_handling.rb +0 -127
- data/examples/v201103/company_service/create_companies.rb +0 -80
- data/examples/v201103/company_service/get_all_companies.rb +0 -91
- data/examples/v201103/company_service/get_companies_by_statement.rb +0 -87
- data/examples/v201103/company_service/update_companies.rb +0 -94
- data/examples/v201103/creative_service/copy_image_creatives.rb +0 -114
- data/examples/v201103/creative_service/get_creatives_by_statement.rb +0 -86
- data/examples/v201103/custom_targeting_service/create_custom_targeting_keys_and_values.rb +0 -117
- data/examples/v201103/custom_targeting_service/delete_custom_targeting_values.rb +0 -124
- data/examples/v201103/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +0 -91
- data/examples/v201103/custom_targeting_service/get_custom_targeting_values_by_statement.rb +0 -97
- data/examples/v201103/custom_targeting_service/update_custom_targeting_keys.rb +0 -93
- data/examples/v201103/forecast_service/get_forecast.rb +0 -102
- data/examples/v201103/forecast_service/get_forecast_by_id.rb +0 -79
- data/examples/v201103/inventory_service/get_ad_units_by_statement.rb +0 -95
- data/examples/v201103/inventory_service/update_ad_units.rb +0 -93
- data/examples/v201103/line_item_creative_association_service/create_licas.rb +0 -93
- data/examples/v201103/line_item_creative_association_service/deactivate_licas.rb +0 -126
- data/examples/v201103/line_item_creative_association_service/get_all_licas.rb +0 -94
- data/examples/v201103/line_item_creative_association_service/get_lica.rb +0 -76
- data/examples/v201103/line_item_creative_association_service/get_licas_by_statement.rb +0 -90
- data/examples/v201103/line_item_creative_association_service/update_licas.rb +0 -91
- data/examples/v201103/line_item_service/create_line_items.rb +0 -163
- data/examples/v201103/line_item_service/get_all_line_items.rb +0 -93
- data/examples/v201103/line_item_service/get_line_item.rb +0 -73
- data/examples/v201103/line_item_service/target_custom_criteria.rb +0 -134
- data/examples/v201103/order_service/approve_orders.rb +0 -115
- data/examples/v201103/order_service/create_orders.rb +0 -91
- data/examples/v201103/order_service/update_orders.rb +0 -94
- data/examples/v201103/placement_service/deactivate_placements.rb +0 -117
- data/examples/v201103/placement_service/get_placement.rb +0 -73
- data/examples/v201103/publisher_query_language_service/get_all_cities.rb +0 -84
- data/examples/v201103/publisher_query_language_service/get_all_countries.rb +0 -84
- data/examples/v201103/publisher_query_language_service/get_all_metros.rb +0 -84
- data/examples/v201103/publisher_query_language_service/get_all_regions.rb +0 -84
- data/examples/v201103/report_service/download_report.rb +0 -80
- data/examples/v201103/report_service/run_delivery_report.rb +0 -88
- data/examples/v201103/report_service/run_inventory_report.rb +0 -89
- data/examples/v201103/report_service/run_sales_report.rb +0 -88
- data/examples/v201103/user_service/deactivate_users.rb +0 -98
- data/examples/v201104/common/error_handling.rb +0 -75
- data/examples/v201104/common/oauth_handling.rb +0 -127
- data/examples/v201104/company_service/create_companies.rb +0 -80
- data/examples/v201104/company_service/get_all_companies.rb +0 -91
- data/examples/v201104/company_service/update_companies.rb +0 -94
- data/examples/v201104/creative_service/copy_image_creatives.rb +0 -114
- data/examples/v201104/creative_service/create_creatives.rb +0 -105
- data/examples/v201104/creative_service/get_all_creatives.rb +0 -92
- data/examples/v201104/creative_service/get_creatives_by_statement.rb +0 -86
- data/examples/v201104/creative_service/update_creatives.rb +0 -95
- data/examples/v201104/custom_targeting_service/create_custom_targeting_keys_and_values.rb +0 -117
- data/examples/v201104/custom_targeting_service/delete_custom_targeting_keys.rb +0 -120
- data/examples/v201104/custom_targeting_service/delete_custom_targeting_values.rb +0 -124
- data/examples/v201104/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +0 -147
- data/examples/v201104/custom_targeting_service/update_custom_targeting_keys.rb +0 -93
- data/examples/v201104/custom_targeting_service/update_custom_targeting_values.rb +0 -105
- data/examples/v201104/forecast_service/get_forecast_by_id.rb +0 -79
- data/examples/v201104/inventory_service/deactivate_ad_units.rb +0 -118
- data/examples/v201104/line_item_creative_association_service/create_licas.rb +0 -93
- data/examples/v201104/line_item_creative_association_service/get_licas_by_statement.rb +0 -90
- data/examples/v201104/line_item_creative_association_service/update_licas.rb +0 -91
- data/examples/v201104/line_item_service/activate_line_items.rb +0 -130
- data/examples/v201104/line_item_service/create_line_items.rb +0 -155
- data/examples/v201104/line_item_service/get_all_line_items.rb +0 -93
- data/examples/v201104/line_item_service/get_line_item.rb +0 -73
- data/examples/v201104/line_item_service/get_line_items_by_statement.rb +0 -88
- data/examples/v201104/line_item_service/target_custom_criteria.rb +0 -128
- data/examples/v201104/line_item_service/update_line_items.rb +0 -108
- data/examples/v201104/network_service/get_all_networks.rb +0 -73
- data/examples/v201104/order_service/create_orders.rb +0 -91
- data/examples/v201104/order_service/get_order.rb +0 -73
- data/examples/v201104/order_service/get_orders_by_statement.rb +0 -89
- data/examples/v201104/order_service/update_orders.rb +0 -94
- data/examples/v201104/placement_service/create_placements.rb +0 -127
- data/examples/v201104/placement_service/deactivate_placements.rb +0 -117
- data/examples/v201104/placement_service/get_all_placements.rb +0 -92
- data/examples/v201104/placement_service/update_placements.rb +0 -96
- data/examples/v201104/publisher_query_language_service/get_all_countries.rb +0 -84
- data/examples/v201104/publisher_query_language_service/get_all_metros.rb +0 -84
- data/examples/v201104/publisher_query_language_service/get_all_regions.rb +0 -84
- data/examples/v201104/report_service/download_report.rb +0 -80
- data/examples/v201104/report_service/run_sales_report.rb +0 -88
- data/examples/v201104/user_service/get_all_roles.rb +0 -72
- data/examples/v201104/user_service/get_user.rb +0 -72
- data/examples/v201104/user_service/get_users_by_statement.rb +0 -78
- data/examples/v201107/common/error_handling.rb +0 -75
- data/examples/v201107/company_service/get_companies_by_statement.rb +0 -87
- data/examples/v201107/company_service/get_company.rb +0 -71
- data/examples/v201107/creative_service/get_all_creatives.rb +0 -92
- data/examples/v201107/creative_service/get_creative.rb +0 -71
- data/examples/v201107/creative_service/update_creatives.rb +0 -95
- data/examples/v201107/custom_targeting_service/delete_custom_targeting_keys.rb +0 -120
- data/examples/v201107/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +0 -147
- data/examples/v201107/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +0 -91
- data/examples/v201107/custom_targeting_service/get_custom_targeting_values_by_statement.rb +0 -97
- data/examples/v201107/custom_targeting_service/update_custom_targeting_values.rb +0 -105
- data/examples/v201107/forecast_service/get_forecast.rb +0 -102
- data/examples/v201107/inventory_service/deactivate_ad_units.rb +0 -118
- data/examples/v201107/inventory_service/get_ad_unit.rb +0 -71
- data/examples/v201107/inventory_service/update_ad_units.rb +0 -93
- data/examples/v201107/line_item_creative_association_service/deactivate_licas.rb +0 -126
- data/examples/v201107/line_item_creative_association_service/get_all_licas.rb +0 -94
- data/examples/v201107/line_item_creative_association_service/get_lica.rb +0 -76
- data/examples/v201107/line_item_service/activate_line_items.rb +0 -130
- data/examples/v201107/line_item_service/update_line_items.rb +0 -108
- data/examples/v201107/network_service/get_all_networks.rb +0 -73
- data/examples/v201107/order_service/approve_orders.rb +0 -115
- data/examples/v201107/order_service/get_order.rb +0 -73
- data/examples/v201107/order_service/get_orders_by_statement.rb +0 -89
- data/examples/v201107/placement_service/create_placements.rb +0 -127
- data/examples/v201107/placement_service/get_all_placements.rb +0 -92
- data/examples/v201107/placement_service/get_placement.rb +0 -73
- data/examples/v201107/placement_service/update_placements.rb +0 -96
- data/examples/v201107/publisher_query_language_service/get_all_bandwidth_groups.rb +0 -84
- data/examples/v201107/publisher_query_language_service/get_all_browser_languages.rb +0 -84
- data/examples/v201107/publisher_query_language_service/get_all_browsers.rb +0 -84
- data/examples/v201107/publisher_query_language_service/get_all_cities.rb +0 -84
- data/examples/v201107/publisher_query_language_service/get_all_countries.rb +0 -84
- data/examples/v201107/publisher_query_language_service/get_all_metros.rb +0 -84
- data/examples/v201107/publisher_query_language_service/get_all_operating_systems.rb +0 -84
- data/examples/v201107/publisher_query_language_service/get_all_regions.rb +0 -84
- data/examples/v201107/report_service/run_inventory_report.rb +0 -89
- data/examples/v201107/user_service/create_users.rb +0 -88
- data/examples/v201107/user_service/deactivate_users.rb +0 -98
- data/examples/v201107/user_service/get_all_roles.rb +0 -72
- data/examples/v201107/user_service/get_user.rb +0 -72
- data/lib/dfp_api/v201103/company_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/creative_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/custom_targeting_service.rb +0 -60
- data/lib/dfp_api/v201103/custom_targeting_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/forecast_service.rb +0 -36
- data/lib/dfp_api/v201103/forecast_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/inventory_service.rb +0 -56
- data/lib/dfp_api/v201103/inventory_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/line_item_creative_association_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/line_item_service.rb +0 -56
- data/lib/dfp_api/v201103/line_item_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/network_service.rb +0 -40
- data/lib/dfp_api/v201103/network_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/order_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/placement_service.rb +0 -56
- data/lib/dfp_api/v201103/placement_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/publisher_query_language_service.rb +0 -32
- data/lib/dfp_api/v201103/publisher_query_language_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/report_service_registry.rb +0 -44
- data/lib/dfp_api/v201103/user_service.rb +0 -60
- data/lib/dfp_api/v201103/user_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/company_service.rb +0 -52
- data/lib/dfp_api/v201104/company_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/creative_service.rb +0 -52
- data/lib/dfp_api/v201104/creative_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/custom_targeting_service.rb +0 -60
- data/lib/dfp_api/v201104/custom_targeting_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/forecast_service.rb +0 -36
- data/lib/dfp_api/v201104/forecast_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/inventory_service.rb +0 -56
- data/lib/dfp_api/v201104/inventory_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/line_item_creative_association_service.rb +0 -56
- data/lib/dfp_api/v201104/line_item_creative_association_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/line_item_service.rb +0 -56
- data/lib/dfp_api/v201104/line_item_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/network_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/order_service.rb +0 -56
- data/lib/dfp_api/v201104/order_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/placement_service.rb +0 -56
- data/lib/dfp_api/v201104/placement_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/publisher_query_language_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/report_service.rb +0 -40
- data/lib/dfp_api/v201104/report_service_registry.rb +0 -44
- data/lib/dfp_api/v201104/user_service.rb +0 -60
- data/lib/dfp_api/v201104/user_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/company_service.rb +0 -52
- data/lib/dfp_api/v201107/company_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/creative_service.rb +0 -52
- data/lib/dfp_api/v201107/creative_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/custom_targeting_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/forecast_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/inventory_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/label_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/line_item_creative_association_service.rb +0 -56
- data/lib/dfp_api/v201107/line_item_creative_association_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/line_item_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/network_service.rb +0 -40
- data/lib/dfp_api/v201107/network_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/order_service.rb +0 -56
- data/lib/dfp_api/v201107/order_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/placement_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/publisher_query_language_service.rb +0 -32
- data/lib/dfp_api/v201107/publisher_query_language_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/report_service.rb +0 -40
- data/lib/dfp_api/v201107/report_service_registry.rb +0 -44
- data/lib/dfp_api/v201107/user_service_registry.rb +0 -44
data/ChangeLog
CHANGED
data/README
CHANGED
@@ -71,10 +71,8 @@ constructor:
|
|
71
71
|
:method => 'ClientLogin',
|
72
72
|
:application_name => 'Ruby DFP Sample',
|
73
73
|
:email => 'user@domain.com',
|
74
|
-
:password => 'PASSWORD'
|
75
|
-
|
76
|
-
:service => {
|
77
|
-
:environment => 'SANDBOX'
|
74
|
+
:password => 'PASSWORD',
|
75
|
+
:network_code => 123456
|
78
76
|
}
|
79
77
|
})
|
80
78
|
|
@@ -114,7 +112,7 @@ Once the library object is created you can request services with a 'service'
|
|
114
112
|
method:
|
115
113
|
user_service = dfp.service(:UserService, <API_VERSION>)
|
116
114
|
|
117
|
-
where <API_VERSION> is required version of DFP API as symbol, e.g. :
|
115
|
+
where <API_VERSION> is required version of DFP API as symbol, e.g. :v201203.
|
118
116
|
|
119
117
|
Then you should be able to execute service methods:
|
120
118
|
|
@@ -148,7 +146,7 @@ Examples can be run by executing by running:
|
|
148
146
|
|
149
147
|
from the "examples/<version>/<service_name>" directory i.e.
|
150
148
|
|
151
|
-
$ cd examples/
|
149
|
+
$ cd examples/v201203/user_service
|
152
150
|
$ ruby get_all_users.rb
|
153
151
|
|
154
152
|
Some examples require modification to be functional, like create_order example
|
data/dfp_api.yml
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
# Auth parameters for OAuth method.
|
9
9
|
# Set the OAuth consumer key and secret. Anonymous values can be used for
|
10
10
|
# testing, and real values can be obtained by registering your application:
|
11
|
-
#
|
11
|
+
# https://developers.google.com/accounts/docs/RegistrationForWebAppsAuto
|
12
12
|
#:oauth_consumer_key: anonymous
|
13
13
|
#:oauth_consumer_secret: anonymous
|
14
14
|
# If you manage or store access token manually, you can specify it here.
|
@@ -26,6 +26,10 @@
|
|
26
26
|
|
27
27
|
# Other parameters.
|
28
28
|
:application_name: dfp_ruby_examples
|
29
|
+
|
30
|
+
# Starting in v201203, network_code is required for all calls other than
|
31
|
+
# GetAllNetworks and MakeTestNetwork. In earlier versions, networkCode is
|
32
|
+
# optional if the user belongs to only one network.
|
29
33
|
:network_code: INSERT_NETWORK_CODE_HERE
|
30
34
|
:service:
|
31
35
|
:environment: SANDBOX
|
@@ -1,8 +1,9 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Encoding: utf-8
|
2
3
|
#
|
3
4
|
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
4
5
|
#
|
5
|
-
# Copyright:: Copyright
|
6
|
+
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
|
6
7
|
#
|
7
8
|
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
9
|
# you may not use this file except in compliance with the License.
|
@@ -17,16 +18,16 @@
|
|
17
18
|
# See the License for the specific language governing permissions and
|
18
19
|
# limitations under the License.
|
19
20
|
#
|
20
|
-
# This example gets all
|
21
|
+
# This code example gets all audience segments.
|
21
22
|
#
|
22
|
-
# Tags:
|
23
|
+
# Tags: AudienceSegmentService.getAudienceSegmentsByStatement
|
23
24
|
|
24
25
|
require 'dfp_api'
|
25
26
|
|
26
|
-
API_VERSION = :
|
27
|
+
API_VERSION = :v201203
|
27
28
|
PAGE_SIZE = 500
|
28
29
|
|
29
|
-
def
|
30
|
+
def get_all_audience_segments()
|
30
31
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
31
32
|
dfp = DfpApi::Api.new
|
32
33
|
|
@@ -34,8 +35,8 @@ def get_all_orders()
|
|
34
35
|
# the configuration file or provide your own logger:
|
35
36
|
# dfp.logger = Logger.new('dfp_xml.log')
|
36
37
|
|
37
|
-
# Get the
|
38
|
-
|
38
|
+
# Get the AudienceSegmentService.
|
39
|
+
audience_segment_service = dfp.service(:AudienceSegmentService, API_VERSION)
|
39
40
|
|
40
41
|
# Define initial values.
|
41
42
|
offset = 0
|
@@ -45,8 +46,9 @@ def get_all_orders()
|
|
45
46
|
# Create statement for one page with current offset.
|
46
47
|
statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]}
|
47
48
|
|
48
|
-
# Get
|
49
|
-
page =
|
49
|
+
# Get audience segments by statement.
|
50
|
+
page =
|
51
|
+
audience_segment_service.get_audience_segments_by_statement(statement)
|
50
52
|
|
51
53
|
if page[:results]
|
52
54
|
# Increase query offset by page size.
|
@@ -55,24 +57,23 @@ def get_all_orders()
|
|
55
57
|
# Get the start index for printout.
|
56
58
|
start_index = page[:start_index]
|
57
59
|
|
58
|
-
# Print details about each
|
59
|
-
page[:results].each_with_index do |
|
60
|
-
puts "%d)
|
61
|
-
[index + start_index,
|
62
|
-
order[:advertiser_id]]
|
60
|
+
# Print details about each audience segment in results page.
|
61
|
+
page[:results].each_with_index do |segment, index|
|
62
|
+
puts "%d) Audience segment ID: %d, name: %s" %
|
63
|
+
[index + start_index, segment[:id], segment[:name]]
|
63
64
|
end
|
64
65
|
end
|
65
66
|
end while offset < page[:total_result_set_size]
|
66
67
|
|
67
68
|
# Print a footer
|
68
69
|
if page.include?(:total_result_set_size)
|
69
|
-
puts "Total number of
|
70
|
+
puts "Total number of audience segments: %d" % page[:total_result_set_size]
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
73
74
|
if __FILE__ == $0
|
74
75
|
begin
|
75
|
-
|
76
|
+
get_all_audience_segments()
|
76
77
|
|
77
78
|
# HTTP errors.
|
78
79
|
rescue AdsCommon::Errors::HttpError => e
|
data/examples/{v201103/user_service/get_all_users.rb → v201203/content_service/get_all_content.rb}
RENAMED
@@ -17,17 +17,18 @@
|
|
17
17
|
# See the License for the specific language governing permissions and
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
|
-
# This example gets all
|
21
|
-
# create_users.rb.
|
20
|
+
# This example gets all content.
|
22
21
|
#
|
23
|
-
#
|
22
|
+
# This feature is only available to DFP video publishers.
|
23
|
+
#
|
24
|
+
# Tags: ContentService.getContentByStatement
|
24
25
|
|
25
26
|
require 'dfp_api'
|
26
27
|
|
27
|
-
API_VERSION = :
|
28
|
+
API_VERSION = :v201203
|
28
29
|
PAGE_SIZE = 500
|
29
30
|
|
30
|
-
def
|
31
|
+
def get_all_content()
|
31
32
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
32
33
|
dfp = DfpApi::Api.new
|
33
34
|
|
@@ -35,8 +36,8 @@ def get_all_users()
|
|
35
36
|
# the configuration file or provide your own logger:
|
36
37
|
# dfp.logger = Logger.new('dfp_xml.log')
|
37
38
|
|
38
|
-
# Get the
|
39
|
-
|
39
|
+
# Get the ContentService.
|
40
|
+
content_service = dfp.service(:ContentService, API_VERSION)
|
40
41
|
|
41
42
|
# Define initial values.
|
42
43
|
offset = 0
|
@@ -46,8 +47,8 @@ def get_all_users()
|
|
46
47
|
# Create statement for one page with current offset.
|
47
48
|
statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]}
|
48
49
|
|
49
|
-
# Get
|
50
|
-
page =
|
50
|
+
# Get content by statement.
|
51
|
+
page = content_service.get_content_by_statement(statement)
|
51
52
|
|
52
53
|
if page[:results]
|
53
54
|
# Increase query offset by page size.
|
@@ -56,23 +57,23 @@ def get_all_users()
|
|
56
57
|
# Get the start index for printout.
|
57
58
|
start_index = page[:start_index]
|
58
59
|
|
59
|
-
# Print details about each
|
60
|
-
page[:results].each_with_index do |
|
61
|
-
puts "%d)
|
62
|
-
|
60
|
+
# Print details about each content object in results page.
|
61
|
+
page[:results].each_with_index do |content, index|
|
62
|
+
puts "%d) Content ID: %d, name: %s, status: %s." % [index + start_index,
|
63
|
+
content[:id], content[:name], content[:status]]
|
63
64
|
end
|
64
65
|
end
|
65
66
|
end while offset < page[:total_result_set_size]
|
66
67
|
|
67
68
|
# Print a footer
|
68
69
|
if page.include?(:total_result_set_size)
|
69
|
-
puts "Total number of
|
70
|
+
puts "Total number of results: %d" % page[:total_result_set_size]
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
73
74
|
if __FILE__ == $0
|
74
75
|
begin
|
75
|
-
|
76
|
+
get_all_content()
|
76
77
|
|
77
78
|
# HTTP errors.
|
78
79
|
rescue AdsCommon::Errors::HttpError => e
|
@@ -0,0 +1,135 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
|
+
#
|
7
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
+
# implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
# This example gets all active content categorized as "comedy" using the
|
21
|
+
# network's content browse custom targeting key.
|
22
|
+
#
|
23
|
+
# This feature is only available to DFP video publishers.
|
24
|
+
#
|
25
|
+
# Tags: NetworkService.getCurrentNetwork,
|
26
|
+
# ContentService.getContentByStatementAndCustomTargetingValue
|
27
|
+
# CustomTargetingService.getCustomTargetingValuesByStatement
|
28
|
+
|
29
|
+
require 'dfp_api'
|
30
|
+
|
31
|
+
API_VERSION = :v201203
|
32
|
+
PAGE_SIZE = 500
|
33
|
+
|
34
|
+
def get_content_by_statement()
|
35
|
+
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
36
|
+
dfp = DfpApi::Api.new
|
37
|
+
|
38
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
39
|
+
# the configuration file or provide your own logger:
|
40
|
+
# dfp.logger = Logger.new('dfp_xml.log')
|
41
|
+
|
42
|
+
# Get the NetworkService.
|
43
|
+
network_service = dfp.service(:NetworkService, API_VERSION)
|
44
|
+
|
45
|
+
# Get content browse custom targeting key ID.
|
46
|
+
current_network = network_service.get_current_network
|
47
|
+
content_browse_custom_targeting_key_id =
|
48
|
+
current_network[:content_browse_custom_targeting_key_id]
|
49
|
+
|
50
|
+
# Get the CustomTargetingService.
|
51
|
+
custom_targeting_service = dfp.service(:CustomTargetingService, API_VERSION)
|
52
|
+
|
53
|
+
# Create a statement to select the categories matching the name comedy.
|
54
|
+
statement = {
|
55
|
+
:query => 'WHERE customTargetingKeyId = :targeting_key_id' +
|
56
|
+
' and name = :category LIMIT 1',
|
57
|
+
:values => [
|
58
|
+
{:key => 'targeting_key_id',
|
59
|
+
:value => {:value => content_browse_custom_targeting_key_id,
|
60
|
+
:xsi_type => 'NumberValue'}},
|
61
|
+
{:key => 'category',
|
62
|
+
:value => {:value => 'comedy',
|
63
|
+
:xsi_type => 'TextValue'}},
|
64
|
+
]
|
65
|
+
}
|
66
|
+
|
67
|
+
# Get categories matching the filter statement.
|
68
|
+
page = custom_targeting_service.get_custom_targeting_values_by_statement(
|
69
|
+
statement)
|
70
|
+
|
71
|
+
# Get the custom targeting value ID for the comedy category.
|
72
|
+
category_custom_targeting_value_id = page[:results].first()[:id]
|
73
|
+
|
74
|
+
# Get the ContentService.
|
75
|
+
content_service = dfp.service(:ContentService, API_VERSION)
|
76
|
+
|
77
|
+
# Define initial values.
|
78
|
+
offset = 0
|
79
|
+
page = {}
|
80
|
+
|
81
|
+
statement_text = 'WHERE status = :status'
|
82
|
+
statement = {
|
83
|
+
:query => statement_text,
|
84
|
+
:values => [
|
85
|
+
{:key => 'status',
|
86
|
+
:value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}}
|
87
|
+
]
|
88
|
+
}
|
89
|
+
|
90
|
+
begin
|
91
|
+
# Create a statement to get one page with current offset.
|
92
|
+
statement[:query] = statement_text +
|
93
|
+
" LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]
|
94
|
+
|
95
|
+
# Get content by statement.
|
96
|
+
page = content_service.get_content_by_statement_and_custom_targeting_value(
|
97
|
+
statement, category_custom_targeting_value_id)
|
98
|
+
|
99
|
+
if page[:results]
|
100
|
+
# Increase query offset by page size.
|
101
|
+
offset += PAGE_SIZE
|
102
|
+
|
103
|
+
page[:results].each_with_index do |content, index|
|
104
|
+
puts "%d) Content ID: %d, name: %s, status: %s." % [index + start_index,
|
105
|
+
content[:id], content[:name], content[:status]]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end while offset < page[:total_result_set_size]
|
109
|
+
|
110
|
+
# Print a footer.
|
111
|
+
if page.include?(:total_result_set_size)
|
112
|
+
puts "Number of results found: %d" % page[:total_result_set_size]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
if __FILE__ == $0
|
117
|
+
begin
|
118
|
+
get_content_by_statement()
|
119
|
+
|
120
|
+
# HTTP errors.
|
121
|
+
rescue AdsCommon::Errors::HttpError => e
|
122
|
+
puts "HTTP Error: %s" % e
|
123
|
+
|
124
|
+
# API errors.
|
125
|
+
rescue DfpApi::Errors::ApiException => e
|
126
|
+
puts "Message: %s" % e.message
|
127
|
+
puts 'Errors:'
|
128
|
+
e.errors.each_with_index do |error, index|
|
129
|
+
puts "\tError [%d]:" % (index + 1)
|
130
|
+
error.each do |field, value|
|
131
|
+
puts "\t\t%s: %s" % [field, value]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
|
+
#
|
7
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
+
# implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
# This example creates a new template creative for a given advertiser. To
|
21
|
+
# determine which companies are advertisers, run get_companies_by_statement.rb.
|
22
|
+
# To determine which creatives already exist, run get_all_creatives.rb. To
|
23
|
+
# determine which creative templates run get_all_creative_templates.rb.
|
24
|
+
#
|
25
|
+
# Tags: CreativeService.createCreative
|
26
|
+
|
27
|
+
require 'base64'
|
28
|
+
require 'dfp_api'
|
29
|
+
|
30
|
+
API_VERSION = :v201203
|
31
|
+
|
32
|
+
def create_creative_from_template()
|
33
|
+
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
34
|
+
dfp = DfpApi::Api.new
|
35
|
+
|
36
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
37
|
+
# the configuration file or provide your own logger:
|
38
|
+
# dfp.logger = Logger.new('dfp_xml.log')
|
39
|
+
|
40
|
+
# Get the CreativeService.
|
41
|
+
creative_service = dfp.service(:CreativeService, API_VERSION)
|
42
|
+
|
43
|
+
# Set the ID of the advertiser (company) that all creatives will be assigned
|
44
|
+
# to.
|
45
|
+
advertiser_id = 'INSERT_ADVERTISER_COMPANY_ID_HERE'.to_i
|
46
|
+
|
47
|
+
# Use the image banner with optional third party tracking template.
|
48
|
+
creative_template_id = 10000680
|
49
|
+
|
50
|
+
# Create the local custom creative object.
|
51
|
+
creative = {
|
52
|
+
:xsi_type => 'TemplateCreative',
|
53
|
+
:name => 'Template creative',
|
54
|
+
:advertiser_id => advertiser_id,
|
55
|
+
:creative_template_id => creative_template_id,
|
56
|
+
:size => {:width => 300, :height => 250, :is_aspect_ratio => false}
|
57
|
+
}
|
58
|
+
|
59
|
+
# Prepare image data for asset value.
|
60
|
+
image_url =
|
61
|
+
'http://www.google.com/intl/en/adwords/select/images/samples/inline.jpg'
|
62
|
+
image_data = AdsCommon::Http.get(image_url)
|
63
|
+
image_data_base64 = Base64.encode64(image_data)
|
64
|
+
|
65
|
+
# Create the asset variable value.
|
66
|
+
asset_variable_value = {
|
67
|
+
:xsi_type => 'AssetCreativeTemplateVariableValue',
|
68
|
+
:unique_name => 'Imagefile',
|
69
|
+
:asset_byte_array => image_data_base64,
|
70
|
+
# Filenames must be unique.
|
71
|
+
:file_name => "image%d.jpg" % Time.new.to_i
|
72
|
+
}
|
73
|
+
|
74
|
+
# Create the image width variable value.
|
75
|
+
image_width_variable_value = {
|
76
|
+
:xsi_type => 'LongCreativeTemplateVariableValue',
|
77
|
+
:unique_name => 'Imagewidth',
|
78
|
+
:value => 300
|
79
|
+
}
|
80
|
+
|
81
|
+
# Create the image height variable value.
|
82
|
+
image_height_variable_value = {
|
83
|
+
:xsi_type => 'LongCreativeTemplateVariableValue',
|
84
|
+
:unique_name => 'Imageheight',
|
85
|
+
:value => 250
|
86
|
+
}
|
87
|
+
|
88
|
+
# Create the URL variable value.
|
89
|
+
url_variable_value = {
|
90
|
+
:xsi_type => 'UrlCreativeTemplateVariableValue',
|
91
|
+
:unique_name => 'ClickthroughURL',
|
92
|
+
:value => 'www.google.com'
|
93
|
+
}
|
94
|
+
|
95
|
+
# Create the target window variable value.
|
96
|
+
target_window_variable_value = {
|
97
|
+
:xsi_type => 'StringCreativeTemplateVariableValue',
|
98
|
+
:unique_name => 'Targetwindow',
|
99
|
+
:value => '__blank'
|
100
|
+
}
|
101
|
+
|
102
|
+
creative[:creative_template_variable_values] = [asset_variable_value,
|
103
|
+
image_width_variable_value, image_height_variable_value,
|
104
|
+
url_variable_value, target_window_variable_value]
|
105
|
+
|
106
|
+
# Create the creatives on the server.
|
107
|
+
return_creative = creative_service.create_creative(creative)
|
108
|
+
|
109
|
+
if return_creative
|
110
|
+
puts(("Template creative with ID: %d, name: %s and type '%s' was " +
|
111
|
+
"created and can be previewed at: '%s'") %
|
112
|
+
[return_creative[:id], return_creative[:name],
|
113
|
+
return_creative[:creative_type], return_creative[:preview_url]])
|
114
|
+
else
|
115
|
+
raise 'No creatives were created.'
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
if __FILE__ == $0
|
120
|
+
begin
|
121
|
+
create_creative_from_template()
|
122
|
+
|
123
|
+
# HTTP errors.
|
124
|
+
rescue AdsCommon::Errors::HttpError => e
|
125
|
+
puts "HTTP Error: %s" % e
|
126
|
+
|
127
|
+
# API errors.
|
128
|
+
rescue DfpApi::Errors::ApiException => e
|
129
|
+
puts "Message: %s" % e.message
|
130
|
+
puts 'Errors:'
|
131
|
+
e.errors.each_with_index do |error, index|
|
132
|
+
puts "\tError [%d]:" % (index + 1)
|
133
|
+
error.each do |field, value|
|
134
|
+
puts "\t\t%s: %s" % [field, value]
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|