From a36667227509db43a37ea8fe32d1710464f7eb4d Mon Sep 17 00:00:00 2001 From: Yuehui Wang Date: Tue, 18 Jul 2017 14:26:41 -0700 Subject: [PATCH] Ads SDK v2.10 Release --- lib/facebook_ads/ad_objects/ad.rb | 4 + lib/facebook_ads/ad_objects/ad_account.rb | 27 ++--- .../ad_account_delivery_estimate.rb | 63 +++++++++++ .../ad_account_targeting_unified.rb | 7 +- .../ad_objects/ad_async_request.rb | 1 + .../ad_campaign_delivery_estimate.rb | 63 +++++++++++ lib/facebook_ads/ad_objects/ad_creative.rb | 1 + .../ad_objects/ad_creative_link_data.rb | 2 + .../ad_creative_link_data_call_to_action.rb | 1 + .../ad_objects/ad_creative_video_data.rb | 2 + lib/facebook_ads/ad_objects/ad_image.rb | 4 +- lib/facebook_ads/ad_objects/ad_preview.rb | 2 + lib/facebook_ads/ad_objects/ad_report_run.rb | 1 + lib/facebook_ads/ad_objects/ad_set.rb | 19 +++- lib/facebook_ads/ad_objects/ad_study.rb | 3 +- .../ad_objects/ad_study_objective.rb | 1 + .../ad_objects/ads_action_stats.rb | 1 + .../ad_objects/ads_image_crops.rb | 1 + lib/facebook_ads/ad_objects/ads_insights.rb | 28 ++--- lib/facebook_ads/ad_objects/ads_pixel.rb | 5 +- .../ad_objects/ads_pixel_stats.rb | 1 + lib/facebook_ads/ad_objects/business.rb | 6 +- lib/facebook_ads/ad_objects/campaign.rb | 13 +++ .../ad_objects/check_batch_request_status.rb | 40 +++++++ .../ad_objects/custom_audience.rb | 6 +- .../ad_objects/custom_audience_data_source.rb | 2 + .../ad_objects/custom_conversion.rb | 11 +- lib/facebook_ads/ad_objects/event.rb | 4 + .../ad_objects/lead_gen_question.rb | 3 + lib/facebook_ads/ad_objects/leadgen_form.rb | 1 + .../ad_objects/product_catalog.rb | 14 ++- lib/facebook_ads/ad_objects/product_feed.rb | 2 + .../ad_objects/product_feed_schedule.rb | 1 + lib/facebook_ads/ad_objects/product_group.rb | 2 +- lib/facebook_ads/ad_objects/product_item.rb | 3 +- lib/facebook_ads/ad_objects/reach_estimate.rb | 1 + .../ad_objects/reach_frequency_prediction.rb | 2 +- .../ad_objects/reach_frequency_spec.rb | 1 + lib/facebook_ads/ad_objects/targeting.rb | 2 +- lib/facebook_ads/ad_objects/transaction.rb | 1 + lib/facebook_ads/ad_objects/user.rb | 3 + lib/facebook_ads/field_types/object.rb | 2 +- lib/facebook_ads/test.rb | 23 ++++ lib/facebook_ads/test/base.rb | 98 ++++++++++++++++ lib/facebook_ads/test/config.rb | 55 +++++++++ lib/facebook_ads/test/errors.rb | 23 ++++ lib/facebook_ads/test/exit_codes.rb | 29 +++++ lib/facebook_ads/test/exit_hook.rb | 35 ++++++ lib/facebook_ads/test/fixtures.rb | 107 ++++++++++++++++++ lib/facebook_ads/version.rb | 4 +- 50 files changed, 678 insertions(+), 53 deletions(-) create mode 100644 lib/facebook_ads/ad_objects/ad_account_delivery_estimate.rb create mode 100644 lib/facebook_ads/ad_objects/ad_campaign_delivery_estimate.rb create mode 100644 lib/facebook_ads/ad_objects/check_batch_request_status.rb create mode 100644 lib/facebook_ads/test.rb create mode 100644 lib/facebook_ads/test/base.rb create mode 100644 lib/facebook_ads/test/config.rb create mode 100644 lib/facebook_ads/test/errors.rb create mode 100644 lib/facebook_ads/test/exit_codes.rb create mode 100644 lib/facebook_ads/test/exit_hook.rb create mode 100644 lib/facebook_ads/test/fixtures.rb diff --git a/lib/facebook_ads/ad_objects/ad.rb b/lib/facebook_ads/ad_objects/ad.rb index 20cc1f01..3503458a 100644 --- a/lib/facebook_ads/ad_objects/ad.rb +++ b/lib/facebook_ads/ad_objects/ad.rb @@ -114,6 +114,8 @@ class Ad < AdObject field :last_updated_by_app_id, 'string' field :name, 'string' field :recommendations, { list: 'AdRecommendation' } + field :source_ad, 'Ad' + field :source_ad_id, 'string' field :status, { enum: -> { STATUS }} field :tracking_specs, { list: 'ConversionActionQuery' } field :updated_time, 'datetime' @@ -159,6 +161,7 @@ class Ad < AdObject api.has_param :time_increment, 'string' api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } + api.has_param :use_account_attribution_setting, 'bool' end edge.post 'AdReportRun' do |api| api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} } @@ -180,6 +183,7 @@ class Ad < AdObject api.has_param :time_increment, 'string' api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } + api.has_param :use_account_attribution_setting, 'bool' end end diff --git a/lib/facebook_ads/ad_objects/ad_account.rb b/lib/facebook_ads/ad_objects/ad_account.rb index 23972e2e..7b946957 100644 --- a/lib/facebook_ads/ad_objects/ad_account.rb +++ b/lib/facebook_ads/ad_objects/ad_account.rb @@ -46,6 +46,7 @@ class AdAccount < AdObject field :age, 'double' field :agency_client_declaration, 'AgencyClientDeclaration' field :amount_spent, 'string' + field :attribution_spec, { list: 'object' } field :balance, 'string' field :business, 'Business' field :business_city, 'string' @@ -68,6 +69,7 @@ class AdAccount < AdObject field :has_migrated_permissions, 'bool' field :id, 'string' field :io_number, 'string' + field :is_attribution_spec_system_default, 'bool' field :is_notifications_enabled, 'bool' field :is_personal, 'int' field :is_prepay_account, 'bool' @@ -171,9 +173,9 @@ class AdAccount < AdObject api.has_param :name, 'string' end edge.post list: 'AdImage' do |api| - api.has_param :bytes, 'string' + api.has_param :bytes, 'object' api.has_param :copy_from, 'object' - api.has_param :zipbytes, 'string' + api.has_param :zipbytes, 'object' api.accepts_files! end end @@ -259,7 +261,6 @@ class AdAccount < AdObject api.has_param :promoted_object, 'object' api.has_param :redownload, 'bool' api.has_param :rf_prediction_id, 'string' - api.has_param :rtb_flag, 'bool' api.has_param :start_time, 'datetime' api.has_param :status, { enum: -> { AdSet::STATUS }} api.has_param :targeting, 'Targeting' @@ -304,6 +305,7 @@ class AdAccount < AdObject api.has_param :og_object_id, 'string' api.has_param :og_phrase, 'string' api.has_param :og_suggestion_mechanism, 'string' + api.has_param :original_fov, 'int' api.has_param :original_projection_type, { enum: %w{equirectangular cubemap }} api.has_param :referenced_sticker_id, 'string' api.has_param :slideshow_spec, 'hash' @@ -347,7 +349,6 @@ class AdAccount < AdObject api.has_param :object_count, 'int' end edge.get 'Campaign' do |api| - api.has_param :ad_draft_id, 'string' api.has_param :date_preset, { enum: -> { Campaign::DATE_PRESET }} api.has_param :effective_status, { list: { enum: -> { Campaign::EFFECTIVE_STATUS }} } api.has_param :is_completed, 'bool' @@ -408,20 +409,18 @@ class AdAccount < AdObject has_edge :customconversions do |edge| edge.post 'CustomConversion' do |api| - api.has_param :aggregation_rule, 'string' api.has_param :custom_event_type, { enum: -> { CustomConversion::CUSTOM_EVENT_TYPE }} api.has_param :default_conversion_value, 'double' api.has_param :description, 'string' api.has_param :event_source_id, 'string' api.has_param :name, 'string' - api.has_param :retention_days, 'int' api.has_param :rule, 'string' end end has_edge :delivery_estimate do |edge| - edge.get 'DeliveryEstimate' do |api| - api.has_param :optimization_goal, 'adaccountdelivery_estimate_optimization_goal_enum_param' + edge.get 'AdAccountDeliveryEstimate' do |api| + api.has_param :optimization_goal, { enum: -> { AdAccountDeliveryEstimate::OPTIMIZATION_GOAL }} api.has_param :promoted_object, 'object' api.has_param :targeting_spec, 'Targeting' end @@ -463,6 +462,7 @@ class AdAccount < AdObject api.has_param :time_increment, 'string' api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } + api.has_param :use_account_attribution_setting, 'bool' end edge.post 'AdReportRun' do |api| api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} } @@ -484,6 +484,7 @@ class AdAccount < AdObject api.has_param :time_increment, 'string' api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } + api.has_param :use_account_attribution_setting, 'bool' end end @@ -507,14 +508,6 @@ class AdAccount < AdObject edge.get end - has_edge :offlineconversions do |edge| - edge.post do |api| - api.has_param :event, 'string' - api.has_param :payload, { list: 'object' } - api.has_param :pixel_id, 'string' - end - end - has_edge :offsitepixels do |edge| edge.get 'OffsitePixel' edge.post 'OffsitePixel' do |api| @@ -546,7 +539,7 @@ class AdAccount < AdObject api.has_param :opt_out_link, 'string' api.has_param :parent_audience_id, 'int' api.has_param :product_set_id, 'string' - api.has_param :subtype, { enum: %w{CUSTOM WEBSITE APP OFFLINE_CONVERSION CLAIM PARTNER MANAGED VIDEO LOOKALIKE ENGAGEMENT DATA_SET BAG_OF_ACCOUNTS STUDY_RULE_AUDIENCE }} + api.has_param :subtype, { enum: %w{CUSTOM WEBSITE APP OFFLINE_CONVERSION CLAIM PARTNER MANAGED VIDEO LOOKALIKE ENGAGEMENT DATA_SET BAG_OF_ACCOUNTS STUDY_RULE_AUDIENCE FOX }} api.has_param :tags, { list: 'string' } end end diff --git a/lib/facebook_ads/ad_objects/ad_account_delivery_estimate.rb b/lib/facebook_ads/ad_objects/ad_account_delivery_estimate.rb new file mode 100644 index 00000000..9c2536a8 --- /dev/null +++ b/lib/facebook_ads/ad_objects/ad_account_delivery_estimate.rb @@ -0,0 +1,63 @@ +# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Platform Policy +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# FB:AUTOGEN + +module FacebookAds + # This class is auto-genereated. + + # For any issues or feature requests related to this class, please let us know + # on github and we'll fix in our codegen framework. We'll not be able to accept + # pull request for this class. + + class AdAccountDeliveryEstimate < AdObject + OPTIMIZATION_GOAL = [ + "NONE", + "APP_INSTALLS", + "BRAND_AWARENESS", + "CLICKS", + "ENGAGED_USERS", + "EVENT_RESPONSES", + "IMPRESSIONS", + "LEAD_GENERATION", + "LINK_CLICKS", + "OFFER_CLAIMS", + "OFFSITE_CONVERSIONS", + "PAGE_ENGAGEMENT", + "PAGE_LIKES", + "POST_ENGAGEMENT", + "REACH", + "SOCIAL_IMPRESSIONS", + "VIDEO_VIEWS", + "APP_DOWNLOADS", + "LANDING_PAGE_VIEWS", + ] + + + field :bid_estimate, 'object' + field :daily_outcomes_curve, { list: 'OutcomePredictionPoint' } + field :estimate_dau, 'object' + field :estimate_mau, 'object' + field :estimate_ready, 'bool' + has_no_id + has_no_get + has_no_post + has_no_delete + + end +end diff --git a/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb b/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb index db2f1e1e..b2ef1467 100644 --- a/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb +++ b/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb @@ -81,7 +81,6 @@ class AdAccountTargetingUnified < AdObject "effective_audience_network_positions", "excluded_publisher_categories", "excluded_publisher_list_ids", - "excluded_publisher_domains", "publisher_visibility_categories", "user_device", "mobile_device_model", @@ -106,6 +105,7 @@ class AdAccountTargetingUnified < AdObject "moms", "office_type", "targeting_optimization", + "direct_install_devices", "engagement_specs", "excluded_engagement_specs", "product_audience_specs", @@ -118,6 +118,11 @@ class AdAccountTargetingUnified < AdObject "fb_deal_id", "interest_defaults_source", "alternate_auto_targeting_option", + "contextual_targeting_categories", + "topic", + "format", + "trending", + "gatekeepers", ] diff --git a/lib/facebook_ads/ad_objects/ad_async_request.rb b/lib/facebook_ads/ad_objects/ad_async_request.rb index 21ded657..48e8ee85 100644 --- a/lib/facebook_ads/ad_objects/ad_async_request.rb +++ b/lib/facebook_ads/ad_objects/ad_async_request.rb @@ -58,6 +58,7 @@ class AdAsyncRequest < AdObject field :result, 'hash' field :scope_object_id, 'string' field :status, { enum: -> { STATUS }} + field :type, 'string' field :updated_time, 'datetime' has_no_post has_no_delete diff --git a/lib/facebook_ads/ad_objects/ad_campaign_delivery_estimate.rb b/lib/facebook_ads/ad_objects/ad_campaign_delivery_estimate.rb new file mode 100644 index 00000000..4d1ae692 --- /dev/null +++ b/lib/facebook_ads/ad_objects/ad_campaign_delivery_estimate.rb @@ -0,0 +1,63 @@ +# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Platform Policy +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# FB:AUTOGEN + +module FacebookAds + # This class is auto-genereated. + + # For any issues or feature requests related to this class, please let us know + # on github and we'll fix in our codegen framework. We'll not be able to accept + # pull request for this class. + + class AdCampaignDeliveryEstimate < AdObject + OPTIMIZATION_GOAL = [ + "NONE", + "APP_INSTALLS", + "BRAND_AWARENESS", + "CLICKS", + "ENGAGED_USERS", + "EVENT_RESPONSES", + "IMPRESSIONS", + "LEAD_GENERATION", + "LINK_CLICKS", + "OFFER_CLAIMS", + "OFFSITE_CONVERSIONS", + "PAGE_ENGAGEMENT", + "PAGE_LIKES", + "POST_ENGAGEMENT", + "REACH", + "SOCIAL_IMPRESSIONS", + "VIDEO_VIEWS", + "APP_DOWNLOADS", + "LANDING_PAGE_VIEWS", + ] + + + field :bid_estimate, 'object' + field :daily_outcomes_curve, { list: 'OutcomePredictionPoint' } + field :estimate_dau, 'object' + field :estimate_mau, 'object' + field :estimate_ready, 'bool' + has_no_id + has_no_get + has_no_post + has_no_delete + + end +end diff --git a/lib/facebook_ads/ad_objects/ad_creative.rb b/lib/facebook_ads/ad_objects/ad_creative.rb index 40327246..ec656d76 100644 --- a/lib/facebook_ads/ad_objects/ad_creative.rb +++ b/lib/facebook_ads/ad_objects/ad_creative.rb @@ -66,6 +66,7 @@ class AdCreative < AdObject "REGISTER_NOW", "REQUEST_TIME", "SEE_MENU", + "EMAIL_NOW", "OPEN_MOVIES", ] diff --git a/lib/facebook_ads/ad_objects/ad_creative_link_data.rb b/lib/facebook_ads/ad_objects/ad_creative_link_data.rb index 02bbf78b..77b68b7f 100644 --- a/lib/facebook_ads/ad_objects/ad_creative_link_data.rb +++ b/lib/facebook_ads/ad_objects/ad_creative_link_data.rb @@ -53,6 +53,8 @@ class AdCreativeLinkData < AdObject field :offer_id, 'string' field :page_welcome_message, 'string' field :picture, 'string' + field :retailer_item_ids, { list: 'string' } + field :show_multiple_images, 'bool' has_no_id has_no_get has_no_post diff --git a/lib/facebook_ads/ad_objects/ad_creative_link_data_call_to_action.rb b/lib/facebook_ads/ad_objects/ad_creative_link_data_call_to_action.rb index 932d880e..ce0960ed 100644 --- a/lib/facebook_ads/ad_objects/ad_creative_link_data_call_to_action.rb +++ b/lib/facebook_ads/ad_objects/ad_creative_link_data_call_to_action.rb @@ -60,6 +60,7 @@ class AdCreativeLinkDataCallToAction < AdObject "REGISTER_NOW", "REQUEST_TIME", "SEE_MENU", + "EMAIL_NOW", "OPEN_MOVIES", ] diff --git a/lib/facebook_ads/ad_objects/ad_creative_video_data.rb b/lib/facebook_ads/ad_objects/ad_creative_video_data.rb index 8a66f086..34e9640e 100644 --- a/lib/facebook_ads/ad_objects/ad_creative_video_data.rb +++ b/lib/facebook_ads/ad_objects/ad_creative_video_data.rb @@ -27,6 +27,7 @@ module FacebookAds class AdCreativeVideoData < AdObject + field :additional_image_index, 'int' field :branded_content_sponsor_page_id, 'string' field :branded_content_sponsor_relationship, 'string' field :call_to_action, 'AdCreativeLinkDataCallToAction' @@ -36,6 +37,7 @@ class AdCreativeVideoData < AdObject field :message, 'string' field :offer_id, 'string' field :page_welcome_message, 'string' + field :retailer_item_ids, { list: 'string' } field :targeting, 'Targeting' field :title, 'string' field :video_id, 'string' diff --git a/lib/facebook_ads/ad_objects/ad_image.rb b/lib/facebook_ads/ad_objects/ad_image.rb index 88427ba8..93347b3e 100644 --- a/lib/facebook_ads/ad_objects/ad_image.rb +++ b/lib/facebook_ads/ad_objects/ad_image.rb @@ -48,9 +48,9 @@ class AdImage < AdObject field :url, 'string' field :url_128, 'string' field :width, 'int' - field :bytes, 'string' + field :bytes, 'object' field :copy_from, 'object' - field :zipbytes, 'string' + field :zipbytes, 'object' has_no_post has_no_delete diff --git a/lib/facebook_ads/ad_objects/ad_preview.rb b/lib/facebook_ads/ad_objects/ad_preview.rb index aad80636..a9db6514 100644 --- a/lib/facebook_ads/ad_objects/ad_preview.rb +++ b/lib/facebook_ads/ad_objects/ad_preview.rb @@ -41,6 +41,8 @@ class AdPreview < AdObject "INSTANT_ARTICLE_STANDARD", "INSTREAM_VIDEO_DESKTOP", "INSTREAM_VIDEO_MOBILE", + "SUGGESTED_VIDEO_DESKTOP", + "SUGGESTED_VIDEO_MOBILE", ] diff --git a/lib/facebook_ads/ad_objects/ad_report_run.rb b/lib/facebook_ads/ad_objects/ad_report_run.rb index 2aa0cecf..894f6106 100644 --- a/lib/facebook_ads/ad_objects/ad_report_run.rb +++ b/lib/facebook_ads/ad_objects/ad_report_run.rb @@ -59,6 +59,7 @@ class AdReportRun < AdObject field :time_increment, 'string' field :time_range, 'object' field :time_ranges, { list: 'object' } + field :use_account_attribution_setting, 'bool' has_no_post has_no_delete diff --git a/lib/facebook_ads/ad_objects/ad_set.rb b/lib/facebook_ads/ad_objects/ad_set.rb index 85d7b26f..0cc5ae29 100644 --- a/lib/facebook_ads/ad_objects/ad_set.rb +++ b/lib/facebook_ads/ad_objects/ad_set.rb @@ -36,6 +36,7 @@ class AdSet < AdObject "POST_ENGAGEMENT", "VIDEO_VIEWS", "MRC_VIDEO_VIEWS", + "COMPLETED_VIDEO_VIEWS", ] CONFIGURED_STATUS = [ @@ -77,6 +78,7 @@ class AdSet < AdObject "SOCIAL_IMPRESSIONS", "VIDEO_VIEWS", "APP_DOWNLOADS", + "LANDING_PAGE_VIEWS", ] STATUS = [ @@ -152,6 +154,8 @@ class AdSet < AdObject field :recurring_budget_semantics, 'bool' field :rf_prediction_id, 'string' field :rtb_flag, 'bool' + field :source_adset, 'AdSet' + field :source_adset_id, 'string' field :start_time, 'datetime' field :status, { enum: -> { STATUS }} field :targeting, 'Targeting' @@ -206,9 +210,18 @@ class AdSet < AdObject end end + has_edge :copies do |edge| + edge.get 'AdSet' do |api| + api.has_param :date_preset, { enum: -> { AdSet::DATE_PRESET }} + api.has_param :effective_status, { list: { enum: -> { AdSet::EFFECTIVE_STATUS }} } + api.has_param :is_completed, 'bool' + api.has_param :time_range, 'object' + end + end + has_edge :delivery_estimate do |edge| - edge.get 'DeliveryEstimate' do |api| - api.has_param :optimization_goal, 'adcampaigndelivery_estimate_optimization_goal_enum_param' + edge.get 'AdCampaignDeliveryEstimate' do |api| + api.has_param :optimization_goal, { enum: -> { AdCampaignDeliveryEstimate::OPTIMIZATION_GOAL }} api.has_param :promoted_object, 'object' api.has_param :targeting_spec, 'Targeting' end @@ -235,6 +248,7 @@ class AdSet < AdObject api.has_param :time_increment, 'string' api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } + api.has_param :use_account_attribution_setting, 'bool' end edge.post 'AdReportRun' do |api| api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} } @@ -256,6 +270,7 @@ class AdSet < AdObject api.has_param :time_increment, 'string' api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } + api.has_param :use_account_attribution_setting, 'bool' end end diff --git a/lib/facebook_ads/ad_objects/ad_study.rb b/lib/facebook_ads/ad_objects/ad_study.rb index e9e7afe2..ce5ecf72 100644 --- a/lib/facebook_ads/ad_objects/ad_study.rb +++ b/lib/facebook_ads/ad_objects/ad_study.rb @@ -57,9 +57,10 @@ class AdStudy < AdObject edge.post 'AdStudyObjective' do |api| api.has_param :adspixels, { list: 'object' } api.has_param :applications, { list: 'object' } + api.has_param :customconversions, { list: 'object' } api.has_param :is_primary, 'bool' api.has_param :name, 'string' - api.has_param :offlinefeeds, { list: 'object' } + api.has_param :offline_conversion_data_sets, { list: 'object' } api.has_param :offsitepixels, { list: 'object' } api.has_param :type, { enum: -> { AdStudyObjective::TYPE }} end diff --git a/lib/facebook_ads/ad_objects/ad_study_objective.rb b/lib/facebook_ads/ad_objects/ad_study_objective.rb index 52087a82..64cb0ef8 100644 --- a/lib/facebook_ads/ad_objects/ad_study_objective.rb +++ b/lib/facebook_ads/ad_objects/ad_study_objective.rb @@ -49,6 +49,7 @@ class AdStudyObjective < AdObject field :custom_attributes, { list: 'string' } field :id, 'string' field :is_primary, 'bool' + field :last_updated_results, 'string' field :name, 'string' field :results, { list: 'string' } field :type, 'string' diff --git a/lib/facebook_ads/ad_objects/ads_action_stats.rb b/lib/facebook_ads/ad_objects/ads_action_stats.rb index 592218dd..8b8eab32 100644 --- a/lib/facebook_ads/ad_objects/ads_action_stats.rb +++ b/lib/facebook_ads/ad_objects/ads_action_stats.rb @@ -38,6 +38,7 @@ class AdsActionStats < AdObject field :action_carousel_card_name, 'string' field :action_destination, 'string' field :action_device, 'string' + field :action_link_click_destination, 'string' field :action_reaction, 'string' field :action_target_id, 'string' field :action_type, 'string' diff --git a/lib/facebook_ads/ad_objects/ads_image_crops.rb b/lib/facebook_ads/ad_objects/ads_image_crops.rb index 2f5f4c6a..e44883c5 100644 --- a/lib/facebook_ads/ad_objects/ads_image_crops.rb +++ b/lib/facebook_ads/ad_objects/ads_image_crops.rb @@ -33,6 +33,7 @@ class AdsImageCrops < AdObject field :_400x150, { list: { list: 'string' } } field :_400x500, { list: { list: 'string' } } field :_600x360, { list: { list: 'string' } } + field :_90x160, { list: { list: 'string' } } has_no_id has_no_get has_no_post diff --git a/lib/facebook_ads/ad_objects/ads_insights.rb b/lib/facebook_ads/ad_objects/ads_insights.rb index 8cc5b927..a3d46557 100644 --- a/lib/facebook_ads/ad_objects/ads_insights.rb +++ b/lib/facebook_ads/ad_objects/ads_insights.rb @@ -42,6 +42,7 @@ class AdsInsights < AdObject "action_carousel_card_name", "action_destination", "action_device", + "action_link_click_destination", "action_reaction", "action_target_id", "action_type", @@ -106,6 +107,7 @@ class AdsInsights < AdObject "action_carousel_card_name", "action_destination", "action_device", + "action_link_click_destination", "action_reaction", "action_target_id", "action_type", @@ -138,10 +140,7 @@ class AdsInsights < AdObject field :ad_name, 'string' field :adset_id, 'string' field :adset_name, 'string' - field :age, 'string' - field :app_store_clicks, 'string' field :buying_type, 'string' - field :call_to_action_asset, 'object' field :call_to_action_clicks, 'string' field :campaign_id, 'string' field :campaign_name, 'string' @@ -154,40 +153,31 @@ class AdsInsights < AdObject field :cost_per_estimated_ad_recallers, 'string' field :cost_per_inline_link_click, 'string' field :cost_per_inline_post_engagement, 'string' + field :cost_per_outbound_click, { list: 'AdsActionStats' } field :cost_per_total_action, 'string' field :cost_per_unique_action_type, { list: 'AdsActionStats' } field :cost_per_unique_click, 'string' field :cost_per_unique_inline_link_click, 'string' - field :country, 'string' + field :cost_per_unique_outbound_click, { list: 'AdsActionStats' } field :cpc, 'string' field :cpm, 'string' field :cpp, 'string' field :ctr, 'string' field :date_start, 'string' field :date_stop, 'string' - field :deeplink_clicks, 'string' - field :device_platform, 'string' - field :dma, 'string' field :estimated_ad_recall_rate, 'string' field :estimated_ad_recallers, 'string' field :frequency, 'string' - field :frequency_value, 'string' - field :gender, 'string' - field :hourly_stats_aggregated_by_advertiser_time_zone, 'string' - field :hourly_stats_aggregated_by_audience_time_zone, 'string' - field :impression_device, 'string' field :impressions, 'string' - field :impressions_dummy, 'string' field :inline_link_click_ctr, 'string' field :inline_link_clicks, 'string' field :inline_post_engagement, 'string' + field :mobile_app_purchase_roas, { list: 'AdsActionStats' } field :objective, 'string' - field :place_page_id, 'string' + field :outbound_clicks, { list: 'AdsActionStats' } + field :outbound_clicks_ctr, { list: 'AdsActionStats' } field :place_page_name, 'string' - field :placement, 'string' - field :product_id, 'string' field :reach, 'string' - field :region, 'string' field :relevance_score, 'AdgroupRelevanceScore' field :social_clicks, 'string' field :social_impressions, 'string' @@ -203,6 +193,8 @@ class AdsInsights < AdObject field :unique_inline_link_click_ctr, 'string' field :unique_inline_link_clicks, 'string' field :unique_link_clicks_ctr, 'string' + field :unique_outbound_clicks, { list: 'AdsActionStats' } + field :unique_outbound_clicks_ctr, { list: 'AdsActionStats' } field :unique_social_clicks, 'string' field :video_10_sec_watched_actions, { list: 'AdsActionStats' } field :video_15_sec_watched_actions, { list: 'AdsActionStats' } @@ -214,8 +206,8 @@ class AdsInsights < AdObject field :video_p50_watched_actions, { list: 'AdsActionStats' } field :video_p75_watched_actions, { list: 'AdsActionStats' } field :video_p95_watched_actions, { list: 'AdsActionStats' } - field :website_clicks, 'string' field :website_ctr, { list: 'AdsActionStats' } + field :website_purchase_roas, { list: 'AdsActionStats' } has_no_id has_no_get has_no_post diff --git a/lib/facebook_ads/ad_objects/ads_pixel.rb b/lib/facebook_ads/ad_objects/ads_pixel.rb index 16cb89ff..2902a31d 100644 --- a/lib/facebook_ads/ad_objects/ads_pixel.rb +++ b/lib/facebook_ads/ad_objects/ads_pixel.rb @@ -29,6 +29,7 @@ class AdsPixel < AdObject field :code, 'string' field :creation_time, 'datetime' + field :creator, 'User' field :id, 'string' field :is_created_by_business, 'bool' field :last_fired_time, 'datetime' @@ -38,7 +39,9 @@ class AdsPixel < AdObject has_no_delete has_edge :audiences do |edge| - edge.get 'CustomAudience' + edge.get 'CustomAudience' do |api| + api.has_param :ad_account, 'string' + end end has_edge :shared_accounts do |edge| diff --git a/lib/facebook_ads/ad_objects/ads_pixel_stats.rb b/lib/facebook_ads/ad_objects/ads_pixel_stats.rb index b267a6c8..b08df1aa 100644 --- a/lib/facebook_ads/ad_objects/ads_pixel_stats.rb +++ b/lib/facebook_ads/ad_objects/ads_pixel_stats.rb @@ -29,6 +29,7 @@ class AdsPixelStats < AdObject field :count, 'int' field :diagnostics_hourly_last_timestamp, 'datetime' + field :event, 'string' field :value, 'string' has_no_id has_no_get diff --git a/lib/facebook_ads/ad_objects/business.rb b/lib/facebook_ads/ad_objects/business.rb index 5fb96752..c53352cb 100644 --- a/lib/facebook_ads/ad_objects/business.rb +++ b/lib/facebook_ads/ad_objects/business.rb @@ -34,10 +34,12 @@ class Business < AdObject field :name, 'string' field :payment_account_id, 'string' field :primary_page, 'object' + field :profile_picture_uri, 'string' field :timezone_id, 'int' field :two_factor_type, 'string' field :updated_by, 'User' field :updated_time, 'datetime' + field :vertical, 'string' has_no_post has_no_delete @@ -59,6 +61,7 @@ class Business < AdObject has_edge :adaccount do |edge| edge.post 'AdAccount' do |api| + api.has_param :billing_address_id, 'string' api.has_param :currency, 'string' api.has_param :end_advertiser, 'object' api.has_param :funding_id, 'string' @@ -209,6 +212,7 @@ class Business < AdObject edge.get 'ProductCatalog' edge.post 'ProductCatalog' do |api| api.has_param :da_display_settings, 'object' + api.has_param :flight_catalog_settings, 'hash' api.has_param :name, 'string' api.has_param :vertical, { enum: -> { ProductCatalog::VERTICAL }} end @@ -233,7 +237,7 @@ class Business < AdObject has_edge :userpermissions do |edge| edge.post do |api| api.has_param :email, 'string' - api.has_param :role, { enum: %w{ADMIN EMPLOYEE SYSTEM_USER ADMIN_SYSTEM_USER INSTAGRAM_ADMIN INSTAGRAM_EMPLOYEE FB_EMPLOYEE_ACCOUNT_MANAGER FB_EMPLOYEE_SALES_REP }} + api.has_param :role, { enum: %w{FINANCE_EDITOR FINANCE_ANALYST ADS_RIGHTS_REVIEWER ADMIN EMPLOYEE FB_EMPLOYEE_SALES_REP }} api.has_param :user, 'int' end end diff --git a/lib/facebook_ads/ad_objects/campaign.rb b/lib/facebook_ads/ad_objects/campaign.rb index 1dd31760..49c6b324 100644 --- a/lib/facebook_ads/ad_objects/campaign.rb +++ b/lib/facebook_ads/ad_objects/campaign.rb @@ -122,6 +122,8 @@ class Campaign < AdObject field :name, 'string' field :objective, 'string' field :recommendations, { list: 'AdRecommendation' } + field :source_campaign, 'Campaign' + field :source_campaign_id, 'string' field :spend_cap, 'string' field :start_time, 'datetime' field :status, { enum: -> { STATUS }} @@ -162,6 +164,15 @@ class Campaign < AdObject end end + has_edge :copies do |edge| + edge.get 'Campaign' do |api| + api.has_param :date_preset, { enum: -> { Campaign::DATE_PRESET }} + api.has_param :effective_status, { list: { enum: -> { Campaign::EFFECTIVE_STATUS }} } + api.has_param :is_completed, 'bool' + api.has_param :time_range, 'object' + end + end + has_edge :insights do |edge| edge.get 'AdsInsights' do |api| api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} } @@ -183,6 +194,7 @@ class Campaign < AdObject api.has_param :time_increment, 'string' api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } + api.has_param :use_account_attribution_setting, 'bool' end edge.post 'AdReportRun' do |api| api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} } @@ -204,6 +216,7 @@ class Campaign < AdObject api.has_param :time_increment, 'string' api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } + api.has_param :use_account_attribution_setting, 'bool' end end diff --git a/lib/facebook_ads/ad_objects/check_batch_request_status.rb b/lib/facebook_ads/ad_objects/check_batch_request_status.rb new file mode 100644 index 00000000..10536e8a --- /dev/null +++ b/lib/facebook_ads/ad_objects/check_batch_request_status.rb @@ -0,0 +1,40 @@ +# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Platform Policy +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# FB:AUTOGEN + +module FacebookAds + # This class is auto-genereated. + + # For any issues or feature requests related to this class, please let us know + # on github and we'll fix in our codegen framework. We'll not be able to accept + # pull request for this class. + + class CheckBatchRequestStatus < AdObject + + field :errors, { list: 'object' } + field :errors_total_count, 'int' + field :handle, 'string' + field :status, 'string' + has_no_id + has_no_get + has_no_post + has_no_delete + + end +end diff --git a/lib/facebook_ads/ad_objects/custom_audience.rb b/lib/facebook_ads/ad_objects/custom_audience.rb index 12271d0e..0bb05623 100644 --- a/lib/facebook_ads/ad_objects/custom_audience.rb +++ b/lib/facebook_ads/ad_objects/custom_audience.rb @@ -28,16 +28,18 @@ module FacebookAds class CustomAudience < AdObject include CustomAudienceHelpers CLAIM_OBJECTIVE = [ + "AUTO_OFFER", "HOME_LISTING", "PRODUCT", "TRAVEL", ] CONTENT_TYPE = [ + "AUTO_OFFER", "DESTINATION", "FLIGHT", - "HOTEL", "HOME_LISTING", + "HOTEL", ] SUBTYPE = [ @@ -54,6 +56,7 @@ class CustomAudience < AdObject "DATA_SET", "BAG_OF_ACCOUNTS", "STUDY_RULE_AUDIENCE", + "FOX", ] FIELDS = [ @@ -74,6 +77,7 @@ class CustomAudience < AdObject "pixel_id", "retention_days", "rule", + "rule_aggregation", "subtype", "time_content_updated", "time_created", diff --git a/lib/facebook_ads/ad_objects/custom_audience_data_source.rb b/lib/facebook_ads/ad_objects/custom_audience_data_source.rb index 01f6345d..1f9fbcc3 100644 --- a/lib/facebook_ads/ad_objects/custom_audience_data_source.rb +++ b/lib/facebook_ads/ad_objects/custom_audience_data_source.rb @@ -37,6 +37,7 @@ class CustomAudienceDataSource < AdObject "MULTI_HASHES", "TOKENS", "EXTERNAL_IDS_MIX", + "HOUSEHOLD_EXPANSION", "WEB_PIXEL_HITS", "MOBILE_APP_EVENTS", "MOBILE_APP_COMBINATION_EVENTS", @@ -79,6 +80,7 @@ class CustomAudienceDataSource < AdObject "THIRD_PARTY_IMPORTED", "COPY_PASTE", "CONTACT_IMPORTER", + "HOUSEHOLD_AUDIENCE", ] diff --git a/lib/facebook_ads/ad_objects/custom_conversion.rb b/lib/facebook_ads/ad_objects/custom_conversion.rb index 83333a37..485369fd 100644 --- a/lib/facebook_ads/ad_objects/custom_conversion.rb +++ b/lib/facebook_ads/ad_objects/custom_conversion.rb @@ -34,9 +34,9 @@ class CustomConversion < AdObject "CONTENT_VIEW", "INITIATED_CHECKOUT", "LEAD", - "OTHER", "PURCHASE", "SEARCH", + "OTHER", ] @@ -66,6 +66,15 @@ class CustomConversion < AdObject end end + has_edge :shared_agencies do |edge| + edge.delete do |api| + api.has_param :business, 'string' + end + edge.post 'CustomConversion' do |api| + api.has_param :business, 'string' + end + end + has_edge :stats do |edge| edge.get 'CustomConversionStatsResult' do |api| api.has_param :aggregation, { enum: -> { CustomConversionStatsResult::AGGREGATION }} diff --git a/lib/facebook_ads/ad_objects/event.rb b/lib/facebook_ads/ad_objects/event.rb index b2ee87e7..c7cf0a68 100644 --- a/lib/facebook_ads/ad_objects/event.rb +++ b/lib/facebook_ads/ad_objects/event.rb @@ -36,6 +36,7 @@ class Event < AdObject field :attending_count, 'int' field :can_guests_invite, 'bool' + field :can_viewer_post, 'bool' field :category, 'string' field :cover, 'object' field :declined_count, 'int' @@ -45,6 +46,7 @@ class Event < AdObject field :id, 'string' field :interested_count, 'int' field :is_canceled, 'bool' + field :is_draft, 'bool' field :is_page_owned, 'bool' field :is_viewer_admin, 'bool' field :maybe_count, 'int' @@ -55,6 +57,8 @@ class Event < AdObject field :place, 'object' field :start_time, 'string' field :ticket_uri, 'string' + field :ticketing_privacy_uri, 'string' + field :ticketing_terms_uri, 'string' field :timezone, 'string' field :type, { enum: -> { TYPE }} field :updated_time, 'datetime' diff --git a/lib/facebook_ads/ad_objects/lead_gen_question.rb b/lib/facebook_ads/ad_objects/lead_gen_question.rb index 797fc46d..3aeeeb4c 100644 --- a/lib/facebook_ads/ad_objects/lead_gen_question.rb +++ b/lib/facebook_ads/ad_objects/lead_gen_question.rb @@ -27,6 +27,9 @@ module FacebookAds class LeadGenQuestion < AdObject + field :conditional_questions_choices, { list: 'object' } + field :conditional_questions_group_id, 'string' + field :dependent_conditional_questions, { list: 'object' } field :key, 'string' field :label, 'string' field :options, { list: 'LeadGenQuestionOption' } diff --git a/lib/facebook_ads/ad_objects/leadgen_form.rb b/lib/facebook_ads/ad_objects/leadgen_form.rb index bda7cd9b..0356048a 100644 --- a/lib/facebook_ads/ad_objects/leadgen_form.rb +++ b/lib/facebook_ads/ad_objects/leadgen_form.rb @@ -28,6 +28,7 @@ module FacebookAds class LeadgenForm < AdObject field :allow_organic_lead, 'bool' + field :block_display_for_non_targeted_viewer, 'bool' field :context_card, 'object' field :continued_flow_request_method, 'string' field :created_time, 'datetime' diff --git a/lib/facebook_ads/ad_objects/product_catalog.rb b/lib/facebook_ads/ad_objects/product_catalog.rb index 0169399e..31ccc29f 100644 --- a/lib/facebook_ads/ad_objects/product_catalog.rb +++ b/lib/facebook_ads/ad_objects/product_catalog.rb @@ -39,17 +39,25 @@ class ProductCatalog < AdObject field :default_image_url, 'string' field :fallback_image_url, { list: 'string' } field :feed_count, 'int' + field :flight_catalog_settings, 'object' field :id, 'string' field :image_padding_landscape, 'bool' field :image_padding_square, 'bool' field :name, 'string' field :product_count, 'int' + field :qualified_product_count, 'int' field :vertical, 'string' has_edge :agencies do |edge| edge.get 'Business' end + has_edge :check_batch_request_status do |edge| + edge.get 'CheckBatchRequestStatus' do |api| + api.has_param :handle, 'string' + end + end + has_edge :destinations do |edge| edge.get do |api| api.has_param :bulk_pagination, 'bool' @@ -133,6 +141,7 @@ class ProductCatalog < AdObject api.has_param :file_name, 'string' api.has_param :name, 'string' api.has_param :quoted_fields_mode, { enum: -> { ProductFeed::QUOTED_FIELDS_MODE }} + api.has_param :rules, { list: 'string' } api.has_param :schedule, 'string' end end @@ -220,7 +229,7 @@ class ProductCatalog < AdObject api.has_param :start_date, 'string' api.has_param :url, 'string' api.has_param :visibility, { enum: -> { ProductItem::VISIBILITY }} - api.has_param :windows_phone_app_id, 'int' + api.has_param :windows_phone_app_id, 'string' api.has_param :windows_phone_app_name, 'string' api.has_param :windows_phone_url, 'string' end @@ -234,8 +243,11 @@ class ProductCatalog < AdObject api.has_param :file_size, 'int' api.has_param :file_url, 'string' api.has_param :fov, 'int' + api.has_param :guide, { list: { list: 'int' } } + api.has_param :guide_enabled, 'bool' api.has_param :initial_heading, 'int' api.has_param :initial_pitch, 'int' + api.has_param :original_fov, 'int' api.has_param :original_projection_type, { enum: %w{equirectangular cubemap }} api.has_param :referenced_sticker_id, 'string' api.has_param :replace_video_id, 'string' diff --git a/lib/facebook_ads/ad_objects/product_feed.rb b/lib/facebook_ads/ad_objects/product_feed.rb index b49b5938..ec280b26 100644 --- a/lib/facebook_ads/ad_objects/product_feed.rb +++ b/lib/facebook_ads/ad_objects/product_feed.rb @@ -63,8 +63,10 @@ class ProductFeed < AdObject field :latest_upload, 'ProductFeedUpload' field :name, 'string' field :product_count, 'int' + field :qualified_product_count, 'int' field :quoted_fields_mode, { enum: -> { QUOTED_FIELDS_MODE }} field :schedule, 'ProductFeedSchedule' + field :rules, { list: 'string' } has_edge :products do |edge| edge.get 'ProductItem' do |api| diff --git a/lib/facebook_ads/ad_objects/product_feed_schedule.rb b/lib/facebook_ads/ad_objects/product_feed_schedule.rb index bcb40f0b..59113917 100644 --- a/lib/facebook_ads/ad_objects/product_feed_schedule.rb +++ b/lib/facebook_ads/ad_objects/product_feed_schedule.rb @@ -48,6 +48,7 @@ class ProductFeedSchedule < AdObject field :day_of_week, { enum: -> { DAY_OF_WEEK }} field :hour, 'int' field :interval, { enum: -> { INTERVAL }} + field :interval_count, 'int' field :minute, 'int' field :timezone, 'string' field :url, 'string' diff --git a/lib/facebook_ads/ad_objects/product_group.rb b/lib/facebook_ads/ad_objects/product_group.rb index 4172c7b8..b67ae5a7 100644 --- a/lib/facebook_ads/ad_objects/product_group.rb +++ b/lib/facebook_ads/ad_objects/product_group.rb @@ -88,7 +88,7 @@ class ProductGroup < AdObject api.has_param :start_date, 'string' api.has_param :url, 'string' api.has_param :visibility, { enum: -> { ProductItem::VISIBILITY }} - api.has_param :windows_phone_app_id, 'int' + api.has_param :windows_phone_app_id, 'string' api.has_param :windows_phone_app_name, 'string' api.has_param :windows_phone_url, 'string' end diff --git a/lib/facebook_ads/ad_objects/product_item.rb b/lib/facebook_ads/ad_objects/product_item.rb index 1e6dacd3..16758353 100644 --- a/lib/facebook_ads/ad_objects/product_item.rb +++ b/lib/facebook_ads/ad_objects/product_item.rb @@ -59,6 +59,7 @@ class ProductItem < AdObject "pending", "rejected", "approved", + "outdated", ] SHIPPING_WEIGHT_UNIT = [ @@ -135,7 +136,7 @@ class ProductItem < AdObject field :iphone_app_name, 'string' field :iphone_app_store_id, 'int' field :iphone_url, 'string' - field :windows_phone_app_id, 'int' + field :windows_phone_app_id, 'string' field :windows_phone_app_name, 'string' field :windows_phone_url, 'string' diff --git a/lib/facebook_ads/ad_objects/reach_estimate.rb b/lib/facebook_ads/ad_objects/reach_estimate.rb index b594dc8d..e51420e5 100644 --- a/lib/facebook_ads/ad_objects/reach_estimate.rb +++ b/lib/facebook_ads/ad_objects/reach_estimate.rb @@ -45,6 +45,7 @@ class ReachEstimate < AdObject "SOCIAL_IMPRESSIONS", "VIDEO_VIEWS", "APP_DOWNLOADS", + "LANDING_PAGE_VIEWS", ] diff --git a/lib/facebook_ads/ad_objects/reach_frequency_prediction.rb b/lib/facebook_ads/ad_objects/reach_frequency_prediction.rb index c98112c9..c938bbd7 100644 --- a/lib/facebook_ads/ad_objects/reach_frequency_prediction.rb +++ b/lib/facebook_ads/ad_objects/reach_frequency_prediction.rb @@ -69,7 +69,7 @@ class ReachFrequencyPrediction < AdObject field :status, 'int' field :story_event_type, 'int' field :target_audience_size, 'int' - field :target_spec, 'string' + field :target_spec, 'Targeting' field :time_created, 'datetime' field :time_updated, 'datetime' field :budget, 'int' diff --git a/lib/facebook_ads/ad_objects/reach_frequency_spec.rb b/lib/facebook_ads/ad_objects/reach_frequency_spec.rb index 04ae2ad9..10873d03 100644 --- a/lib/facebook_ads/ad_objects/reach_frequency_spec.rb +++ b/lib/facebook_ads/ad_objects/reach_frequency_spec.rb @@ -28,6 +28,7 @@ module FacebookAds class ReachFrequencySpec < AdObject field :countries, { list: 'string' } + field :default_creation_data, 'object' field :max_campaign_duration, 'object' field :max_days_to_finish, 'object' field :max_pause_without_prediction_rerun, 'object' diff --git a/lib/facebook_ads/ad_objects/targeting.rb b/lib/facebook_ads/ad_objects/targeting.rb index 744d4fed..7d0f1c29 100644 --- a/lib/facebook_ads/ad_objects/targeting.rb +++ b/lib/facebook_ads/ad_objects/targeting.rb @@ -49,6 +49,7 @@ class Targeting < AdObject field :cities, { list: 'IDName' } field :college_years, { list: 'int' } field :connections, { list: 'IDName' } + field :contextual_targeting_categories, { list: 'IDName' } field :countries, { list: 'string' } field :country, { list: 'string' } field :country_groups, { list: 'string' } @@ -75,7 +76,6 @@ class Targeting < AdObject field :excluded_mobile_device_model, { list: 'string' } field :excluded_product_audience_specs, { list: 'TargetingProductAudienceSpec' } field :excluded_publisher_categories, { list: 'string' } - field :excluded_publisher_domains, { list: 'string' } field :excluded_publisher_list_ids, { list: 'string' } field :excluded_user_device, { list: 'string' } field :exclusions, 'FlexibleTargeting' diff --git a/lib/facebook_ads/ad_objects/transaction.rb b/lib/facebook_ads/ad_objects/transaction.rb index dc1ebfa8..42ff08ea 100644 --- a/lib/facebook_ads/ad_objects/transaction.rb +++ b/lib/facebook_ads/ad_objects/transaction.rb @@ -42,6 +42,7 @@ class Transaction < AdObject field :credential_id, 'string' field :fatura_id, 'int' field :id, 'string' + field :is_business_ec_charge, 'bool' field :payment_option, 'string' field :product_type, { enum: -> { PRODUCT_TYPE }} field :provider_amount, 'TransactionCurrencyAmount' diff --git a/lib/facebook_ads/ad_objects/user.rb b/lib/facebook_ads/ad_objects/user.rb index 66aa533f..c95f480f 100644 --- a/lib/facebook_ads/ad_objects/user.rb +++ b/lib/facebook_ads/ad_objects/user.rb @@ -100,6 +100,7 @@ class User < AdObject has_edge :leadgen_forms do |edge| edge.get 'LeadgenForm' do |api| + api.has_param :page_id, 'string' api.has_param :query, 'string' end end @@ -119,7 +120,9 @@ class User < AdObject has_edge :promotable_events do |edge| edge.get 'Event' do |api| + api.has_param :include_past_events, 'bool' api.has_param :is_page_event, 'bool' + api.has_param :page_id, 'int' end end diff --git a/lib/facebook_ads/field_types/object.rb b/lib/facebook_ads/field_types/object.rb index 326262bb..b570bc46 100644 --- a/lib/facebook_ads/field_types/object.rb +++ b/lib/facebook_ads/field_types/object.rb @@ -22,7 +22,7 @@ class Object < Base register 'hash', 'map', 'object' def deserialize(value, session = nil) - value.is_a?(String) ? JSON.parse(value) : value + JSON.parse(value) end def serialize(value) diff --git a/lib/facebook_ads/test.rb b/lib/facebook_ads/test.rb new file mode 100644 index 00000000..75dc439c --- /dev/null +++ b/lib/facebook_ads/test.rb @@ -0,0 +1,23 @@ +# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Platform Policy +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +require 'facebook_ads/test/config' +require 'facebook_ads/test/errors' +require 'facebook_ads/test/base' +require 'facebook_ads/test/exit_codes' +require 'facebook_ads/test/exit_hook' \ No newline at end of file diff --git a/lib/facebook_ads/test/base.rb b/lib/facebook_ads/test/base.rb new file mode 100644 index 00000000..f70b32b5 --- /dev/null +++ b/lib/facebook_ads/test/base.rb @@ -0,0 +1,98 @@ +# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Platform Policy +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +require_relative 'config' +require_relative 'fixtures' + +module FacebookAds + module Test + module FailuresStore + def failures + @failures ||= [] + end + end + extend FailuresStore + + class Base < Minitest::Test + attr_accessor :cleanup_queue, :config + + include Fixtures + + def before_setup + load_config! + end + + def generate(type, *args) + method = "create_#{type}".to_sym + if respond_to?(method) + send(method, *args) do |generated_obj| + cleanup_later(generated_obj) + end.tap do |obj| + cleanup_later(obj) + end + else + raise TestRuntimeError, "#{type} is not a supported generator" + end + end + + def teardown + return unless cleanup_queue + + cleanup_queue.reverse.each do |obj_or_id| + if obj_or_id.is_a?(FacebookAds::AdObject) + obj_or_id.destroy + elsif obj_or_id.is_a?(String) || obj_or_id.is_a?(Numeric) + FacebookAds::AdObject.get(obj_or_id).destroy + end + end + end + + def after_teardown + # Collect failures for custom exit code + FacebookAds::Test.failures.concat(self.failures) + end + + private + def cleanup_later(obj) + @cleanup_queue ||= [] + @cleanup_queue << obj + end + + def load_config! + @config = FacebookAds::Test::Config.new.override_from! # load overrides from test_config.json + + FacebookAds.configure do |cf| + log_level = case ENV['LOG_LEVEL'] + when 'debug' + ::Logger::DEBUG + when 'info' + ::Logger::INFO + when 'fatal' + ::Logger::FATAL + when 'error' + ::Logger::ERROR + else # default to warn + ::Logger::WARN + end + cf.logger = ::Logger.new(STDOUT).tap { |d| d.level = log_level } + cf.access_token = config.access_token + end + end + end + end +end \ No newline at end of file diff --git a/lib/facebook_ads/test/config.rb b/lib/facebook_ads/test/config.rb new file mode 100644 index 00000000..0be51782 --- /dev/null +++ b/lib/facebook_ads/test/config.rb @@ -0,0 +1,55 @@ +# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Platform Policy +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +module FacebookAds + module Test + class Config < FacebookAds::Config + setting :app_id + setting :app_secret + setting :access_token + setting :business_id + setting :act_id + setting :account_id + setting :act_timezone + setting :page_id + setting :app_url + setting :instagram_actor_id + setting :graph_base_domain + setting :secondary_business_id + setting :secondary_account_id + setting :secondary_page_id + setting :secondary_app_id + + setting :image_path, File.expand_path("../../../../tests/image.png", __FILE__) + setting :images_zip_path, File.expand_path("../../../../tests/imagez.zip", __FILE__) + setting :video_path, File.expand_path("../../../../tests/video.mp4", __FILE__) + + def override_from!(filename = nil) + filename ||= File.expand_path("../../../../tests/test_config.json", __FILE__) + if File.exists?(filename) + settings = JSON.parse(File.read(filename)) + + settings.each do |k,v| + instance_variable_set("@#{k}", v) + end + end + self + end + end + end +end \ No newline at end of file diff --git a/lib/facebook_ads/test/errors.rb b/lib/facebook_ads/test/errors.rb new file mode 100644 index 00000000..ac88b88c --- /dev/null +++ b/lib/facebook_ads/test/errors.rb @@ -0,0 +1,23 @@ +# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Platform Policy +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +module FacebookAds + module Test + class TestRuntimeError < Exception; end + end +end \ No newline at end of file diff --git a/lib/facebook_ads/test/exit_codes.rb b/lib/facebook_ads/test/exit_codes.rb new file mode 100644 index 00000000..16f7b692 --- /dev/null +++ b/lib/facebook_ads/test/exit_codes.rb @@ -0,0 +1,29 @@ +# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Platform Policy +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +module FacebookAds + module Test + module ExitCodes + EXTERNAL_ERROR = 41 + FAILURE = 1 + SUCCESS = 0 + USER_ERROR = 40 + USER_SKIP = 42 + end + end +end \ No newline at end of file diff --git a/lib/facebook_ads/test/exit_hook.rb b/lib/facebook_ads/test/exit_hook.rb new file mode 100644 index 00000000..bee746c3 --- /dev/null +++ b/lib/facebook_ads/test/exit_hook.rb @@ -0,0 +1,35 @@ +# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Platform Policy +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Intercept Minitest exit routine and return our own custom exit code +Minitest.after_run { + FacebookAds::Test.failures.each do |failure| + case failure + when Minitest::Skip + exit FacebookAds::Test::ExitCodes::USER_SKIP + when Minitest::UnexpectedError + e = failure.exception + if e.is_a?(FacebookAds::ServerError) || + e.is_a?(FacebookAds::ClientError) + exit FacebookAds::Test::ExitCodes::EXTERNAL_ERROR + else + exit FacebookAds::Test::ExitCodes::USER_ERROR + end + end + end +} \ No newline at end of file diff --git a/lib/facebook_ads/test/fixtures.rb b/lib/facebook_ads/test/fixtures.rb new file mode 100644 index 00000000..c17db5d4 --- /dev/null +++ b/lib/facebook_ads/test/fixtures.rb @@ -0,0 +1,107 @@ +# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Platform Policy +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +require 'securerandom' + +module FacebookAds + module Test + module Fixtures + def ad_account + FacebookAds::AdAccount.get(config.account_id) + end + + def create_adlabel + ad_account.adlabels.create({ + name: randomize('My ad label') + }) + end + + def create_ad(params = {}) + ad_set ||= create_ad_set.tap { |c| yield c if block_given? } + creative ||= create_creative.tap { |c| yield c if block_given? } + + params = { + name: 'My Ad', + adset_id: ad_set.id, + creative: { + creative_id: creative.id, + }, + status: 'PAUSED', + } + + ad = ad_account.ads.create(params) + end + + def create_image + images = ad_account.adimages.create({ + filename: config.image_path + }) + images[0] + end + + def create_campaign(params = {}) + params = { + name: randomize('Testing Campaign'), + buying_type: 'AUCTION', + objective: 'LINK_CLICKS', + status: 'PAUSED', + }.merge(params) + + ad_account.campaigns.create(params) + end + + def create_ad_set(campaign = nil, params = {}) + # yield generated object to add them to cleanup queue + campaign ||= create_campaign.tap { |c| yield c if block_given? } + + ad_account.adsets.create({ + campaign_id: campaign.id, + name: randomize('Test AdSet'), + targeting: { + geo_locations: { countries: ['US'] } + }, + optimization_goal: 'IMPRESSIONS', + billing_event: 'IMPRESSIONS', + bid_amount: 100, + daily_budget: 1000, + }) + end + + def create_creative(image = nil, params = {}) + image ||= create_image + + ad_account.adcreatives.create({ + name: randomize('Test Creative'), + object_story_spec: { + page_id: config.page_id, + link_data: { + message: 'try it out', + link: config.app_url, + caption: 'www.example.com', + image_hash: image.hash, + } + } + }) + end + + def randomize(string) + "#{string} #{SecureRandom.hex}" + end + end + end +end diff --git a/lib/facebook_ads/version.rb b/lib/facebook_ads/version.rb index eaaa909c..d1f54c9a 100644 --- a/lib/facebook_ads/version.rb +++ b/lib/facebook_ads/version.rb @@ -19,6 +19,6 @@ # FB:AUTOGEN module FacebookAds - VERSION = '0.2.9' - API_VERSION = '2.9' + VERSION = '0.2.10' + API_VERSION = '2.10' end