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
@@ -1,90 +0,0 @@
|
|
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 line item creative associations for a given line item
|
21
|
-
# ID. The statement retrieves up to the maximum page size limit of 500. To
|
22
|
-
# create LICAs, run create_licas.rb. To determine which line items exist, run
|
23
|
-
# get_all_line_items.rb.
|
24
|
-
#
|
25
|
-
# Tags: LineItemCreativeAssociationService.getLineItemCreativeAssociationsByStatement
|
26
|
-
|
27
|
-
require 'dfp_api'
|
28
|
-
|
29
|
-
API_VERSION = :v201103
|
30
|
-
|
31
|
-
def get_licas_by_statement()
|
32
|
-
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
33
|
-
dfp = DfpApi::Api.new
|
34
|
-
|
35
|
-
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
36
|
-
# the configuration file or provide your own logger:
|
37
|
-
# dfp.logger = Logger.new('dfp_xml.log')
|
38
|
-
|
39
|
-
# Get the LineItemCreativeAssociationService.
|
40
|
-
lica_service = dfp.service(:LineItemCreativeAssociationService, API_VERSION)
|
41
|
-
|
42
|
-
# Set the line item to get LICAs by.
|
43
|
-
line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i
|
44
|
-
|
45
|
-
# Create a statement to only select LICAs for the given line item ID.
|
46
|
-
statement = {
|
47
|
-
:query => 'WHERE lineItemId = :line_item_id LIMIT 500',
|
48
|
-
:values => [
|
49
|
-
{:key => 'line_item_id',
|
50
|
-
:value => {:value => line_item_id, :xsi_type => 'NumberValue'}}
|
51
|
-
]
|
52
|
-
}
|
53
|
-
|
54
|
-
# Get LICAs by statement.
|
55
|
-
page =
|
56
|
-
lica_service.get_line_item_creative_associations_by_statement(statement)
|
57
|
-
|
58
|
-
if page and page[:results]
|
59
|
-
page[:results].each_with_index do |lica, index|
|
60
|
-
puts "%d) LICA with line item ID: %d, creative ID: %d and status: %s." %
|
61
|
-
[index, lica[:line_item_id], lica[:creative_id], lica[:status]]
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# Print a footer.
|
66
|
-
if page.include?(:total_result_set_size)
|
67
|
-
puts "Number of results found: %d" % page[:total_result_set_size]
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
if __FILE__ == $0
|
72
|
-
begin
|
73
|
-
get_licas_by_statement()
|
74
|
-
|
75
|
-
# HTTP errors.
|
76
|
-
rescue AdsCommon::Errors::HttpError => e
|
77
|
-
puts "HTTP Error: %s" % e
|
78
|
-
|
79
|
-
# API errors.
|
80
|
-
rescue DfpApi::Errors::ApiException => e
|
81
|
-
puts "Message: %s" % e.message
|
82
|
-
puts 'Errors:'
|
83
|
-
e.errors.each_with_index do |error, index|
|
84
|
-
puts "\tError [%d]:" % (index + 1)
|
85
|
-
error.each do |field, value|
|
86
|
-
puts "\t\t%s: %s" % [field, value]
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,91 +0,0 @@
|
|
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 updates the destination URL of all LICAs up to the first 500. To
|
21
|
-
# determine which LICAs exist, run get_all_licas.rb.
|
22
|
-
#
|
23
|
-
# Tags:
|
24
|
-
# LineItemCreativeAssociationService.getLineItemCreativeAssociationsByStatement,
|
25
|
-
# LineItemCreativeAssociationService.updateLineItemCreativeAssociations
|
26
|
-
|
27
|
-
require 'dfp_api'
|
28
|
-
|
29
|
-
API_VERSION = :v201103
|
30
|
-
|
31
|
-
def update_licas()
|
32
|
-
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
33
|
-
dfp = DfpApi::Api.new
|
34
|
-
|
35
|
-
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
36
|
-
# the configuration file or provide your own logger:
|
37
|
-
# dfp.logger = Logger.new('dfp_xml.log')
|
38
|
-
|
39
|
-
# Get the LineItemCreativeAssociationService.
|
40
|
-
lica_service = dfp.service(:LineItemCreativeAssociationService, API_VERSION)
|
41
|
-
|
42
|
-
# Create a statement to get all LICAs.
|
43
|
-
statement = {:query => 'LIMIT 500'}
|
44
|
-
|
45
|
-
# Get LICAs by statement.
|
46
|
-
page =
|
47
|
-
lica_service.get_line_item_creative_associations_by_statement(statement)
|
48
|
-
|
49
|
-
if page[:results]
|
50
|
-
licas = page[:results]
|
51
|
-
|
52
|
-
# Update each local LICA object by changing its destination URL.
|
53
|
-
licas.each {|lica| lica[:destination_url] = 'http://news.google.com'}
|
54
|
-
|
55
|
-
# Update the LICAs on the server.
|
56
|
-
return_licas = lica_service.update_line_item_creative_associations(licas)
|
57
|
-
|
58
|
-
if return_licas
|
59
|
-
return_licas.each do |lica|
|
60
|
-
puts ("LICA with line item ID: %d and creative ID: %d was updated " +
|
61
|
-
"with destination url [%s]") %
|
62
|
-
[lica[:line_item_id], lica[:creative_id], lica[:destination_url]]
|
63
|
-
end
|
64
|
-
else
|
65
|
-
raise 'No LICAs were updated.'
|
66
|
-
end
|
67
|
-
else
|
68
|
-
puts 'No LICAs found to update.'
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
if __FILE__ == $0
|
73
|
-
begin
|
74
|
-
update_licas()
|
75
|
-
|
76
|
-
# HTTP errors.
|
77
|
-
rescue AdsCommon::Errors::HttpError => e
|
78
|
-
puts "HTTP Error: %s" % e
|
79
|
-
|
80
|
-
# API errors.
|
81
|
-
rescue DfpApi::Errors::ApiException => e
|
82
|
-
puts "Message: %s" % e.message
|
83
|
-
puts 'Errors:'
|
84
|
-
e.errors.each_with_index do |error, index|
|
85
|
-
puts "\tError [%d]:" % (index + 1)
|
86
|
-
error.each do |field, value|
|
87
|
-
puts "\t\t%s: %s" % [field, value]
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
@@ -1,163 +0,0 @@
|
|
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 new line items. To determine which line items exist, run
|
21
|
-
# get_all_line_items.rb. To determine which orders exist, run
|
22
|
-
# get_all_orders.rb. To determine which placements exist, run
|
23
|
-
# get_all_placements.rb.
|
24
|
-
#
|
25
|
-
# Tags: LineItemService.createLineItems
|
26
|
-
|
27
|
-
require 'dfp_api'
|
28
|
-
|
29
|
-
API_VERSION = :v201103
|
30
|
-
# Number of line items to create.
|
31
|
-
ITEM_COUNT = 5
|
32
|
-
|
33
|
-
def create_line_items()
|
34
|
-
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
35
|
-
dfp = DfpApi::Api.new
|
36
|
-
|
37
|
-
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
38
|
-
# the configuration file or provide your own logger:
|
39
|
-
# dfp.logger = Logger.new('dfp_xml.log')
|
40
|
-
|
41
|
-
# Get the LineItemService.
|
42
|
-
line_item_service = dfp.service(:LineItemService, API_VERSION)
|
43
|
-
|
44
|
-
# Set the order that all created line items will belong to and the placement
|
45
|
-
# ID to target.
|
46
|
-
order_id = 'INSERT_ORDER_ID_HERE'.to_i
|
47
|
-
targeted_placement_ids = Array.new(ITEM_COUNT) do
|
48
|
-
'INSERT_PLACEMENT_ID_HERE'.to_i
|
49
|
-
end
|
50
|
-
|
51
|
-
# Create inventory targeting.
|
52
|
-
inventory_targeting = {:targeted_placement_ids => targeted_placement_ids}
|
53
|
-
|
54
|
-
# Create geographical targeting.
|
55
|
-
geo_targeting = {}
|
56
|
-
# Include the US and Quebec, Canada.
|
57
|
-
geo_targeting[:targeted_locations] = [
|
58
|
-
{:xsi_type => 'CountryLocation', :country_code => 'US'},
|
59
|
-
{:xsi_type => 'RegionLocation', :region_code => 'CA-QC'}
|
60
|
-
]
|
61
|
-
|
62
|
-
# Exclude Chicago and the New York metro area.
|
63
|
-
geo_targeting[:excluded_locations] = [
|
64
|
-
{:xsi_type => 'CityLocation',
|
65
|
-
:city_name => 'Chicago', :country_code => 'US'},
|
66
|
-
{:xsi_type => 'MetroLocation', :metro_code => '501'}
|
67
|
-
]
|
68
|
-
|
69
|
-
# Create user domain targeting. Exclude domains that are not under the
|
70
|
-
# network's control.
|
71
|
-
user_domain_targeting = {
|
72
|
-
:domains => ['usa.gov'],
|
73
|
-
:targeted => false
|
74
|
-
}
|
75
|
-
|
76
|
-
# Create day-part targeting.
|
77
|
-
day_part_targeting = {
|
78
|
-
# Target only the weekend in the browser's timezone.
|
79
|
-
:time_zone => 'BROWSER',
|
80
|
-
:day_parts => [
|
81
|
-
{:day_of_week => 'SATURDAY',
|
82
|
-
:start_time => {:hour => 0, :minute => 'ZERO'},
|
83
|
-
:end_time => {:hour => 24, :minute => 'ZERO'}},
|
84
|
-
{:day_of_week => 'SUNDAY',
|
85
|
-
:start_time => {:hour => 0, :minute => 'ZERO'},
|
86
|
-
:end_time => {:hour => 24, :minute => 'ZERO'}}
|
87
|
-
]
|
88
|
-
}
|
89
|
-
|
90
|
-
# Create targeting.
|
91
|
-
targeting = {:geo_targeting => geo_targeting,
|
92
|
-
:inventory_targeting => inventory_targeting,
|
93
|
-
:user_domain_targeting => user_domain_targeting,
|
94
|
-
:day_part_targeting => day_part_targeting
|
95
|
-
}
|
96
|
-
|
97
|
-
# Create an array to store local line item objects.
|
98
|
-
line_items = (1..ITEM_COUNT).map do |index|
|
99
|
-
line_item = {:name => "Line item #%d" % index,
|
100
|
-
:order_id => order_id,
|
101
|
-
:targeting => targeting,
|
102
|
-
:line_item_type => 'STANDARD',
|
103
|
-
:allow_overbook => true}
|
104
|
-
# Set the creative rotation type to even.
|
105
|
-
line_item[:creative_rotation_type] = 'EVEN'
|
106
|
-
|
107
|
-
# Set the size of creatives that can be associated with this line item.
|
108
|
-
line_item[:creative_sizes] = [
|
109
|
-
{:width => 300, :height => 250, :is_aspect_ratio => false}
|
110
|
-
]
|
111
|
-
|
112
|
-
# Set the length of the line item to run.
|
113
|
-
line_item[:start_date_time_type] = 'IMMEDIATELY'
|
114
|
-
line_item[:end_date_time] = Time.new + 60 * 60 * 24 * 7
|
115
|
-
|
116
|
-
# Set the cost per unit to $2.
|
117
|
-
line_item[:cost_type] = 'CPM'
|
118
|
-
line_item[:cost_per_unit] = {
|
119
|
-
:currency_code => 'USD',
|
120
|
-
:micro_amount => 2000000
|
121
|
-
}
|
122
|
-
|
123
|
-
# Set the number of units bought to 500,000 so that the budget is $1,000.
|
124
|
-
line_item[:units_bought] = 500000
|
125
|
-
line_item[:unit_type] = 'IMPRESSIONS'
|
126
|
-
|
127
|
-
line_item
|
128
|
-
end
|
129
|
-
|
130
|
-
# Create the line items on the server.
|
131
|
-
return_line_items = line_item_service.create_line_items(line_items)
|
132
|
-
|
133
|
-
if return_line_items
|
134
|
-
return_line_items.each do |line_item|
|
135
|
-
puts ("Line item with ID: %d, belonging to order ID: %d, " +
|
136
|
-
"and named: %s was created.") %
|
137
|
-
[line_item[:id], line_item[:order_id], line_item[:name]]
|
138
|
-
end
|
139
|
-
else
|
140
|
-
raise 'No line items were created.'
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
if __FILE__ == $0
|
145
|
-
begin
|
146
|
-
create_line_items()
|
147
|
-
|
148
|
-
# HTTP errors.
|
149
|
-
rescue AdsCommon::Errors::HttpError => e
|
150
|
-
puts "HTTP Error: %s" % e
|
151
|
-
|
152
|
-
# API errors.
|
153
|
-
rescue DfpApi::Errors::ApiException => e
|
154
|
-
puts "Message: %s" % e.message
|
155
|
-
puts 'Errors:'
|
156
|
-
e.errors.each_with_index do |error, index|
|
157
|
-
puts "\tError [%d]:" % (index + 1)
|
158
|
-
error.each do |field, value|
|
159
|
-
puts "\t\t%s: %s" % [field, value]
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
@@ -1,93 +0,0 @@
|
|
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 line items. To create line items, run
|
21
|
-
# create_line_items.rb.
|
22
|
-
#
|
23
|
-
# Tags: LineItemService.getLineItemsByStatement
|
24
|
-
|
25
|
-
require 'dfp_api'
|
26
|
-
|
27
|
-
API_VERSION = :v201103
|
28
|
-
PAGE_SIZE = 500
|
29
|
-
|
30
|
-
def get_all_line_items()
|
31
|
-
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
32
|
-
dfp = DfpApi::Api.new
|
33
|
-
|
34
|
-
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
35
|
-
# the configuration file or provide your own logger:
|
36
|
-
# dfp.logger = Logger.new('dfp_xml.log')
|
37
|
-
|
38
|
-
# Get the LineItemService.
|
39
|
-
line_item_service = dfp.service(:LineItemService, API_VERSION)
|
40
|
-
|
41
|
-
# Define initial values.
|
42
|
-
offset = 0
|
43
|
-
page = {}
|
44
|
-
|
45
|
-
begin
|
46
|
-
# Create a statement to get one page with current offset.
|
47
|
-
statement = {:query => "LIMIT %d OFFSET %d" % [PAGE_SIZE, offset]}
|
48
|
-
|
49
|
-
# Get line items by statement.
|
50
|
-
page = line_item_service.get_line_items_by_statement(statement)
|
51
|
-
|
52
|
-
if page[:results]
|
53
|
-
# Increase query offset by page size.
|
54
|
-
offset += PAGE_SIZE
|
55
|
-
|
56
|
-
# Get the start index for printout.
|
57
|
-
start_index = page[:start_index]
|
58
|
-
|
59
|
-
# Print details about each line item in results.
|
60
|
-
page[:results].each_with_index do |line_item, index|
|
61
|
-
puts "%d) Line item ID: %d, order ID: %d, name: %s" %
|
62
|
-
[index + start_index, line_item[:id],
|
63
|
-
line_item[:order_id], line_item[:name]]
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end while offset < page[:total_result_set_size]
|
67
|
-
|
68
|
-
# Print a footer.
|
69
|
-
if page.include?(:total_result_set_size)
|
70
|
-
puts "Total number of line items: %d" % page[:total_result_set_size]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
if __FILE__ == $0
|
75
|
-
begin
|
76
|
-
get_all_line_items()
|
77
|
-
|
78
|
-
# HTTP errors.
|
79
|
-
rescue AdsCommon::Errors::HttpError => e
|
80
|
-
puts "HTTP Error: %s" % e
|
81
|
-
|
82
|
-
# API errors.
|
83
|
-
rescue DfpApi::Errors::ApiException => e
|
84
|
-
puts "Message: %s" % e.message
|
85
|
-
puts 'Errors:'
|
86
|
-
e.errors.each_with_index do |error, index|
|
87
|
-
puts "\tError [%d]:" % (index + 1)
|
88
|
-
error.each do |field, value|
|
89
|
-
puts "\t\t%s: %s" % [field, value]
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
@@ -1,73 +0,0 @@
|
|
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 a line item by its ID. To determine which line items
|
21
|
-
# exist, run get_all_line_items.rb.
|
22
|
-
#
|
23
|
-
# Tags: LineItemService.getLineItem
|
24
|
-
|
25
|
-
require 'dfp_api'
|
26
|
-
|
27
|
-
API_VERSION = :v201103
|
28
|
-
|
29
|
-
def get_line_item()
|
30
|
-
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
31
|
-
dfp = DfpApi::Api.new
|
32
|
-
|
33
|
-
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
34
|
-
# the configuration file or provide your own logger:
|
35
|
-
# dfp.logger = Logger.new('dfp_xml.log')
|
36
|
-
|
37
|
-
# Get the LineItemService.
|
38
|
-
line_item_service = dfp.service(:LineItemService, API_VERSION)
|
39
|
-
|
40
|
-
# Set the ID of the line_item to get.
|
41
|
-
line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i
|
42
|
-
|
43
|
-
# Get the line item.
|
44
|
-
line_item = line_item_service.get_line_item(line_item_id)
|
45
|
-
|
46
|
-
if line_item
|
47
|
-
puts "Line item with ID: %d, name: %s and order id: %d was found." %
|
48
|
-
[line_item[:id], line_item[:name], line_item[:order_id]]
|
49
|
-
else
|
50
|
-
puts 'No line item found for this ID.'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
if __FILE__ == $0
|
55
|
-
begin
|
56
|
-
get_line_item()
|
57
|
-
|
58
|
-
# HTTP errors.
|
59
|
-
rescue AdsCommon::Errors::HttpError => e
|
60
|
-
puts "HTTP Error: %s" % e
|
61
|
-
|
62
|
-
# API errors.
|
63
|
-
rescue DfpApi::Errors::ApiException => e
|
64
|
-
puts "Message: %s" % e.message
|
65
|
-
puts 'Errors:'
|
66
|
-
e.errors.each_with_index do |error, index|
|
67
|
-
puts "\tError [%d]:" % (index + 1)
|
68
|
-
error.each do |field, value|
|
69
|
-
puts "\t\t%s: %s" % [field, value]
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|