google-dfp-api 0.2.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,88 +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 runs a report equal to the "Sales by salespersons report" on the
|
|
21
|
-
# DFP website. To download the report see download_report.rb.
|
|
22
|
-
#
|
|
23
|
-
# Tags: ReportService.runReportJob, ReportService.getReportJob
|
|
24
|
-
|
|
25
|
-
require 'dfp_api'
|
|
26
|
-
|
|
27
|
-
API_VERSION = :v201104
|
|
28
|
-
MAX_RETRIES = 10
|
|
29
|
-
RETRY_INTERVAL = 30
|
|
30
|
-
|
|
31
|
-
def run_sales_report()
|
|
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 ReportService.
|
|
40
|
-
report_service = dfp.service(:ReportService, API_VERSION)
|
|
41
|
-
|
|
42
|
-
# Create report query.
|
|
43
|
-
report_query = {
|
|
44
|
-
:date_range_type => 'LAST_MONTH',
|
|
45
|
-
:dimensions => ['SALESPERSON'],
|
|
46
|
-
:columns =>
|
|
47
|
-
['AD_SERVER_IMPRESSIONS', 'AD_SERVER_REVENUE', 'AD_SERVER_AVERAGE_ECPM']
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
# Create report job.
|
|
51
|
-
report_job = {:report_query => report_query}
|
|
52
|
-
|
|
53
|
-
# Run report job.
|
|
54
|
-
report_job = report_service.run_report_job(report_job);
|
|
55
|
-
|
|
56
|
-
MAX_RETRIES.times do |retry_count|
|
|
57
|
-
# Get the report job status.
|
|
58
|
-
report_job = report_service.get_report_job(report_job[:id])
|
|
59
|
-
|
|
60
|
-
break unless report_job[:report_job_status] == 'IN_PROGRESS'
|
|
61
|
-
puts "Report with ID: %d is still running." % report_job[:id]
|
|
62
|
-
sleep(RETRY_INTERVAL)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
puts "Report job with ID: %d finished with status %s." %
|
|
66
|
-
[report_job[:id], report_job[:report_job_status]]
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
if __FILE__ == $0
|
|
70
|
-
begin
|
|
71
|
-
run_sales_report()
|
|
72
|
-
|
|
73
|
-
# HTTP errors.
|
|
74
|
-
rescue AdsCommon::Errors::HttpError => e
|
|
75
|
-
puts "HTTP Error: %s" % e
|
|
76
|
-
|
|
77
|
-
# API errors.
|
|
78
|
-
rescue DfpApi::Errors::ApiException => e
|
|
79
|
-
puts "Message: %s" % e.message
|
|
80
|
-
puts 'Errors:'
|
|
81
|
-
e.errors.each_with_index do |error, index|
|
|
82
|
-
puts "\tError [%d]:" % (index + 1)
|
|
83
|
-
error.each do |field, value|
|
|
84
|
-
puts "\t\t%s: %s" % [field, value]
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
@@ -1,72 +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 roles. This example can be used to determine which role
|
|
21
|
-
# ID is needed when getting and creating users.
|
|
22
|
-
#
|
|
23
|
-
# Tags: UserService.getAllRoles
|
|
24
|
-
|
|
25
|
-
require 'dfp_api'
|
|
26
|
-
|
|
27
|
-
API_VERSION = :v201104
|
|
28
|
-
|
|
29
|
-
def get_all_roles()
|
|
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 UserService.
|
|
38
|
-
user_service = dfp.service(:UserService, API_VERSION)
|
|
39
|
-
|
|
40
|
-
# Get all roles.
|
|
41
|
-
roles = user_service.get_all_roles()
|
|
42
|
-
|
|
43
|
-
if roles
|
|
44
|
-
# Print details about each role in results page.
|
|
45
|
-
roles.each_with_index do |role, index|
|
|
46
|
-
puts "%d) Role ID: %d, name: %s" % [index, role[:id], role[:name]]
|
|
47
|
-
end
|
|
48
|
-
# Print a footer
|
|
49
|
-
puts "Total number of roles: %d" % roles.size
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
if __FILE__ == $0
|
|
54
|
-
begin
|
|
55
|
-
get_all_roles()
|
|
56
|
-
|
|
57
|
-
# HTTP errors.
|
|
58
|
-
rescue AdsCommon::Errors::HttpError => e
|
|
59
|
-
puts "HTTP Error: %s" % e
|
|
60
|
-
|
|
61
|
-
# API errors.
|
|
62
|
-
rescue DfpApi::Errors::ApiException => e
|
|
63
|
-
puts "Message: %s" % e.message
|
|
64
|
-
puts 'Errors:'
|
|
65
|
-
e.errors.each_with_index do |error, index|
|
|
66
|
-
puts "\tError [%d]:" % (index + 1)
|
|
67
|
-
error.each do |field, value|
|
|
68
|
-
puts "\t\t%s: %s" % [field, value]
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
@@ -1,72 +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 user by its ID. To create users, run create_users.rb.
|
|
21
|
-
#
|
|
22
|
-
# Tags: UserService.getUser
|
|
23
|
-
|
|
24
|
-
require 'dfp_api'
|
|
25
|
-
|
|
26
|
-
API_VERSION = :v201104
|
|
27
|
-
|
|
28
|
-
def get_user()
|
|
29
|
-
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
|
30
|
-
dfp = DfpApi::Api.new
|
|
31
|
-
|
|
32
|
-
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
|
33
|
-
# the configuration file or provide your own logger:
|
|
34
|
-
# dfp.logger = Logger.new('dfp_xml.log')
|
|
35
|
-
|
|
36
|
-
# Get the UserService.
|
|
37
|
-
user_service = dfp.service(:UserService, API_VERSION)
|
|
38
|
-
|
|
39
|
-
# Set the ID of the user to get.
|
|
40
|
-
user_id = 'INSERT_USER_ID_HERE'.to_i
|
|
41
|
-
|
|
42
|
-
# Get the user.
|
|
43
|
-
user = user_service.get_user(user_id)
|
|
44
|
-
|
|
45
|
-
if user
|
|
46
|
-
puts "User with ID: %d, name: %s, email: %s and role: %s was found." %
|
|
47
|
-
[user[:id], user[:name], user[:email], user[:role_name]]
|
|
48
|
-
else
|
|
49
|
-
puts 'No user found for this ID.'
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
if __FILE__ == $0
|
|
54
|
-
begin
|
|
55
|
-
get_user()
|
|
56
|
-
|
|
57
|
-
# HTTP errors.
|
|
58
|
-
rescue AdsCommon::Errors::HttpError => e
|
|
59
|
-
puts "HTTP Error: %s" % e
|
|
60
|
-
|
|
61
|
-
# API errors.
|
|
62
|
-
rescue DfpApi::Errors::ApiException => e
|
|
63
|
-
puts "Message: %s" % e.message
|
|
64
|
-
puts 'Errors:'
|
|
65
|
-
e.errors.each_with_index do |error, index|
|
|
66
|
-
puts "\tError [%d]:" % (index + 1)
|
|
67
|
-
error.each do |field, value|
|
|
68
|
-
puts "\t\t%s: %s" % [field, value]
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
@@ -1,78 +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 users sorted by name. The statement retrieves up to the
|
|
21
|
-
# maximum page size limit of 500. To create new users, run create_users.rb.
|
|
22
|
-
#
|
|
23
|
-
# Tags: UserService.getUsersByStatement
|
|
24
|
-
|
|
25
|
-
require 'dfp_api'
|
|
26
|
-
|
|
27
|
-
API_VERSION = :v201104
|
|
28
|
-
|
|
29
|
-
def get_users_by_statement()
|
|
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 UserService.
|
|
38
|
-
user_service = dfp.service(:UserService, API_VERSION)
|
|
39
|
-
|
|
40
|
-
# Create a statement to get all users sorted by name.
|
|
41
|
-
statement = {:query => 'ORDER BY name LIMIT 500'}
|
|
42
|
-
|
|
43
|
-
# Get users by statement.
|
|
44
|
-
page = user_service.get_users_by_statement(statement)
|
|
45
|
-
|
|
46
|
-
if page and page[:results]
|
|
47
|
-
page[:results].each_with_index do |user, index|
|
|
48
|
-
puts "%d) User ID: %d, name: %s, email: %s, role: %s." % [index,
|
|
49
|
-
user[:id], user[:name], user[:email], user[:role_name]]
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# Print a footer.
|
|
54
|
-
if page.include?(:total_result_set_size)
|
|
55
|
-
puts "Number of results found: %d" % page[:total_result_set_size]
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
if __FILE__ == $0
|
|
60
|
-
begin
|
|
61
|
-
get_users_by_statement()
|
|
62
|
-
|
|
63
|
-
# HTTP errors.
|
|
64
|
-
rescue AdsCommon::Errors::HttpError => e
|
|
65
|
-
puts "HTTP Error: %s" % e
|
|
66
|
-
|
|
67
|
-
# API errors.
|
|
68
|
-
rescue DfpApi::Errors::ApiException => e
|
|
69
|
-
puts "Message: %s" % e.message
|
|
70
|
-
puts 'Errors:'
|
|
71
|
-
e.errors.each_with_index do |error, index|
|
|
72
|
-
puts "\tError [%d]:" % (index + 1)
|
|
73
|
-
error.each do |field, value|
|
|
74
|
-
puts "\t\t%s: %s" % [field, value]
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
@@ -1,75 +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 runs incorrect query and demonstrates how to handle errors.
|
|
21
|
-
#
|
|
22
|
-
# Tags: UserService.updateUser
|
|
23
|
-
|
|
24
|
-
require 'dfp_api'
|
|
25
|
-
|
|
26
|
-
API_VERSION = :v201107
|
|
27
|
-
|
|
28
|
-
def produce_api_error()
|
|
29
|
-
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
|
30
|
-
dfp = DfpApi::Api.new
|
|
31
|
-
|
|
32
|
-
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
|
33
|
-
# the configuration file or provide your own logger:
|
|
34
|
-
# dfp.logger = Logger.new('dfp_xml.log')
|
|
35
|
-
|
|
36
|
-
# Get the UserService.
|
|
37
|
-
user_service = dfp.service(:UserService, API_VERSION)
|
|
38
|
-
|
|
39
|
-
# Omitting "id" field here to produce an error.
|
|
40
|
-
user = {:preferred_locale => 'en_UK', :name => 'foo_bar'}
|
|
41
|
-
|
|
42
|
-
# Execute request and get the response, this should raise an exception.
|
|
43
|
-
user = user_service.update_user(user)
|
|
44
|
-
|
|
45
|
-
# Output retrieved data.
|
|
46
|
-
puts "User ID: %d, name: %s, email: %s" %
|
|
47
|
-
[user[:id], user[:name], user[:email]]
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
if __FILE__ == $0
|
|
51
|
-
begin
|
|
52
|
-
# This function should produce an exception for demo.
|
|
53
|
-
produce_api_error()
|
|
54
|
-
|
|
55
|
-
# One of two kinds of exception might occur, general HTTP error like 403 or
|
|
56
|
-
# 404 and DFP API error defined in WSDL and described in documentation.
|
|
57
|
-
|
|
58
|
-
# Handling HTTP errors.
|
|
59
|
-
rescue AdsCommon::Errors::HttpError => e
|
|
60
|
-
puts "HTTP Error: %s" % e
|
|
61
|
-
|
|
62
|
-
# Handling API errors.
|
|
63
|
-
rescue DfpApi::Errors::ApiException => e
|
|
64
|
-
# Standard DFP API error includes message and array of errors occured.
|
|
65
|
-
puts "Message: %s" % e.message
|
|
66
|
-
puts 'Errors:'
|
|
67
|
-
# Print out each of the errors.
|
|
68
|
-
e.errors.each_with_index do |error, index|
|
|
69
|
-
puts "\tError [%d]:" % (index + 1)
|
|
70
|
-
error.each do |field, value|
|
|
71
|
-
puts "\t\t%s: %s" % [field, value]
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
@@ -1,87 +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 companies that are advertisers. The statement retrieves
|
|
21
|
-
# up to the maximum page size limit of 500. To create companies, run
|
|
22
|
-
# create_companies.rb.
|
|
23
|
-
#
|
|
24
|
-
# Tags: CompanyService.getCompaniesByStatement
|
|
25
|
-
|
|
26
|
-
require 'dfp_api'
|
|
27
|
-
|
|
28
|
-
API_VERSION = :v201107
|
|
29
|
-
|
|
30
|
-
def get_companies_by_statement()
|
|
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 CompanyService.
|
|
39
|
-
company_service = dfp.service(:CompanyService, API_VERSION)
|
|
40
|
-
|
|
41
|
-
# Create a statement to only select companies that are advertisers, sorted by
|
|
42
|
-
# name.
|
|
43
|
-
statement = {
|
|
44
|
-
:query => 'WHERE type = :type ORDER BY name LIMIT 500',
|
|
45
|
-
:values => [
|
|
46
|
-
{:key => 'type',
|
|
47
|
-
:value => {:value => 'ADVERTISER', :xsi_type => 'TextValue'}}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
# Get companies by statement.
|
|
52
|
-
page = company_service.get_companies_by_statement(statement)
|
|
53
|
-
|
|
54
|
-
if page[:results]
|
|
55
|
-
# Print details about each company in results.
|
|
56
|
-
page[:results].each_with_index do |company, index|
|
|
57
|
-
puts "%d) [%d] name: %s, type: %s" %
|
|
58
|
-
[index, company[:id], company[:name], company[:type]]
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# Print a footer.
|
|
63
|
-
if page.include?(:total_result_set_size)
|
|
64
|
-
puts "Total number of companies: %d" % page[:total_result_set_size]
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
if __FILE__ == $0
|
|
69
|
-
begin
|
|
70
|
-
get_companies_by_statement()
|
|
71
|
-
|
|
72
|
-
# HTTP errors.
|
|
73
|
-
rescue AdsCommon::Errors::HttpError => e
|
|
74
|
-
puts "HTTP Error: %s" % e
|
|
75
|
-
|
|
76
|
-
# API errors.
|
|
77
|
-
rescue DfpApi::Errors::ApiException => e
|
|
78
|
-
puts "Message: %s" % e.message
|
|
79
|
-
puts 'Errors:'
|
|
80
|
-
e.errors.each_with_index do |error, index|
|
|
81
|
-
puts "\tError [%d]:" % (index + 1)
|
|
82
|
-
error.each do |field, value|
|
|
83
|
-
puts "\t\t%s: %s" % [field, value]
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|