google-dfp-api 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/COPYING +0 -0
- data/ChangeLog +12 -3
- data/README.md +0 -0
- data/dfp_api.yml +2 -0
- data/lib/dfp_api.rb +45 -0
- data/lib/dfp_api/api_config.rb +6 -30
- data/lib/dfp_api/credential_handler.rb +7 -2
- data/lib/dfp_api/dfp_api_datetime.rb +182 -0
- data/lib/dfp_api/dfp_api_statement.rb +9 -0
- data/lib/dfp_api/errors.rb +0 -0
- data/lib/dfp_api/pql_statement_utils.rb +193 -0
- data/lib/dfp_api/utils.rb +56 -0
- data/lib/dfp_api/utils_reporter.rb +52 -0
- data/lib/dfp_api/v201705/activity_group_service.rb +0 -0
- data/lib/dfp_api/v201705/activity_group_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/activity_service.rb +0 -0
- data/lib/dfp_api/v201705/activity_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/ad_exclusion_rule_service.rb +0 -0
- data/lib/dfp_api/v201705/ad_exclusion_rule_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/ad_rule_service.rb +0 -0
- data/lib/dfp_api/v201705/ad_rule_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/audience_segment_service.rb +0 -0
- data/lib/dfp_api/v201705/audience_segment_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/base_rate_service.rb +0 -0
- data/lib/dfp_api/v201705/base_rate_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/company_service.rb +0 -0
- data/lib/dfp_api/v201705/company_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/contact_service.rb +0 -0
- data/lib/dfp_api/v201705/contact_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/content_bundle_service.rb +0 -0
- data/lib/dfp_api/v201705/content_bundle_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/content_metadata_key_hierarchy_service.rb +0 -0
- data/lib/dfp_api/v201705/content_metadata_key_hierarchy_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/content_service.rb +0 -0
- data/lib/dfp_api/v201705/content_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/creative_service.rb +0 -0
- data/lib/dfp_api/v201705/creative_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/creative_set_service.rb +0 -0
- data/lib/dfp_api/v201705/creative_set_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/creative_template_service.rb +0 -0
- data/lib/dfp_api/v201705/creative_template_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/creative_wrapper_service.rb +0 -0
- data/lib/dfp_api/v201705/creative_wrapper_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/custom_field_service.rb +0 -0
- data/lib/dfp_api/v201705/custom_field_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/custom_targeting_service.rb +0 -0
- data/lib/dfp_api/v201705/custom_targeting_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/exchange_rate_service.rb +0 -0
- data/lib/dfp_api/v201705/exchange_rate_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/forecast_service.rb +0 -0
- data/lib/dfp_api/v201705/forecast_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/inventory_service.rb +0 -0
- data/lib/dfp_api/v201705/inventory_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/label_service.rb +0 -0
- data/lib/dfp_api/v201705/label_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/line_item_creative_association_service.rb +0 -0
- data/lib/dfp_api/v201705/line_item_creative_association_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/line_item_service.rb +0 -0
- data/lib/dfp_api/v201705/line_item_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/line_item_template_service.rb +0 -0
- data/lib/dfp_api/v201705/line_item_template_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/live_stream_event_service.rb +0 -0
- data/lib/dfp_api/v201705/live_stream_event_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/mobile_application_service.rb +0 -0
- data/lib/dfp_api/v201705/mobile_application_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/native_style_service.rb +0 -0
- data/lib/dfp_api/v201705/native_style_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/network_service.rb +0 -0
- data/lib/dfp_api/v201705/network_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/order_service.rb +0 -0
- data/lib/dfp_api/v201705/order_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/package_service.rb +0 -0
- data/lib/dfp_api/v201705/package_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/placement_service.rb +0 -0
- data/lib/dfp_api/v201705/placement_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/premium_rate_service.rb +0 -0
- data/lib/dfp_api/v201705/premium_rate_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/product_package_item_service.rb +0 -0
- data/lib/dfp_api/v201705/product_package_item_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/product_package_service.rb +0 -0
- data/lib/dfp_api/v201705/product_package_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/product_service.rb +0 -0
- data/lib/dfp_api/v201705/product_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/product_template_service.rb +0 -0
- data/lib/dfp_api/v201705/product_template_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/proposal_line_item_service.rb +0 -0
- data/lib/dfp_api/v201705/proposal_line_item_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/proposal_service.rb +0 -0
- data/lib/dfp_api/v201705/proposal_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/publisher_query_language_service.rb +0 -0
- data/lib/dfp_api/v201705/publisher_query_language_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/rate_card_service.rb +0 -0
- data/lib/dfp_api/v201705/rate_card_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/reconciliation_line_item_report_service.rb +0 -0
- data/lib/dfp_api/v201705/reconciliation_line_item_report_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/reconciliation_order_report_service.rb +0 -0
- data/lib/dfp_api/v201705/reconciliation_order_report_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/reconciliation_report_row_service.rb +0 -0
- data/lib/dfp_api/v201705/reconciliation_report_row_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/reconciliation_report_service.rb +0 -0
- data/lib/dfp_api/v201705/reconciliation_report_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/report_service.rb +0 -0
- data/lib/dfp_api/v201705/report_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/suggested_ad_unit_service.rb +0 -0
- data/lib/dfp_api/v201705/suggested_ad_unit_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/team_service.rb +0 -0
- data/lib/dfp_api/v201705/team_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/user_service.rb +0 -0
- data/lib/dfp_api/v201705/user_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/user_team_association_service.rb +0 -0
- data/lib/dfp_api/v201705/user_team_association_service_registry.rb +0 -0
- data/lib/dfp_api/v201705/workflow_request_service.rb +0 -0
- data/lib/dfp_api/v201705/workflow_request_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/activity_group_service.rb +0 -0
- data/lib/dfp_api/v201708/activity_group_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/activity_service.rb +0 -0
- data/lib/dfp_api/v201708/activity_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/ad_exclusion_rule_service.rb +0 -0
- data/lib/dfp_api/v201708/ad_exclusion_rule_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/ad_rule_service.rb +0 -0
- data/lib/dfp_api/v201708/ad_rule_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/audience_segment_service.rb +0 -0
- data/lib/dfp_api/v201708/audience_segment_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/base_rate_service.rb +0 -0
- data/lib/dfp_api/v201708/base_rate_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/company_service.rb +0 -0
- data/lib/dfp_api/v201708/company_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/contact_service.rb +0 -0
- data/lib/dfp_api/v201708/contact_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/content_bundle_service.rb +0 -0
- data/lib/dfp_api/v201708/content_bundle_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/content_metadata_key_hierarchy_service.rb +0 -0
- data/lib/dfp_api/v201708/content_metadata_key_hierarchy_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/content_service.rb +0 -0
- data/lib/dfp_api/v201708/content_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/creative_service.rb +0 -0
- data/lib/dfp_api/v201708/creative_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/creative_set_service.rb +0 -0
- data/lib/dfp_api/v201708/creative_set_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/creative_template_service.rb +0 -0
- data/lib/dfp_api/v201708/creative_template_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/creative_wrapper_service.rb +0 -0
- data/lib/dfp_api/v201708/creative_wrapper_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/custom_field_service.rb +0 -0
- data/lib/dfp_api/v201708/custom_field_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/custom_targeting_service.rb +0 -0
- data/lib/dfp_api/v201708/custom_targeting_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/exchange_rate_service.rb +0 -0
- data/lib/dfp_api/v201708/exchange_rate_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/forecast_service.rb +0 -0
- data/lib/dfp_api/v201708/forecast_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/inventory_service.rb +0 -0
- data/lib/dfp_api/v201708/inventory_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/label_service.rb +0 -0
- data/lib/dfp_api/v201708/label_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/line_item_creative_association_service.rb +0 -0
- data/lib/dfp_api/v201708/line_item_creative_association_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/line_item_service.rb +0 -0
- data/lib/dfp_api/v201708/line_item_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/line_item_template_service.rb +0 -0
- data/lib/dfp_api/v201708/line_item_template_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/live_stream_event_service.rb +0 -0
- data/lib/dfp_api/v201708/live_stream_event_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/mobile_application_service.rb +0 -0
- data/lib/dfp_api/v201708/mobile_application_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/native_style_service.rb +0 -0
- data/lib/dfp_api/v201708/native_style_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/network_service.rb +0 -0
- data/lib/dfp_api/v201708/network_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/order_service.rb +0 -0
- data/lib/dfp_api/v201708/order_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/package_service.rb +0 -0
- data/lib/dfp_api/v201708/package_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/placement_service.rb +0 -0
- data/lib/dfp_api/v201708/placement_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/premium_rate_service.rb +0 -0
- data/lib/dfp_api/v201708/premium_rate_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/product_package_item_service.rb +0 -0
- data/lib/dfp_api/v201708/product_package_item_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/product_package_service.rb +0 -0
- data/lib/dfp_api/v201708/product_package_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/product_service.rb +0 -0
- data/lib/dfp_api/v201708/product_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/product_template_service.rb +0 -0
- data/lib/dfp_api/v201708/product_template_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/proposal_line_item_service.rb +0 -0
- data/lib/dfp_api/v201708/proposal_line_item_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/proposal_service.rb +0 -0
- data/lib/dfp_api/v201708/proposal_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/publisher_query_language_service.rb +0 -0
- data/lib/dfp_api/v201708/publisher_query_language_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/rate_card_service.rb +0 -0
- data/lib/dfp_api/v201708/rate_card_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/reconciliation_line_item_report_service.rb +0 -0
- data/lib/dfp_api/v201708/reconciliation_line_item_report_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/reconciliation_order_report_service.rb +0 -0
- data/lib/dfp_api/v201708/reconciliation_order_report_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/reconciliation_report_row_service.rb +0 -0
- data/lib/dfp_api/v201708/reconciliation_report_row_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/reconciliation_report_service.rb +0 -0
- data/lib/dfp_api/v201708/reconciliation_report_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/report_service.rb +0 -0
- data/lib/dfp_api/v201708/report_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/suggested_ad_unit_service.rb +0 -0
- data/lib/dfp_api/v201708/suggested_ad_unit_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/team_service.rb +0 -0
- data/lib/dfp_api/v201708/team_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/user_service.rb +0 -0
- data/lib/dfp_api/v201708/user_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/user_team_association_service.rb +0 -0
- data/lib/dfp_api/v201708/user_team_association_service_registry.rb +0 -0
- data/lib/dfp_api/v201708/workflow_request_service.rb +0 -0
- data/lib/dfp_api/v201708/workflow_request_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/activity_group_service.rb +0 -0
- data/lib/dfp_api/v201711/activity_group_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/activity_service.rb +0 -0
- data/lib/dfp_api/v201711/activity_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/ad_exclusion_rule_service.rb +0 -0
- data/lib/dfp_api/v201711/ad_exclusion_rule_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/ad_rule_service.rb +0 -0
- data/lib/dfp_api/v201711/ad_rule_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/audience_segment_service.rb +0 -0
- data/lib/dfp_api/v201711/audience_segment_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/base_rate_service.rb +0 -0
- data/lib/dfp_api/v201711/base_rate_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/cdn_configuration_service.rb +0 -0
- data/lib/dfp_api/v201711/cdn_configuration_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/company_service.rb +0 -0
- data/lib/dfp_api/v201711/company_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/contact_service.rb +0 -0
- data/lib/dfp_api/v201711/contact_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/content_bundle_service.rb +0 -0
- data/lib/dfp_api/v201711/content_bundle_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/content_metadata_key_hierarchy_service.rb +0 -0
- data/lib/dfp_api/v201711/content_metadata_key_hierarchy_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/content_service.rb +0 -0
- data/lib/dfp_api/v201711/content_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/creative_service.rb +0 -0
- data/lib/dfp_api/v201711/creative_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/creative_set_service.rb +0 -0
- data/lib/dfp_api/v201711/creative_set_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/creative_template_service.rb +0 -0
- data/lib/dfp_api/v201711/creative_template_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/creative_wrapper_service.rb +0 -0
- data/lib/dfp_api/v201711/creative_wrapper_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/custom_field_service.rb +0 -0
- data/lib/dfp_api/v201711/custom_field_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/custom_targeting_service.rb +0 -0
- data/lib/dfp_api/v201711/custom_targeting_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/exchange_rate_service.rb +0 -0
- data/lib/dfp_api/v201711/exchange_rate_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/forecast_service.rb +0 -0
- data/lib/dfp_api/v201711/forecast_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/inventory_service.rb +0 -0
- data/lib/dfp_api/v201711/inventory_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/label_service.rb +0 -0
- data/lib/dfp_api/v201711/label_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/line_item_creative_association_service.rb +0 -0
- data/lib/dfp_api/v201711/line_item_creative_association_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/line_item_service.rb +0 -0
- data/lib/dfp_api/v201711/line_item_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/line_item_template_service.rb +0 -0
- data/lib/dfp_api/v201711/line_item_template_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/live_stream_event_service.rb +0 -0
- data/lib/dfp_api/v201711/live_stream_event_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/mobile_application_service.rb +0 -0
- data/lib/dfp_api/v201711/mobile_application_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/native_style_service.rb +0 -0
- data/lib/dfp_api/v201711/native_style_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/network_service.rb +0 -0
- data/lib/dfp_api/v201711/network_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/order_service.rb +0 -0
- data/lib/dfp_api/v201711/order_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/package_service.rb +0 -0
- data/lib/dfp_api/v201711/package_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/placement_service.rb +0 -0
- data/lib/dfp_api/v201711/placement_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/premium_rate_service.rb +0 -0
- data/lib/dfp_api/v201711/premium_rate_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/product_package_item_service.rb +0 -0
- data/lib/dfp_api/v201711/product_package_item_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/product_package_service.rb +0 -0
- data/lib/dfp_api/v201711/product_package_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/product_service.rb +0 -0
- data/lib/dfp_api/v201711/product_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/product_template_service.rb +0 -0
- data/lib/dfp_api/v201711/product_template_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/proposal_line_item_service.rb +0 -0
- data/lib/dfp_api/v201711/proposal_line_item_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/proposal_service.rb +0 -0
- data/lib/dfp_api/v201711/proposal_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/publisher_query_language_service.rb +0 -0
- data/lib/dfp_api/v201711/publisher_query_language_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/rate_card_service.rb +0 -0
- data/lib/dfp_api/v201711/rate_card_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/reconciliation_line_item_report_service.rb +0 -0
- data/lib/dfp_api/v201711/reconciliation_line_item_report_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/reconciliation_order_report_service.rb +0 -0
- data/lib/dfp_api/v201711/reconciliation_order_report_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/reconciliation_report_row_service.rb +0 -0
- data/lib/dfp_api/v201711/reconciliation_report_row_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/reconciliation_report_service.rb +0 -0
- data/lib/dfp_api/v201711/reconciliation_report_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/report_service.rb +0 -0
- data/lib/dfp_api/v201711/report_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/suggested_ad_unit_service.rb +0 -0
- data/lib/dfp_api/v201711/suggested_ad_unit_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/team_service.rb +0 -0
- data/lib/dfp_api/v201711/team_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/user_service.rb +0 -0
- data/lib/dfp_api/v201711/user_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/user_team_association_service.rb +0 -0
- data/lib/dfp_api/v201711/user_team_association_service_registry.rb +0 -0
- data/lib/dfp_api/v201711/workflow_request_service.rb +0 -0
- data/lib/dfp_api/v201711/workflow_request_service_registry.rb +0 -0
- data/lib/dfp_api/{v201702 → v201802}/activity_group_service.rb +7 -7
- data/lib/dfp_api/v201802/activity_group_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/activity_service.rb +7 -7
- data/lib/dfp_api/v201802/activity_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/ad_exclusion_rule_service.rb +7 -7
- data/lib/dfp_api/v201802/ad_exclusion_rule_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/ad_rule_service.rb +7 -7
- data/lib/dfp_api/v201802/ad_rule_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/audience_segment_service.rb +7 -7
- data/lib/dfp_api/v201802/audience_segment_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/base_rate_service.rb +7 -7
- data/lib/dfp_api/v201802/base_rate_service_registry.rb +45 -0
- data/lib/dfp_api/v201802/cdn_configuration_service.rb +54 -0
- data/lib/dfp_api/v201802/cdn_configuration_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/company_service.rb +7 -7
- data/lib/dfp_api/v201802/company_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/contact_service.rb +7 -7
- data/lib/dfp_api/v201802/contact_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/content_bundle_service.rb +7 -7
- data/lib/dfp_api/v201802/content_bundle_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/content_metadata_key_hierarchy_service.rb +7 -7
- data/lib/dfp_api/v201802/content_metadata_key_hierarchy_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/content_service.rb +7 -7
- data/lib/dfp_api/v201802/content_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/creative_service.rb +7 -7
- data/lib/dfp_api/v201802/creative_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/creative_set_service.rb +7 -7
- data/lib/dfp_api/v201802/creative_set_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/creative_template_service.rb +7 -7
- data/lib/dfp_api/v201802/creative_template_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/creative_wrapper_service.rb +7 -7
- data/lib/dfp_api/v201802/creative_wrapper_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/custom_field_service.rb +7 -7
- data/lib/dfp_api/v201802/custom_field_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/custom_targeting_service.rb +7 -7
- data/lib/dfp_api/v201802/custom_targeting_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/exchange_rate_service.rb +7 -7
- data/lib/dfp_api/v201802/exchange_rate_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/forecast_service.rb +7 -7
- data/lib/dfp_api/v201802/forecast_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/inventory_service.rb +7 -7
- data/lib/dfp_api/v201802/inventory_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/label_service.rb +7 -7
- data/lib/dfp_api/v201802/label_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/line_item_creative_association_service.rb +15 -7
- data/lib/dfp_api/{v201702 → v201802}/line_item_creative_association_service_registry.rb +5 -5
- data/lib/dfp_api/{v201702 → v201802}/line_item_service.rb +7 -7
- data/lib/dfp_api/v201802/line_item_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/line_item_template_service.rb +7 -7
- data/lib/dfp_api/v201802/line_item_template_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/live_stream_event_service.rb +7 -7
- data/lib/dfp_api/v201802/live_stream_event_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/mobile_application_service.rb +7 -7
- data/lib/dfp_api/v201802/mobile_application_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/native_style_service.rb +7 -7
- data/lib/dfp_api/v201802/native_style_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/network_service.rb +7 -7
- data/lib/dfp_api/v201802/network_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/order_service.rb +7 -7
- data/lib/dfp_api/v201802/order_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/package_service.rb +7 -7
- data/lib/dfp_api/v201802/package_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/placement_service.rb +7 -7
- data/lib/dfp_api/v201802/placement_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/premium_rate_service.rb +7 -7
- data/lib/dfp_api/v201802/premium_rate_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/product_package_item_service.rb +7 -7
- data/lib/dfp_api/v201802/product_package_item_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/product_package_service.rb +7 -7
- data/lib/dfp_api/v201802/product_package_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/product_service.rb +7 -7
- data/lib/dfp_api/v201802/product_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/product_template_service.rb +7 -7
- data/lib/dfp_api/v201802/product_template_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/proposal_line_item_service.rb +7 -7
- data/lib/dfp_api/v201802/proposal_line_item_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/proposal_service.rb +7 -7
- data/lib/dfp_api/v201802/proposal_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/publisher_query_language_service.rb +7 -7
- data/lib/dfp_api/v201802/publisher_query_language_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/rate_card_service.rb +7 -7
- data/lib/dfp_api/v201802/rate_card_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/reconciliation_line_item_report_service.rb +7 -7
- data/lib/dfp_api/v201802/reconciliation_line_item_report_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/reconciliation_order_report_service.rb +7 -7
- data/lib/dfp_api/v201802/reconciliation_order_report_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/reconciliation_report_row_service.rb +7 -7
- data/lib/dfp_api/v201802/reconciliation_report_row_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/reconciliation_report_service.rb +7 -7
- data/lib/dfp_api/v201802/reconciliation_report_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/report_service.rb +7 -7
- data/lib/dfp_api/v201802/report_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/suggested_ad_unit_service.rb +7 -7
- data/lib/dfp_api/v201802/suggested_ad_unit_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/team_service.rb +15 -7
- data/lib/dfp_api/v201802/team_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/user_service.rb +7 -7
- data/lib/dfp_api/v201802/user_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/user_team_association_service.rb +7 -7
- data/lib/dfp_api/v201802/user_team_association_service_registry.rb +45 -0
- data/lib/dfp_api/{v201702 → v201802}/workflow_request_service.rb +7 -7
- data/lib/dfp_api/v201802/workflow_request_service_registry.rb +45 -0
- data/lib/dfp_api/version.rb +1 -1
- metadata +122 -102
- data/lib/dfp_api/v201702/activity_group_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/activity_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/ad_exclusion_rule_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/ad_rule_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/audience_segment_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/base_rate_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/company_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/contact_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/content_bundle_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/content_metadata_key_hierarchy_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/content_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/creative_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/creative_set_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/creative_template_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/creative_wrapper_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/custom_field_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/custom_targeting_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/exchange_rate_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/forecast_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/inventory_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/label_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/line_item_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/line_item_template_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/live_stream_event_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/mobile_application_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/native_style_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/network_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/order_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/package_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/placement_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/premium_rate_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/product_package_item_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/product_package_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/product_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/product_template_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/proposal_line_item_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/proposal_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/publisher_query_language_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/rate_card_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/reconciliation_line_item_report_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/reconciliation_order_report_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/reconciliation_report_row_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/reconciliation_report_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/report_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/suggested_ad_unit_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/team_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/user_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/user_team_association_service_registry.rb +0 -45
- data/lib/dfp_api/v201702/workflow_request_service_registry.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76dcba9593eb8099843bdbfd4f5e0667fe68083b
|
4
|
+
data.tar.gz: e34fe0017255d433493d10a7490b32b167ee054b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef6fa87936a5079b73923bc26f9d10441586ce19e76672004f8a3c16af79d407b436a094cf39506465baa146d86c65dd95afdf792f9e43f19dff124fc388b1fc
|
7
|
+
data.tar.gz: 71117d2b974fd3e351ee58d8038057addaa8a722d64a3c765399b8e514fe7d681dd409d29440ac316b63f9c1301a27d9d1098e4c4f51fa639811ef961bcda521
|
data/COPYING
CHANGED
File without changes
|
data/ChangeLog
CHANGED
@@ -1,7 +1,16 @@
|
|
1
|
+
1.2.0:
|
2
|
+
- Added support for v201802.
|
3
|
+
- Removed support for v201702.
|
4
|
+
- Removed examples for v201705.
|
5
|
+
- Added StatementBuilder for easier PQL statement generation.
|
6
|
+
- Added DfpDate and DfpDateTime to make using Date and Time objects easier
|
7
|
+
in the DFP API.
|
8
|
+
- Deprecated FilterStatement.
|
9
|
+
|
1
10
|
1.1.0:
|
2
|
-
- Added support for v201711
|
3
|
-
- Removed support for v201611
|
4
|
-
- Removed examples for v201702
|
11
|
+
- Added support for v201711.
|
12
|
+
- Removed support for v201611.
|
13
|
+
- Removed examples for v201702.
|
5
14
|
|
6
15
|
1.0.0:
|
7
16
|
- Major version bump. The library has been stable and feature complete for
|
data/README.md
CHANGED
File without changes
|
data/dfp_api.yml
CHANGED
data/lib/dfp_api.rb
CHANGED
@@ -23,6 +23,9 @@ require 'dfp_api/api_config'
|
|
23
23
|
require 'dfp_api/credential_handler'
|
24
24
|
require 'dfp_api/errors'
|
25
25
|
require 'dfp_api/dfp_api_statement'
|
26
|
+
require 'dfp_api/dfp_api_datetime'
|
27
|
+
require 'dfp_api/pql_statement_utils'
|
28
|
+
require 'dfp_api/utils_reporter'
|
26
29
|
|
27
30
|
# Main namespace for all the client library's modules and classes.
|
28
31
|
module DfpApi
|
@@ -32,10 +35,13 @@ module DfpApi
|
|
32
35
|
# Holds all the services, as well as login credentials.
|
33
36
|
#
|
34
37
|
class Api < AdsCommon::Api
|
38
|
+
attr_reader :utils_reporter
|
39
|
+
|
35
40
|
# Constructor for API.
|
36
41
|
def initialize(provided_config = nil)
|
37
42
|
super(provided_config)
|
38
43
|
@credential_handler = DfpApi::CredentialHandler.new(@config)
|
44
|
+
@utils_reporter = DfpApi::UtilsReporter.new(@credential_handler)
|
39
45
|
end
|
40
46
|
|
41
47
|
# Getter for the API service configurations.
|
@@ -43,6 +49,45 @@ module DfpApi
|
|
43
49
|
DfpApi::ApiConfig
|
44
50
|
end
|
45
51
|
|
52
|
+
# Returns an instance of StatementBuilder object.
|
53
|
+
def new_statement_builder(&block)
|
54
|
+
return DfpApi::StatementBuilder.new(self, &block)
|
55
|
+
end
|
56
|
+
|
57
|
+
def new_report_statement_builder(&block)
|
58
|
+
statement = DfpApi::StatementBuilder.new(self) do |sb|
|
59
|
+
sb.limit = nil
|
60
|
+
sb.offset = nil
|
61
|
+
end
|
62
|
+
statement.configure(&block)
|
63
|
+
return statement
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns an instance of DfpDate.
|
67
|
+
def date(*args)
|
68
|
+
return DfpApi::DfpDate.new(self, *args)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Returns an instance of DfpDate representing the current day.
|
72
|
+
def today(*args)
|
73
|
+
return DfpApi::DfpDate.today(self, *args)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Returns an instance of DfpDateTime.
|
77
|
+
def datetime(*args)
|
78
|
+
return DfpApi::DfpDateTime.new(self, *args)
|
79
|
+
end
|
80
|
+
|
81
|
+
# Returns an instance of DfpDateTime representing the current time.
|
82
|
+
def now(*args)
|
83
|
+
return DfpApi::DfpDateTime.now(self, *args)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Returns an instance of DfpDateTime in the UTC timezone.
|
87
|
+
def utc(*args)
|
88
|
+
return DfpApi::DfpDateTime.utc(self, *args)
|
89
|
+
end
|
90
|
+
|
46
91
|
private
|
47
92
|
|
48
93
|
# Retrieve DFP HeaderHandler per credential.
|
data/lib/dfp_api/api_config.rb
CHANGED
@@ -31,8 +31,8 @@ module DfpApi
|
|
31
31
|
end
|
32
32
|
|
33
33
|
# Set defaults
|
34
|
-
DEFAULT_VERSION = :
|
35
|
-
LATEST_VERSION = :
|
34
|
+
DEFAULT_VERSION = :v201802
|
35
|
+
LATEST_VERSION = :v201802
|
36
36
|
|
37
37
|
# Set other constants
|
38
38
|
API_NAME = 'DfpApi'
|
@@ -40,30 +40,6 @@ module DfpApi
|
|
40
40
|
|
41
41
|
# Configure the services available to each version
|
42
42
|
@@service_config = {
|
43
|
-
:v201702 => [:ActivityGroupService, :ActivityService,
|
44
|
-
:AdExclusionRuleService, :AdRuleService,
|
45
|
-
:AudienceSegmentService, :BaseRateService, :CompanyService,
|
46
|
-
:ContactService, :ContentBundleService,
|
47
|
-
:ContentMetadataKeyHierarchyService, :ContentService,
|
48
|
-
:CreativeService, :CreativeSetService,
|
49
|
-
:CreativeTemplateService, :CreativeWrapperService,
|
50
|
-
:CustomFieldService, :CustomTargetingService,
|
51
|
-
:ExchangeRateService, :ForecastService, :InventoryService,
|
52
|
-
:LabelService, :LineItemCreativeAssociationService,
|
53
|
-
:LineItemService, :LineItemTemplateService,
|
54
|
-
:LiveStreamEventService, :MobileApplicationService,
|
55
|
-
:NativeStyleService, :NetworkService, :OrderService,
|
56
|
-
:PackageService, :ProductPackageService,
|
57
|
-
:ProductPackageItemService, :PlacementService,
|
58
|
-
:PremiumRateService, :ProductService,
|
59
|
-
:ProductTemplateService, :ProposalLineItemService,
|
60
|
-
:ProposalService, :PublisherQueryLanguageService,
|
61
|
-
:RateCardService, :ReconciliationOrderReportService,
|
62
|
-
:ReconciliationLineItemReportService,
|
63
|
-
:ReconciliationReportRowService,
|
64
|
-
:ReconciliationReportService, :ReportService,
|
65
|
-
:SuggestedAdUnitService, :TeamService, :UserService,
|
66
|
-
:UserTeamAssociationService, :WorkflowRequestService],
|
67
43
|
:v201705 => [:ActivityGroupService, :ActivityService,
|
68
44
|
:AdExclusionRuleService, :AdRuleService,
|
69
45
|
:AudienceSegmentService, :BaseRateService, :CompanyService,
|
@@ -136,7 +112,7 @@ module DfpApi
|
|
136
112
|
:ReconciliationReportService, :ReportService,
|
137
113
|
:SuggestedAdUnitService, :TeamService, :UserService,
|
138
114
|
:UserTeamAssociationService, :WorkflowRequestService],
|
139
|
-
:
|
115
|
+
:v201802 => [:ActivityGroupService, :ActivityService,
|
140
116
|
:AdExclusionRuleService, :AdRuleService,
|
141
117
|
:AudienceSegmentService, :BaseRateService, :CompanyService,
|
142
118
|
:CdnConfigurationService, :ContactService,
|
@@ -159,17 +135,17 @@ module DfpApi
|
|
159
135
|
:ReconciliationReportRowService,
|
160
136
|
:ReconciliationReportService, :ReportService,
|
161
137
|
:SuggestedAdUnitService, :TeamService, :UserService,
|
162
|
-
:UserTeamAssociationService, :WorkflowRequestService]
|
138
|
+
:UserTeamAssociationService, :WorkflowRequestService]
|
163
139
|
}
|
164
140
|
|
165
141
|
# Configure the base URL for each version and scope.
|
166
142
|
@@config = {
|
167
143
|
:oauth_scope => 'https://www.googleapis.com/auth/dfp',
|
168
144
|
:header_ns => 'https://www.google.com/apis/ads/publisher/',
|
169
|
-
:v201702 => 'https://ads.google.com/apis/ads/publisher/',
|
170
145
|
:v201705 => 'https://ads.google.com/apis/ads/publisher/',
|
171
146
|
:v201708 => 'https://ads.google.com/apis/ads/publisher/',
|
172
|
-
:v201711 => 'https://ads.google.com/apis/ads/publisher/'
|
147
|
+
:v201711 => 'https://ads.google.com/apis/ads/publisher/',
|
148
|
+
:v201802 => 'https://ads.google.com/apis/ads/publisher/'
|
173
149
|
}
|
174
150
|
|
175
151
|
public
|
@@ -19,6 +19,7 @@
|
|
19
19
|
|
20
20
|
require 'ads_common/credential_handler'
|
21
21
|
require 'dfp_api/api_config'
|
22
|
+
require 'dfp_api/utils'
|
22
23
|
|
23
24
|
module DfpApi
|
24
25
|
|
@@ -31,17 +32,21 @@ module DfpApi
|
|
31
32
|
def credentials(credentials_override = nil)
|
32
33
|
result = super(credentials_override)
|
33
34
|
validate_headers_for_server(result)
|
35
|
+
include_utils = @config.read('library.include_utilities_in_user_agent',
|
36
|
+
true)
|
34
37
|
result[:extra_headers] = {
|
35
|
-
'applicationName' => generate_user_agent(),
|
38
|
+
'applicationName' => generate_user_agent([], include_utils),
|
36
39
|
'networkCode' => result[:network_code]
|
37
40
|
}
|
38
41
|
return result
|
39
42
|
end
|
40
43
|
|
41
44
|
# Generates string to use as user agent in headers.
|
42
|
-
def generate_user_agent(extra_ids = [])
|
45
|
+
def generate_user_agent(extra_ids = [], include_utilities = true)
|
43
46
|
agent_app = @config.read('authentication.application_name')
|
44
47
|
extra_ids << ["DfpApi-Ruby/%s" % DfpApi::ApiConfig::CLIENT_LIB_VERSION]
|
48
|
+
utility_registry = DfpApi::Utils::UtilityRegistry.instance
|
49
|
+
extra_ids += utility_registry.extract!.to_a if include_utilities
|
45
50
|
super(extra_ids, agent_app)
|
46
51
|
end
|
47
52
|
|
@@ -0,0 +1,182 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright 2017, Google Inc. All Rights Reserved.
|
4
|
+
#
|
5
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
14
|
+
# implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
# DfpDate and DfpDateTime convert between native ruby Date and Time objects and
|
19
|
+
# the DFP API's Date and DateTime objects.
|
20
|
+
|
21
|
+
require 'date'
|
22
|
+
require 'tzinfo'
|
23
|
+
|
24
|
+
|
25
|
+
module DfpApi
|
26
|
+
class DfpDate
|
27
|
+
# Create a new DfpDate, a utility class that allows for interoperability
|
28
|
+
# between the DFP API's Date objects and ruby's Date class.
|
29
|
+
#
|
30
|
+
# Args:
|
31
|
+
# - args:
|
32
|
+
# - ([year, [month, [day]]]), integer values, uses Date defaults
|
33
|
+
# - (date), a native ruby Date object
|
34
|
+
# - (dfp_date), a DFP Date hash representation
|
35
|
+
# Returns:
|
36
|
+
# - dfp_date: an instance of DfpDate
|
37
|
+
def initialize(api, *args)
|
38
|
+
@api = api
|
39
|
+
@api.utils_reporter.dfp_date_used()
|
40
|
+
|
41
|
+
case args.first
|
42
|
+
when Hash
|
43
|
+
hash = args.first
|
44
|
+
date_args = [hash[:year], hash[:month], hash[:day]]
|
45
|
+
when Date
|
46
|
+
date = args.first
|
47
|
+
date_args = [date.year, date.month, date.day]
|
48
|
+
else
|
49
|
+
date_args = args
|
50
|
+
end
|
51
|
+
@date = Date.new(*date_args)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Creates a DfpDate object denoting the present day.
|
55
|
+
def self.today(api, *args)
|
56
|
+
self.new(api, Date.today(*args))
|
57
|
+
end
|
58
|
+
|
59
|
+
# When an unrecognized method is applied to DfpDate, pass it through to the
|
60
|
+
# internal ruby Date.
|
61
|
+
def method_missing(name, *args, &block)
|
62
|
+
result = @date.send(name, *args, &block)
|
63
|
+
return self.class.new(@api, result) if result.is_a? Date
|
64
|
+
return result
|
65
|
+
end
|
66
|
+
|
67
|
+
# Convert DfpDate into a hash representation which can be consumed by
|
68
|
+
# the DFP API. E.g., a hash that can be passed as PQL Date variables.
|
69
|
+
#
|
70
|
+
# Returns:
|
71
|
+
# - dfp_datetime: a DFP Date hash representation
|
72
|
+
def to_h()
|
73
|
+
return {:year => @date.year, :month => @date.month, :day => @date.day}
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class DfpDateTime
|
78
|
+
attr_accessor :timezone
|
79
|
+
|
80
|
+
# Create a new DfpDateTime, a utility class that allows for interoperability
|
81
|
+
# between the DFP API's DateTime objects and ruby's Time class. The last
|
82
|
+
# argument must be a valid timezone identifier, e.g. "America/New_York".
|
83
|
+
#
|
84
|
+
# Args:
|
85
|
+
# - args:
|
86
|
+
# - ([year, [month, [day, [hour, [minute, [second,]]]]]] timezone)
|
87
|
+
# - (time, timezone), a native Time object and a timezone identifier
|
88
|
+
# - (dfp_datetime), a DFP DateTime hash representation
|
89
|
+
#
|
90
|
+
# Returns:
|
91
|
+
# - dfp_datetime: an instance of DfpDateTime
|
92
|
+
def initialize(api, *args)
|
93
|
+
@api = api
|
94
|
+
@api.utils_reporter.dfp_date_time_used()
|
95
|
+
|
96
|
+
# Handle special cases when a DFP DateTime hash or ruby Time instance are
|
97
|
+
# passed as the first argument to the constructor.
|
98
|
+
case args.first
|
99
|
+
when Hash
|
100
|
+
hash = args.first
|
101
|
+
datetime_args = [hash[:date][:year], hash[:date][:month],
|
102
|
+
hash[:date][:day], hash[:hour], hash[:minute], hash[:second],
|
103
|
+
hash[:time_zone_id]]
|
104
|
+
when DfpDateTime, Time, DateTime
|
105
|
+
time = args.first
|
106
|
+
datetime_args = [args.last]
|
107
|
+
[:sec, :min, :hour, :day, :month, :year].each do |duration|
|
108
|
+
datetime_args.unshift(time.send(duration))
|
109
|
+
end
|
110
|
+
else
|
111
|
+
datetime_args = args
|
112
|
+
end
|
113
|
+
# Check the validity of the timezone parameter, which is required.
|
114
|
+
if not TZInfo::Timezone.all_identifiers.include?(datetime_args.last)
|
115
|
+
raise "Last argument to DfpDateTime constructor must be valid timezone"
|
116
|
+
end
|
117
|
+
# Set timezone attribute and pass its utc offset into the Time
|
118
|
+
# constructor.
|
119
|
+
@timezone = TZInfo::Timezone.get(datetime_args.pop)
|
120
|
+
@time = Time.new(*datetime_args,
|
121
|
+
utc_offset=@timezone.current_period.utc_offset)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Create a DfpDateTime for the current time in the specified timezone.
|
125
|
+
#
|
126
|
+
# Args:
|
127
|
+
# - timezone: a valid timezone identifier, e.g. "America/New_York"
|
128
|
+
#
|
129
|
+
# Returns:
|
130
|
+
# - dfp_datetime: an instance of DfpDateTime
|
131
|
+
def self.now(api, timezone)
|
132
|
+
new(api, TZInfo::Timezone.get(timezone).now, timezone)
|
133
|
+
end
|
134
|
+
|
135
|
+
# Create a DfpDateTime in the "UTC" timezone. Calls the DfpDateTime
|
136
|
+
# contstructor with timezone identifier "UTC".
|
137
|
+
#
|
138
|
+
# Args:
|
139
|
+
# - ([year, [month, [day, [hour, [minute, [second]]]]]])
|
140
|
+
#
|
141
|
+
# Returns:
|
142
|
+
# - dfp_datetime: an instance of DfpDateTime
|
143
|
+
def self.utc(api, *args)
|
144
|
+
new(api, *args + ['UTC'])
|
145
|
+
end
|
146
|
+
|
147
|
+
# Convert DfpDateTime into a hash representation which can be consumed by
|
148
|
+
# the DFP API. E.g., a hash that can be passed as PQL DateTime variables.
|
149
|
+
#
|
150
|
+
# Returns:
|
151
|
+
# - dfp_datetime_hash: a hash representation of a DfpDateTime
|
152
|
+
def to_h
|
153
|
+
{
|
154
|
+
:date => DfpApi::DfpDate.new(
|
155
|
+
@api, @time.year, @time.month, @time.day
|
156
|
+
).to_h,
|
157
|
+
:hour => @time.hour,
|
158
|
+
:minute => @time.min,
|
159
|
+
:second => @time.sec,
|
160
|
+
:time_zone_id => @timezone.identifier
|
161
|
+
}
|
162
|
+
end
|
163
|
+
|
164
|
+
# When an unrecognized method is applied to DfpDateTime, pass it through to
|
165
|
+
# the internal ruby Time.
|
166
|
+
def method_missing(name, *args, &block)
|
167
|
+
# Restrict time zone related functions from being passed to internal ruby
|
168
|
+
# Time attribute, since DfpDateTime handles timezones its own way
|
169
|
+
restricted_functions = [:dst?, :getgm, :getlocal, :getutc, :gmt,
|
170
|
+
:gmtime, :gmtoff, :isdst, :localtime, :utc]
|
171
|
+
if restricted_functions.include? name
|
172
|
+
raise NoMethodError, 'undefined method %s for %s' % [name, self]
|
173
|
+
end
|
174
|
+
result = @time.send(name, *args, &block)
|
175
|
+
if result.is_a? Time
|
176
|
+
return self.class.new(@api, result, @timezone.identifier)
|
177
|
+
else
|
178
|
+
return result
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
@@ -23,6 +23,7 @@ module DfpApi
|
|
23
23
|
SUGGESTED_PAGE_LIMIT = 500
|
24
24
|
|
25
25
|
# A statement object for PQL and get*ByStatement queries.
|
26
|
+
# Deprecated. Use StatementBuilder instead.
|
26
27
|
class FilterStatement
|
27
28
|
# Constructor for a Filter Statement.
|
28
29
|
def initialize(query_statement='', values=[], limit=SUGGESTED_PAGE_LIMIT,
|
@@ -37,17 +38,25 @@ module DfpApi
|
|
37
38
|
attr_accessor :offset
|
38
39
|
|
39
40
|
def toStatement()
|
41
|
+
register_filter_statement_util()
|
40
42
|
statement = @query_statement + ' LIMIT %d OFFSET %d' % [@limit, @offset]
|
41
43
|
return {:query => statement, :values => @values}
|
42
44
|
end
|
43
45
|
|
44
46
|
def toStatementForAction()
|
47
|
+
register_filter_statement_util()
|
45
48
|
return {:query => @query_statement.dup(), :values => @values}
|
46
49
|
end
|
47
50
|
|
48
51
|
def toStatementWithoutOffset()
|
52
|
+
register_filter_statement_util()
|
49
53
|
statement = @query_statement + ' LIMIT %d' % [@limit]
|
50
54
|
return {:query => statement, :values => @values}
|
51
55
|
end
|
56
|
+
|
57
|
+
private
|
58
|
+
def register_filter_statement_util()
|
59
|
+
DfpApi::Utils::UtilityRegistry.instance.add('FilterStatement')
|
60
|
+
end
|
52
61
|
end
|
53
62
|
end
|
data/lib/dfp_api/errors.rb
CHANGED
File without changes
|
@@ -0,0 +1,193 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright 2017, Google Inc. All Rights Reserved.
|
4
|
+
#
|
5
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
14
|
+
# implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
# StatementBuilder object to allow for simpler PQL statement generation.
|
19
|
+
|
20
|
+
require 'dfp_api/dfp_api_datetime'
|
21
|
+
|
22
|
+
|
23
|
+
module DfpApi
|
24
|
+
# Default page size to use with the StatementBuilder.
|
25
|
+
SUGGESTED_PAGE_LIMIT = 500
|
26
|
+
|
27
|
+
# Query class used by StatementBuilder.
|
28
|
+
class PQLQuery
|
29
|
+
# Create a new query.
|
30
|
+
def initialize(query = nil)
|
31
|
+
@query = (query.nil?) ? nil : query.dup()
|
32
|
+
end
|
33
|
+
|
34
|
+
# Concatenate a new clause onto the current query.
|
35
|
+
def <<(clause)
|
36
|
+
@query = (@query.nil?) ? clause : @query << ' ' << clause
|
37
|
+
end
|
38
|
+
|
39
|
+
# Return the query string for a PQLQuery
|
40
|
+
def to_s()
|
41
|
+
@query.dup()
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Values class used by StatementBuilder.
|
46
|
+
class PQLValues
|
47
|
+
VALUE_TYPES = {
|
48
|
+
Numeric => 'NumberValue',
|
49
|
+
Integer => 'NumberValue',
|
50
|
+
Float => 'NumberValue',
|
51
|
+
String => 'TextValue',
|
52
|
+
TrueClass => 'BooleanValue',
|
53
|
+
FalseClass => 'BooleanValue',
|
54
|
+
Array => 'SetValue',
|
55
|
+
DfpApi::DfpDate => 'DateValue',
|
56
|
+
DfpApi::DfpDateTime => 'DateTimeValue'
|
57
|
+
}
|
58
|
+
|
59
|
+
# Create a new values object.
|
60
|
+
def initialize(values = {})
|
61
|
+
@values = values || {}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Add a value to the current values object on the provided key.
|
65
|
+
def add_value(key, value)
|
66
|
+
@values[key.to_sym] = generate_value_object(value)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Get values as an array, the format the DFP API expects.
|
70
|
+
def values()
|
71
|
+
# values_array is a DFP compliant list of values of the following form:
|
72
|
+
# [:key => ..., :value => {:xsi_type => ..., :value => ...}]
|
73
|
+
values_array = @values.map do |key, value|
|
74
|
+
raise 'Missing value in StatementBuilder.' if value.nil?
|
75
|
+
raise 'Value cannot be nil on StatementBuilder.' if value[:value].nil?
|
76
|
+
raise 'Missing value type for %s.' % key if value[:xsi_type].nil?
|
77
|
+
unless VALUE_TYPES.values.include?(value[:xsi_type])
|
78
|
+
raise 'Unknown value type for %s.' % key
|
79
|
+
end
|
80
|
+
if value[:xsi_type] == 'SetValue'
|
81
|
+
if value[:value].map {|v| v.class}.to_set.size > 1
|
82
|
+
raise 'Cannot pass more than one type in set variable, %s.' % key
|
83
|
+
end
|
84
|
+
end
|
85
|
+
if value[:xsi_type] == 'DateTimeValue'
|
86
|
+
unless value[:value][:time_zone_id]
|
87
|
+
raise 'Missing timezone on DateTimeValue variable, %s.' %key
|
88
|
+
end
|
89
|
+
end
|
90
|
+
{:key => key.to_s(), :value => value}
|
91
|
+
end
|
92
|
+
return values_array
|
93
|
+
end
|
94
|
+
|
95
|
+
# Create an individual value object by inferring the xsi_type. If the value
|
96
|
+
# type isn't recognized, return the original value parameter.
|
97
|
+
def generate_value_object(value)
|
98
|
+
type = VALUE_TYPES[value.class]
|
99
|
+
if [DfpApi::DfpDate, DfpApi::DfpDateTime].include?(value.class)
|
100
|
+
value = value.to_h
|
101
|
+
end
|
102
|
+
return value if type.nil?
|
103
|
+
return {:xsi_type => type, :value => value}
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# A utility class for building PQL statements, used by the
|
108
|
+
# PublisherQueryLanguageService and other services' get*ByStatement and
|
109
|
+
# perform*Action requsts.
|
110
|
+
#
|
111
|
+
# Example usage:
|
112
|
+
# sb = DfpApi::StatementBuilder.new do |b|
|
113
|
+
# b.select = 'ChangeDateTime, EntityId, EntityType, Operation'
|
114
|
+
# b.from = 'Change_History'
|
115
|
+
# b.where = 'ChangeDateTime < :start_date_time ' +
|
116
|
+
# 'AND ChangeDateTime > :end_date_time'
|
117
|
+
# b.with_bind_variable('start_date_time', DfpApi::DfpDate.today-1)
|
118
|
+
# b.with_bind_variable('end_date_time', DfpApi::Date.today)
|
119
|
+
# b.order_by = 'ChangeDateTime'
|
120
|
+
# b.ascending = false
|
121
|
+
# end
|
122
|
+
# sb.to_statement()
|
123
|
+
#
|
124
|
+
class StatementBuilder
|
125
|
+
SELECT = 'SELECT %s'
|
126
|
+
FROM = 'FROM %s'
|
127
|
+
WHERE = 'WHERE %s'
|
128
|
+
ORDER = 'ORDER BY %s %s'
|
129
|
+
LIMIT = 'LIMIT %d'
|
130
|
+
OFFSET = 'OFFSET %d'
|
131
|
+
|
132
|
+
attr_accessor :select, :from, :where, :order_by, :ascending, :limit, :offset
|
133
|
+
|
134
|
+
# Create a StatementBuilder object.
|
135
|
+
def initialize(api, &block)
|
136
|
+
@api = api
|
137
|
+
@select = nil
|
138
|
+
@from = nil
|
139
|
+
@where = nil
|
140
|
+
@order_by = nil
|
141
|
+
@ascending = true
|
142
|
+
@limit = SUGGESTED_PAGE_LIMIT
|
143
|
+
@offset = 0
|
144
|
+
@pql_values = PQLValues.new
|
145
|
+
yield self if block_given?
|
146
|
+
end
|
147
|
+
|
148
|
+
# Edit a StatmentBuilder object with a block.
|
149
|
+
def configure(&block)
|
150
|
+
yield self
|
151
|
+
end
|
152
|
+
|
153
|
+
# Add a value to be matched to bind a variable in WHERE conditions.
|
154
|
+
def with_bind_variable(key, value)
|
155
|
+
@pql_values.add_value(key, value)
|
156
|
+
return self
|
157
|
+
end
|
158
|
+
|
159
|
+
# Return a list of validation errors.
|
160
|
+
def validate()
|
161
|
+
if !@select.to_s.strip.empty? and @from.to_s.strip.empty?
|
162
|
+
raise 'FROM clause is required with SELECT'
|
163
|
+
end
|
164
|
+
if !@from.to_s.strip.empty? and @select.to_s.strip.empty?
|
165
|
+
raise 'SELECT clause is required with FROM'
|
166
|
+
end
|
167
|
+
if !@offset.nil? and @limit.nil?
|
168
|
+
raise 'LIMIT clause is required with OFFSET'
|
169
|
+
end
|
170
|
+
unless @limit.is_a? Integer or @limit.nil?
|
171
|
+
raise 'LIMIT must be an integer'
|
172
|
+
end
|
173
|
+
unless @offset.is_a? Integer or @offset.nil?
|
174
|
+
raise 'OFFSET must be an integer'
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Create a statement object that can be sent in a DFP API request.
|
179
|
+
def to_statement()
|
180
|
+
@api.utils_reporter.statement_builder_used()
|
181
|
+
validate()
|
182
|
+
ordering = @ascending ? 'ASC' : 'DESC'
|
183
|
+
pql_query = PQLQuery.new
|
184
|
+
pql_query << SELECT % @select unless @select.to_s.empty?
|
185
|
+
pql_query << FROM % @from unless @from.to_s.empty?
|
186
|
+
pql_query << WHERE % @where unless @where.to_s.empty?
|
187
|
+
pql_query << ORDER % [@order_by, ordering] unless @order_by.to_s.empty?
|
188
|
+
pql_query << LIMIT % @limit unless @limit.nil?
|
189
|
+
pql_query << OFFSET % @offset unless @offset.nil?
|
190
|
+
return {:query => pql_query.to_s(), :values => @pql_values.values}
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|