google-dfp-api 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/README.md +1 -3
- data/dfp_api.yml +1 -9
- data/examples/v201408/report_service/run_sales_report.rb +3 -3
- data/examples/v201411/report_service/run_sales_report.rb +3 -3
- data/examples/v201502/report_service/run_sales_report.rb +3 -3
- data/examples/{v201405 → v201505}/activity_group_service/create_activity_groups.rb +1 -1
- data/examples/{v201405 → v201505}/activity_group_service/get_active_activity_groups.rb +18 -27
- data/examples/{v201405 → v201505}/activity_group_service/get_all_activity_groups.rb +13 -23
- data/examples/{v201405 → v201505}/activity_group_service/update_activity_groups.rb +11 -9
- data/examples/{v201405 → v201505}/activity_service/create_activities.rb +1 -1
- data/examples/{v201405 → v201505}/activity_service/get_active_activities.rb +15 -27
- data/examples/{v201405 → v201505}/activity_service/get_all_activities.rb +10 -21
- data/examples/{v201405 → v201505}/activity_service/update_activities.rb +9 -7
- data/examples/{v201405 → v201505}/audience_segment_service/create_audience_segments.rb +1 -1
- data/examples/{v201405 → v201505}/audience_segment_service/get_all_audience_segments.rb +10 -19
- data/examples/{v201405 → v201505}/audience_segment_service/get_first_party_audience_segments.rb +14 -21
- data/examples/{v201405 → v201505}/audience_segment_service/populate_first_party_audience_segments.rb +16 -14
- data/examples/{v201405 → v201505}/audience_segment_service/update_audience_segments.rb +12 -11
- data/examples/{v201405 → v201505}/common/error_handling.rb +1 -1
- data/examples/{v201405 → v201505}/common/oauth2_jwt_handling.rb +9 -17
- data/examples/{v201405 → v201505}/common/setup_oauth2.rb +1 -1
- data/examples/{v201405 → v201505}/company_service/create_companies.rb +1 -1
- data/examples/{v201405 → v201505}/company_service/get_all_companies.rb +10 -18
- data/examples/{v201405 → v201505}/company_service/get_companies_by_statement.rb +21 -16
- data/examples/{v201405 → v201505}/company_service/update_companies.rb +13 -10
- data/examples/{v201405 → v201505}/contact_service/create_contacts.rb +1 -1
- data/examples/{v201405 → v201505}/contact_service/get_all_contacts.rb +11 -19
- data/examples/{v201405 → v201505}/contact_service/get_uninvited_contacts.rb +18 -22
- data/examples/{v201405 → v201505}/contact_service/update_contacts.rb +9 -7
- data/examples/{v201405 → v201505}/content_metadata_key_hierarchy_service/create_content_metadata_key_hierarchies.rb +1 -1
- data/examples/{v201405 → v201505}/content_metadata_key_hierarchy_service/delete_content_metadata_key_hierarchies.rb +11 -8
- data/examples/{v201405 → v201505}/content_metadata_key_hierarchy_service/get_all_content_metadata_key_hierarchies.rb +8 -18
- data/examples/{v201405 → v201505}/content_metadata_key_hierarchy_service/update_content_metadata_key_hierarchies.rb +9 -7
- data/examples/{v201405 → v201505}/content_service/get_all_content.rb +9 -18
- data/examples/{v201405 → v201505}/content_service/get_content_by_category.rb +18 -28
- data/examples/{v201405 → v201505}/creative_service/copy_image_creatives.rb +7 -7
- data/examples/{v201405 → v201505}/creative_service/create_creative_from_template.rb +1 -1
- data/examples/{v201405 → v201505}/creative_service/create_creatives.rb +1 -1
- data/examples/{v201405 → v201505}/creative_service/create_custom_creative.rb +1 -1
- data/examples/{v201405 → v201505}/creative_service/get_all_creatives.rb +8 -17
- data/examples/{v201405 → v201505}/creative_service/get_creatives_by_statement.rb +18 -13
- data/examples/{v201405 → v201505}/creative_service/update_creatives.rb +16 -11
- data/examples/{v201405 → v201505}/creative_set_service/associate_creative_set_to_line_item.rb +1 -1
- data/examples/{v201405 → v201505}/creative_set_service/create_creative_set.rb +1 -1
- data/examples/{v201405 → v201505}/creative_set_service/get_all_creative_sets.rb +9 -17
- data/examples/{v201405 → v201505}/creative_set_service/get_creative_sets_by_statement.rb +20 -14
- data/examples/{v201405 → v201505}/creative_set_service/update_creative_sets.rb +10 -7
- data/examples/{v201405 → v201505}/creative_template_service/get_all_creative_templates.rb +9 -17
- data/examples/{v201405/creative_template_service/get_creative_templates_by_statement.rb → v201505/creative_template_service/get_system_defined_creative_templates.rb} +24 -13
- data/examples/{v201405 → v201505}/creative_wrapper_service/create_creative_wrappers.rb +1 -1
- data/examples/{v201405 → v201505}/creative_wrapper_service/deactivate_creative_wrapper.rb +9 -7
- data/examples/{v201405 → v201505}/creative_wrapper_service/get_all_creative_wrappers.rb +10 -18
- data/examples/{v201405 → v201505}/creative_wrapper_service/get_creative_wrappers_by_statement.rb +17 -12
- data/examples/{v201405 → v201505}/creative_wrapper_service/update_creative_wrappers.rb +10 -7
- data/examples/{v201405 → v201505}/custom_field_service/create_custom_field_options.rb +1 -1
- data/examples/{v201405 → v201505}/custom_field_service/create_custom_fields.rb +1 -1
- data/examples/{v201405 → v201505}/custom_field_service/deactivate_all_line_item_custom_fields.rb +13 -23
- data/examples/{v201405 → v201505}/custom_field_service/get_all_custom_fields.rb +11 -19
- data/examples/{v201405 → v201505}/custom_field_service/get_all_line_item_custom_fields.rb +19 -14
- data/examples/{v201405 → v201505}/custom_field_service/set_line_item_custom_field_value.rb +24 -19
- data/examples/{v201405 → v201505}/custom_field_service/update_custom_fields.rb +10 -7
- data/examples/{v201405 → v201505}/custom_targeting_service/create_custom_targeting_keys_and_values.rb +1 -1
- data/examples/{v201405 → v201505}/custom_targeting_service/delete_custom_targeting_keys.rb +16 -20
- data/examples/{v201405 → v201505}/custom_targeting_service/delete_custom_targeting_values.rb +23 -21
- data/examples/{v201405 → v201505}/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +15 -36
- data/examples/{v201405 → v201505}/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +20 -16
- data/examples/{v201405 → v201505}/custom_targeting_service/get_custom_targeting_values_by_statement.rb +19 -15
- data/examples/{v201405 → v201505}/custom_targeting_service/update_custom_targeting_keys.rb +4 -3
- data/examples/{v201405 → v201505}/custom_targeting_service/update_custom_targeting_values.rb +34 -30
- data/examples/{v201405/forecast_service/get_forecast.rb → v201505/forecast_service/get_availability_forecast.rb} +38 -16
- data/examples/{v201405/forecast_service/get_forecast_by_id.rb → v201505/forecast_service/get_availability_forecast_for_line_item.rb} +18 -11
- data/examples/v201505/forecast_service/get_delivery_forecast_for_line_items.rb +81 -0
- data/examples/{v201405 → v201505}/inventory_service/create_ad_units.rb +1 -1
- data/examples/{v201405 → v201505}/inventory_service/create_mobile_ad_unit.rb +1 -1
- data/examples/{v201405 → v201505}/inventory_service/create_video_ad_unit.rb +1 -1
- data/examples/{v201405 → v201505}/inventory_service/deactivate_ad_units.rb +19 -23
- data/examples/{v201405 → v201505}/inventory_service/get_ad_unit_sizes.rb +7 -14
- data/examples/{v201405 → v201505}/inventory_service/get_ad_units_by_statement.rb +18 -13
- data/examples/{v201405 → v201505}/inventory_service/get_all_ad_units.rb +8 -17
- data/examples/{v201405 → v201505}/inventory_service/update_ad_units.rb +23 -11
- data/examples/{v201405 → v201505}/label_service/create_labels.rb +1 -1
- data/examples/{v201405 → v201505}/label_service/deactivate_labels.rb +15 -22
- data/examples/{v201405 → v201505}/label_service/get_all_labels.rb +9 -18
- data/examples/{v201405 → v201505}/label_service/get_labels_by_statement.rb +16 -11
- data/examples/{v201405 → v201505}/label_service/update_labels.rb +24 -26
- data/examples/{v201405 → v201505}/line_item_creative_association_service/create_licas.rb +1 -1
- data/examples/{v201405 → v201505}/line_item_creative_association_service/deactivate_licas.rb +15 -24
- data/examples/{v201405 → v201505}/line_item_creative_association_service/get_all_licas.rb +8 -17
- data/examples/{v201405 → v201505}/line_item_creative_association_service/get_licas_by_statement.rb +10 -8
- data/examples/{v201405 → v201505}/line_item_creative_association_service/update_licas.rb +16 -7
- data/examples/{v201405 → v201505}/line_item_service/activate_line_items.rb +13 -21
- data/examples/{v201405 → v201505}/line_item_service/create_line_items.rb +11 -4
- data/examples/{v201405 → v201505}/line_item_service/create_video_line_item.rb +13 -3
- data/examples/{v201405 → v201505}/line_item_service/get_all_line_items.rb +9 -17
- data/examples/{v201405 → v201505}/line_item_service/get_line_items_by_statement.rb +19 -17
- data/examples/{v201405 → v201505}/line_item_service/get_recently_updated_line_items.rb +19 -13
- data/examples/{v201405 → v201505}/line_item_service/target_custom_criteria.rb +9 -7
- data/examples/{v201405 → v201505}/line_item_service/update_line_items.rb +9 -9
- data/examples/{v201405 → v201505}/network_service/get_all_networks.rb +1 -1
- data/examples/{v201405 → v201505}/network_service/get_current_network.rb +1 -1
- data/examples/{v201405 → v201505}/network_service/make_test_network.rb +1 -1
- data/examples/{v201405 → v201505}/order_service/approve_orders.rb +16 -24
- data/examples/{v201405 → v201505}/order_service/create_orders.rb +1 -1
- data/examples/{v201405 → v201505}/order_service/get_all_orders.rb +8 -17
- data/examples/{v201405 → v201505}/order_service/get_orders_by_statement.rb +18 -14
- data/examples/{v201405 → v201505}/order_service/update_orders.rb +15 -7
- data/examples/{v201405 → v201505}/placement_service/create_placements.rb +4 -2
- data/examples/{v201405 → v201505}/placement_service/deactivate_placements.rb +14 -22
- data/examples/{v201405 → v201505}/placement_service/get_all_placements.rb +9 -17
- data/examples/{v201405 → v201505}/placement_service/get_placements_by_statement.rb +18 -13
- data/examples/{v201405 → v201505}/placement_service/update_placements.rb +16 -6
- data/examples/{v201405 → v201505}/publisher_query_language_service/fetch_match_tables.rb +8 -11
- data/examples/{v201405 → v201505}/publisher_query_language_service/get_all_line_items.rb +8 -9
- data/examples/{v201405 → v201505}/publisher_query_language_service/get_geo_targets.rb +10 -10
- data/examples/{v201405 → v201505}/publisher_query_language_service/get_line_items_named_like.rb +10 -10
- data/examples/{v201405 → v201505}/report_service/display_report.rb +1 -1
- data/examples/{v201405 → v201505}/report_service/download_report.rb +1 -1
- data/examples/{v201405 → v201505}/report_service/run_delivery_report.rb +6 -5
- data/examples/{v201405 → v201505}/report_service/run_inventory_report.rb +6 -5
- data/examples/{v201405 → v201505}/report_service/run_reach_report.rb +6 -5
- data/examples/{v201405/report_service/run_merged_delivery_report.rb → v201505/report_service/run_report_with_custom_fields.rb} +17 -18
- data/examples/{v201405 → v201505}/report_service/run_sales_report.rb +6 -5
- data/examples/{v201405 → v201505}/suggested_ad_unit_service/approve_all_suggested_ad_units.rb +25 -21
- data/examples/{v201405 → v201505}/suggested_ad_unit_service/get_all_suggested_ad_units.rb +9 -18
- data/examples/{v201405 → v201505}/suggested_ad_unit_service/get_suggested_ad_units_by_statement.rb +24 -21
- data/examples/{v201405 → v201505}/team_service/create_teams.rb +1 -1
- data/examples/{v201405 → v201505}/team_service/get_all_teams.rb +8 -17
- data/examples/{v201405 → v201505}/team_service/get_teams_by_statement.rb +15 -11
- data/examples/{v201405 → v201505}/team_service/update_teams.rb +4 -3
- data/examples/{v201405 → v201505}/user_service/create_users.rb +1 -1
- data/examples/{v201405 → v201505}/user_service/deactivate_users.rb +7 -7
- data/examples/{v201405 → v201505}/user_service/get_all_roles.rb +1 -1
- data/examples/{v201405 → v201505}/user_service/get_all_users.rb +8 -18
- data/examples/{v201405 → v201505}/user_service/get_current_user.rb +1 -1
- data/examples/{v201405 → v201505}/user_service/get_users_by_statement.rb +17 -12
- data/examples/{v201405 → v201505}/user_service/update_users.rb +15 -6
- data/examples/{v201405 → v201505}/user_team_association_service/create_user_team_associations.rb +1 -1
- data/examples/{v201405 → v201505}/user_team_association_service/delete_user_team_associations.rb +13 -21
- data/examples/{v201405 → v201505}/user_team_association_service/get_all_user_team_associations.rb +10 -17
- data/examples/{v201405 → v201505}/user_team_association_service/get_user_team_associations_by_statement.rb +20 -16
- data/examples/{v201405 → v201505}/user_team_association_service/update_user_team_associations.rb +8 -7
- data/lib/dfp_api/api_config.rb +27 -4
- data/lib/dfp_api/v201505/activity_group_service.rb +42 -0
- data/lib/dfp_api/v201505/activity_group_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/activity_service.rb +42 -0
- data/lib/dfp_api/v201505/activity_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/ad_exclusion_rule_service.rb +46 -0
- data/lib/dfp_api/v201505/ad_exclusion_rule_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/ad_rule_service.rb +46 -0
- data/lib/dfp_api/v201505/ad_rule_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/audience_segment_service.rb +46 -0
- data/lib/dfp_api/v201505/audience_segment_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/base_rate_service.rb +46 -0
- data/lib/dfp_api/v201505/base_rate_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/company_service.rb +42 -0
- data/lib/dfp_api/v201505/company_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/contact_service.rb +42 -0
- data/lib/dfp_api/v201505/contact_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/content_bundle_service.rb +46 -0
- data/lib/dfp_api/v201505/content_bundle_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/content_metadata_key_hierarchy_service.rb +46 -0
- data/lib/dfp_api/v201505/content_metadata_key_hierarchy_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/content_service.rb +38 -0
- data/lib/dfp_api/v201505/content_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/creative_service.rb +42 -0
- data/lib/dfp_api/v201505/creative_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/creative_set_service.rb +42 -0
- data/lib/dfp_api/v201505/creative_set_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/creative_template_service.rb +34 -0
- data/lib/dfp_api/v201505/creative_template_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/creative_wrapper_service.rb +46 -0
- data/lib/dfp_api/v201505/creative_wrapper_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/custom_field_service.rb +58 -0
- data/lib/dfp_api/v201505/custom_field_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/custom_targeting_service.rb +62 -0
- data/lib/dfp_api/v201505/custom_targeting_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/exchange_rate_service.rb +46 -0
- data/lib/dfp_api/v201505/exchange_rate_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/forecast_service.rb +46 -0
- data/lib/dfp_api/v201505/forecast_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/inventory_service.rb +50 -0
- data/lib/dfp_api/v201505/inventory_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/label_service.rb +46 -0
- data/lib/dfp_api/v201505/label_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/line_item_creative_association_service.rb +50 -0
- data/lib/dfp_api/v201505/line_item_creative_association_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/line_item_service.rb +46 -0
- data/lib/dfp_api/v201505/line_item_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/line_item_template_service.rb +34 -0
- data/lib/dfp_api/v201505/line_item_template_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/live_stream_event_service.rb +46 -0
- data/lib/dfp_api/v201505/live_stream_event_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/network_service.rb +46 -0
- data/lib/dfp_api/v201505/network_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/order_service.rb +46 -0
- data/lib/dfp_api/v201505/order_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/package_service.rb +46 -0
- data/lib/dfp_api/v201505/package_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/placement_service.rb +46 -0
- data/lib/dfp_api/v201505/placement_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/premium_rate_service.rb +42 -0
- data/lib/dfp_api/v201505/premium_rate_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/product_package_item_service.rb +46 -0
- data/lib/dfp_api/v201505/product_package_item_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/product_package_service.rb +46 -0
- data/lib/dfp_api/v201505/product_package_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/product_service.rb +42 -0
- data/lib/dfp_api/v201505/product_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/product_template_service.rb +46 -0
- data/lib/dfp_api/v201505/product_template_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/proposal_line_item_service.rb +46 -0
- data/lib/dfp_api/v201505/proposal_line_item_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/proposal_service.rb +46 -0
- data/lib/dfp_api/v201505/proposal_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/publisher_query_language_service.rb +34 -0
- data/lib/dfp_api/v201505/publisher_query_language_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/rate_card_service.rb +46 -0
- data/lib/dfp_api/v201505/rate_card_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/reconciliation_order_report_service.rb +38 -0
- data/lib/dfp_api/v201505/reconciliation_order_report_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/reconciliation_report_row_service.rb +38 -0
- data/lib/dfp_api/v201505/reconciliation_report_row_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/reconciliation_report_service.rb +38 -0
- data/lib/dfp_api/v201505/reconciliation_report_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/report_service.rb +46 -0
- data/lib/dfp_api/v201505/report_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/shared_ad_unit_service.rb +38 -0
- data/lib/dfp_api/v201505/shared_ad_unit_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/suggested_ad_unit_service.rb +38 -0
- data/lib/dfp_api/v201505/suggested_ad_unit_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/team_service.rb +42 -0
- data/lib/dfp_api/v201505/team_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/user_service.rb +54 -0
- data/lib/dfp_api/v201505/user_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/user_team_association_service.rb +46 -0
- data/lib/dfp_api/v201505/user_team_association_service_registry.rb +45 -0
- data/lib/dfp_api/v201505/workflow_request_service.rb +38 -0
- data/lib/dfp_api/v201505/workflow_request_service_registry.rb +45 -0
- data/lib/dfp_api/version.rb +1 -1
- data/test/bugs/test_issue_00000016.rb +1 -1
- data/test/dfp_api/test_config.yml +6 -5
- data/test/dfp_api/test_dfp_api.rb +32 -32
- metadata +234 -140
- data/examples/v201405/creative_template_service/get_creative_template.rb +0 -74
- data/examples/v201405/report_service/run_report_with_custom_fields.rb +0 -135
- data/examples/v201405/suggested_ad_unit_service/get_suggested_ad_unit.rb +0 -75
data/ChangeLog
CHANGED
data/README.md
CHANGED
@@ -105,9 +105,7 @@ or add it to the bash configuration file:
|
|
105
105
|
|
106
106
|
## Using OAuth2.0
|
107
107
|
|
108
|
-
|
109
|
-
(explicit email/password combination). OAuth2.0 support is almost transparent to
|
110
|
-
the library user. In order to use OAuth you just need to:
|
108
|
+
In order to use OAuth you just need to:
|
111
109
|
|
112
110
|
- set authentication method to 'OAuth2' in the configuration;
|
113
111
|
|
data/dfp_api.yml
CHANGED
@@ -4,8 +4,7 @@
|
|
4
4
|
# Detailed descriptions of these properties can be found at:
|
5
5
|
# https://developers.google.com/doubleclick-publishers/docs/soap_xml
|
6
6
|
:authentication:
|
7
|
-
# Authentication method, methods currently supported: OAUTH2, OAUTH2_JWT
|
8
|
-
# ClientLogin.
|
7
|
+
# Authentication method, methods currently supported: OAUTH2, OAUTH2_JWT
|
9
8
|
:method: OAuth2
|
10
9
|
|
11
10
|
# Auth parameters for OAUTH2 method.
|
@@ -30,13 +29,6 @@
|
|
30
29
|
# To impersonate a user set prn to an email address.
|
31
30
|
#:oauth2_prn: INSERT_OAUTH2_PRN_HERE
|
32
31
|
|
33
|
-
# Auth parameters for ClientLogin method.
|
34
|
-
# NOTE: ClientLogin method is deprecated, use OAuth2.0 instead.
|
35
|
-
#:password: INSERT_PASSWORD_HERE
|
36
|
-
#:email: INSERT_EMAIL_HERE
|
37
|
-
# To manage your auth tokens manually, use the 'auth_token' property.
|
38
|
-
#:auth_token: INSERT_AUTH_TOKEN_HERE
|
39
|
-
|
40
32
|
# Other parameters.
|
41
33
|
:application_name: dfp_ruby_examples
|
42
34
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
# This example runs a report equal to the "Sales by salespersons report" on the
|
22
22
|
# DFP website. To download the report see download_report.rb.
|
23
23
|
#
|
24
|
-
# Tags: ReportService.runReportJob, ReportService.
|
24
|
+
# Tags: ReportService.runReportJob, ReportService.getReportJobStatus
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
27
|
|
@@ -59,9 +59,9 @@ def run_sales_report()
|
|
59
59
|
|
60
60
|
MAX_RETRIES.times do |retry_count|
|
61
61
|
# Get the report job status.
|
62
|
-
|
62
|
+
report_job_status = report_service.get_report_job_status(report_job[:id])
|
63
63
|
|
64
|
-
break unless
|
64
|
+
break unless report_job_status == 'IN_PROGRESS'
|
65
65
|
puts "Report with ID: %d is still running." % report_job[:id]
|
66
66
|
sleep(RETRY_INTERVAL)
|
67
67
|
end
|
@@ -21,7 +21,7 @@
|
|
21
21
|
# This example runs a report equal to the "Sales by salespersons report" on the
|
22
22
|
# DFP website. To download the report see download_report.rb.
|
23
23
|
#
|
24
|
-
# Tags: ReportService.runReportJob, ReportService.
|
24
|
+
# Tags: ReportService.runReportJob, ReportService.getReportJobStatus
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
27
|
|
@@ -59,9 +59,9 @@ def run_sales_report()
|
|
59
59
|
|
60
60
|
MAX_RETRIES.times do |retry_count|
|
61
61
|
# Get the report job status.
|
62
|
-
|
62
|
+
report_job_status = report_service.get_report_job_status(report_job[:id])
|
63
63
|
|
64
|
-
break unless
|
64
|
+
break unless report_job_status == 'IN_PROGRESS'
|
65
65
|
puts "Report with ID: %d is still running." % report_job[:id]
|
66
66
|
sleep(RETRY_INTERVAL)
|
67
67
|
end
|
@@ -21,7 +21,7 @@
|
|
21
21
|
# This example runs a report equal to the "Sales by salespersons report" on the
|
22
22
|
# DFP website. To download the report see download_report.rb.
|
23
23
|
#
|
24
|
-
# Tags: ReportService.runReportJob, ReportService.
|
24
|
+
# Tags: ReportService.runReportJob, ReportService.getReportJobStatus
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
27
|
|
@@ -59,9 +59,9 @@ def run_sales_report()
|
|
59
59
|
|
60
60
|
MAX_RETRIES.times do |retry_count|
|
61
61
|
# Get the report job status.
|
62
|
-
|
62
|
+
report_job_status = report_service.get_report_job_status(report_job[:id])
|
63
63
|
|
64
|
-
break unless
|
64
|
+
break unless report_job_status == 'IN_PROGRESS'
|
65
65
|
puts "Report with ID: %d is still running." % report_job[:id]
|
66
66
|
sleep(RETRY_INTERVAL)
|
67
67
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Encoding: utf-8
|
3
3
|
#
|
4
|
-
# Author:: api.
|
4
|
+
# Author:: api.nicholaschen@gmail.com (Nicholas Chen)
|
5
5
|
#
|
6
|
-
# Copyright:: Copyright
|
6
|
+
# Copyright:: Copyright 2014, Google Inc. All Rights Reserved.
|
7
7
|
#
|
8
8
|
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
9
9
|
# you may not use this file except in compliance with the License.
|
@@ -24,9 +24,9 @@
|
|
24
24
|
# Tags: ActivityGroupService.getActivityGroupsByStatement
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
|
+
require 'dfp_api_statement'
|
27
28
|
|
28
|
-
API_VERSION = :
|
29
|
-
PAGE_SIZE = 500
|
29
|
+
API_VERSION = :v201505
|
30
30
|
|
31
31
|
def get_active_activity_groups()
|
32
32
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -39,38 +39,29 @@ def get_active_activity_groups()
|
|
39
39
|
# Get the ActivityGroupService.
|
40
40
|
activity_group_service = dfp.service(:ActivityGroupService, API_VERSION)
|
41
41
|
|
42
|
-
#
|
43
|
-
|
44
|
-
|
42
|
+
# Create a statement to only select active activity groups.
|
43
|
+
statement = DfpApiStatement::FilterStatement.new(
|
44
|
+
'status = :status ORDER BY id ASC',
|
45
|
+
[
|
46
|
+
{:key => 'status',
|
47
|
+
:value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}}
|
48
|
+
]
|
49
|
+
)
|
45
50
|
|
46
51
|
begin
|
47
|
-
# Create statement for one page with current offset.
|
48
|
-
statement = {
|
49
|
-
:query => 'WHERE status = :status ORDER BY id LIMIT %d OFFSET %d' %
|
50
|
-
[PAGE_SIZE, offset],
|
51
|
-
:values => [
|
52
|
-
{:key => 'status',
|
53
|
-
:value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}}
|
54
|
-
]
|
55
|
-
}
|
56
|
-
|
57
52
|
# Get activity groups by statement.
|
58
|
-
page = activity_group_service.get_activity_groups_by_statement(
|
53
|
+
page = activity_group_service.get_activity_groups_by_statement(
|
54
|
+
statement.toStatement())
|
59
55
|
|
60
56
|
if page[:results]
|
61
|
-
# Increase query offset by page size.
|
62
|
-
offset += PAGE_SIZE
|
63
|
-
|
64
|
-
# Get the start index for printout.
|
65
|
-
start_index = page[:start_index]
|
66
|
-
|
67
|
-
# Print details about each content object in results page.
|
68
57
|
page[:results].each_with_index do |activity_group, index|
|
69
|
-
puts "%d) Activity group with ID: %d, name: %s." % [
|
58
|
+
puts "%d) Activity group with ID: %d, name: %s." % [
|
59
|
+
index + statement.offset,
|
70
60
|
activity_group[:id], activity_group[:name]]
|
71
61
|
end
|
72
62
|
end
|
73
|
-
|
63
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
64
|
+
end while statement.offset < page[:total_result_set_size]
|
74
65
|
|
75
66
|
# Print a footer
|
76
67
|
if page.include?(:total_result_set_size)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Encoding: utf-8
|
3
3
|
#
|
4
|
-
# Author::
|
4
|
+
# Author:: Nicholas Chen
|
5
5
|
#
|
6
|
-
# Copyright:: Copyright
|
6
|
+
# Copyright:: Copyright 2014, Google Inc. All Rights Reserved.
|
7
7
|
#
|
8
8
|
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
9
9
|
# you may not use this file except in compliance with the License.
|
@@ -24,9 +24,9 @@
|
|
24
24
|
# Tags: ActivityGroupService.getActivityGroupsByStatement
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
|
+
require 'dfp_api_statement'
|
27
28
|
|
28
|
-
API_VERSION = :
|
29
|
-
PAGE_SIZE = 500
|
29
|
+
API_VERSION = :v201505
|
30
30
|
|
31
31
|
def get_all_activity_groups()
|
32
32
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -39,37 +39,27 @@ def get_all_activity_groups()
|
|
39
39
|
# Get the ActivityGroupService.
|
40
40
|
activity_group_service = dfp.service(:ActivityGroupService, API_VERSION)
|
41
41
|
|
42
|
-
#
|
43
|
-
|
44
|
-
page = {}
|
42
|
+
# Create a statement to select all activity groups.
|
43
|
+
statement = DfpApiStatement::FilterStatement.new('ORDER BY id ASC')
|
45
44
|
|
46
45
|
begin
|
47
|
-
# Create statement for one page with current offset.
|
48
|
-
statement = {
|
49
|
-
:query => 'ORDER BY id LIMIT %d OFFSET %d' % [PAGE_SIZE, offset],
|
50
|
-
}
|
51
|
-
|
52
46
|
# Get activity groups by statement.
|
53
|
-
page = activity_group_service.get_activity_groups_by_statement(
|
47
|
+
page = activity_group_service.get_activity_groups_by_statement(
|
48
|
+
statement.toStatement())
|
54
49
|
|
55
50
|
if page[:results]
|
56
|
-
# Increase query offset by page size.
|
57
|
-
offset += PAGE_SIZE
|
58
|
-
|
59
|
-
# Get the start index for printout.
|
60
|
-
start_index = page[:start_index]
|
61
|
-
|
62
|
-
# Print details about each content object in results page.
|
63
51
|
page[:results].each_with_index do |activity_group, index|
|
64
|
-
puts "%d) Activity group with ID: %d, name: %s." % [
|
52
|
+
puts "%d) Activity group with ID: %d, name: %s." % [
|
53
|
+
index + statement.offset,
|
65
54
|
activity_group[:id], activity_group[:name]]
|
66
55
|
end
|
67
56
|
end
|
68
|
-
|
57
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
58
|
+
end while statement.offset < page[:total_result_set_size]
|
69
59
|
|
70
60
|
# Print a footer
|
71
61
|
if page.include?(:total_result_set_size)
|
72
|
-
puts "Total number of results: %d" % page[:
|
62
|
+
puts "Total number of results: %d" % page[:total_result_set_sizet]
|
73
63
|
end
|
74
64
|
end
|
75
65
|
|
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
require 'dfp_api'
|
28
28
|
|
29
|
-
API_VERSION = :
|
29
|
+
API_VERSION = :v201505
|
30
30
|
|
31
31
|
def update_activity_groups()
|
32
32
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -44,15 +44,17 @@ def update_activity_groups()
|
|
44
44
|
advertiser_company_id = 'INSERT_ADVERTISER_COMPANY_ID_HERE'
|
45
45
|
|
46
46
|
# Create statement to select a single activity group.
|
47
|
-
statement =
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
statement = DfpApiStatement::FilterStatement.new(
|
48
|
+
'WHERE id = :id ORDER BY id ASC',
|
49
|
+
[
|
50
|
+
{:key => 'id',
|
51
|
+
:value => {:value => activity_group_id, :xsi_type => 'NumberValue'}}
|
52
|
+
],
|
53
|
+
1
|
54
|
+
)
|
54
55
|
|
55
|
-
page = activity_group_service.get_activity_groups_by_statement(
|
56
|
+
page = activity_group_service.get_activity_groups_by_statement(
|
57
|
+
statement.toStatement())
|
56
58
|
|
57
59
|
if page[:results]
|
58
60
|
# Get the activity groups.
|
@@ -24,9 +24,9 @@
|
|
24
24
|
# Tags: ActivityService.getActivitiesByStatement
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
|
+
require 'dfp_api_statement'
|
27
28
|
|
28
|
-
API_VERSION = :
|
29
|
-
PAGE_SIZE = 500
|
29
|
+
API_VERSION = :v201505
|
30
30
|
|
31
31
|
def get_active_activities()
|
32
32
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -39,41 +39,29 @@ def get_active_activities()
|
|
39
39
|
# Get the ActivityService.
|
40
40
|
activity_service = dfp.service(:ActivityService, API_VERSION)
|
41
41
|
|
42
|
-
#
|
43
|
-
|
44
|
-
|
42
|
+
# Create a statement to only select active activities.
|
43
|
+
statement = DfpApiStatement::FilterStatement.new(
|
44
|
+
'status = :status ORDER BY id ASC',
|
45
|
+
[
|
46
|
+
{:key => 'status',
|
47
|
+
:value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}}
|
48
|
+
]
|
49
|
+
)
|
45
50
|
|
46
51
|
begin
|
47
|
-
# Create statement for one page with current offset.
|
48
|
-
statement = {
|
49
|
-
:query => 'WHERE status = :status ORDER BY id LIMIT %d OFFSET %d' %
|
50
|
-
[PAGE_SIZE, offset],
|
51
|
-
:values => [
|
52
|
-
{
|
53
|
-
:key => 'status',
|
54
|
-
:value => {:value => 'ACTIVE', :xsi_type => 'TextValue'}
|
55
|
-
}
|
56
|
-
]
|
57
|
-
}
|
58
|
-
|
59
52
|
# Get activities by statement.
|
60
|
-
page = activity_service.get_activities_by_statement(
|
53
|
+
page = activity_service.get_activities_by_statement(
|
54
|
+
statement.toStatement())
|
61
55
|
|
62
56
|
if page[:results]
|
63
|
-
# Increase query offset by page size.
|
64
|
-
offset += PAGE_SIZE
|
65
|
-
|
66
|
-
# Get the start index for printout.
|
67
|
-
start_index = page[:start_index]
|
68
|
-
|
69
|
-
# Print details about each content object in results page.
|
70
57
|
page[:results].each_with_index do |activity, index|
|
71
58
|
puts "%d) Activity with ID: %d, name: %s, type: %s." %
|
72
|
-
[index +
|
59
|
+
[index + statement.offset, activity[:id], activity[:name],
|
73
60
|
activity[:type]]
|
74
61
|
end
|
75
62
|
end
|
76
|
-
|
63
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
64
|
+
end while statement.offset < page[:total_result_set_size]
|
77
65
|
|
78
66
|
# Print a footer
|
79
67
|
if page.include?(:total_result_set_size)
|
@@ -24,9 +24,9 @@
|
|
24
24
|
# Tags: ActivityService.getActivitiesByStatement
|
25
25
|
|
26
26
|
require 'dfp_api'
|
27
|
+
require 'dfp_api_statement'
|
27
28
|
|
28
|
-
API_VERSION = :
|
29
|
-
PAGE_SIZE = 500
|
29
|
+
API_VERSION = :v201505
|
30
30
|
|
31
31
|
def get_all_activities()
|
32
32
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -39,36 +39,25 @@ def get_all_activities()
|
|
39
39
|
# Get the ActivityService.
|
40
40
|
activity_service = dfp.service(:ActivityService, API_VERSION)
|
41
41
|
|
42
|
-
#
|
43
|
-
|
44
|
-
page = {}
|
42
|
+
# Create a statement to select all activities.
|
43
|
+
statement = DfpApiStatement::FilterStatement.new('ORDER BY id ASC')
|
45
44
|
|
46
45
|
begin
|
47
|
-
# Update statement for one page with current offset.
|
48
|
-
statement = {
|
49
|
-
:query => 'ORDER BY id LIMIT %d OFFSET %d' % [PAGE_SIZE, offset]
|
50
|
-
}
|
51
|
-
|
52
46
|
# Get activities by statement.
|
53
|
-
page = activity_service.get_activities_by_statement(
|
47
|
+
page = activity_service.get_activities_by_statement(
|
48
|
+
statement.toStatement())
|
54
49
|
|
55
50
|
if page[:results]
|
56
|
-
# Increase query offset by page size.
|
57
|
-
offset += PAGE_SIZE
|
58
|
-
|
59
|
-
# Get the start index for printout.
|
60
|
-
start_index = page[:start_index]
|
61
|
-
|
62
|
-
# Print details about each content object in results page.
|
63
51
|
page[:results].each_with_index do |activity, index|
|
64
52
|
puts "%d) Activity with ID: %d, name: %s, type: %s." %
|
65
|
-
[index +
|
53
|
+
[index + statement.offset, activity[:id], activity[:name],
|
66
54
|
activity[:type]]
|
67
55
|
end
|
68
56
|
end
|
69
|
-
|
57
|
+
statement.offset += DfpApiStatement::SUGGESTED_PAGE_LIMIT
|
58
|
+
end while statement.offset < page[:total_result_set_size]
|
70
59
|
|
71
|
-
# Print a footer
|
60
|
+
# Print a footer
|
72
61
|
if page.include?(:total_result_set_size)
|
73
62
|
puts "Total number of results: %d" % page[:total_result_set_size]
|
74
63
|
end
|
@@ -25,8 +25,9 @@
|
|
25
25
|
# Tags: ActivityService.updateActivities
|
26
26
|
|
27
27
|
require 'dfp_api'
|
28
|
+
require 'dfp_api_statement'
|
28
29
|
|
29
|
-
API_VERSION = :
|
30
|
+
API_VERSION = :v201505
|
30
31
|
|
31
32
|
def update_activities()
|
32
33
|
# Get DfpApi instance and load configuration from ~/dfp_api.yml.
|
@@ -43,15 +44,16 @@ def update_activities()
|
|
43
44
|
activity_id = 'INSERT_ACTIVITY_ID_HERE'
|
44
45
|
|
45
46
|
# Create statement to select a single activity.
|
46
|
-
statement =
|
47
|
-
|
48
|
-
|
47
|
+
statement = DfpApiStatement::FilterStatement.new(
|
48
|
+
'WHERE id = :id ORDER BY id ASC',
|
49
|
+
[
|
49
50
|
{:key => 'id',
|
50
51
|
:value => {:value => activity_id, :xsi_type => 'NumberValue'}}
|
51
|
-
]
|
52
|
-
|
52
|
+
],
|
53
|
+
1
|
54
|
+
)
|
53
55
|
|
54
|
-
page = activity_service.get_activities_by_statement(statement)
|
56
|
+
page = activity_service.get_activities_by_statement(statement.toStatement())
|
55
57
|
|
56
58
|
if page[:results]
|
57
59
|
# Get the activities.
|