diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3499982d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: ruby -rvm: -- 2.4 -before_install: -- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true -- gem install bundler -v '< 2' -install: bundle install -script: gem build facebookbusiness.gemspec -deploy: - provider: rubygems - api_key: - secure: a0LEmoM6WagYxCadbQw4j6JRKfj2NoNMd7izWTJFF1V2pF66MciEo2QwSsCNXbfmmy7lhNcVYSc1xUglvfqJJZorfkrPkHDzydDHYo50Hz+qvmABCUjg83E69cK3LSsAyQ6oX7OiJMkZxIL6buqyKQ5qd9m64hoSS84HVwRywuE= - gem: facebookbusiness - on: - tags: true - repo: facebook/facebook-ruby-business-sdk diff --git a/CHANGELOG.md b/CHANGELOG.md index b0021ce8..175b432f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,29 @@ All notable changes to this project will be documented in this file. ## Unreleased -## v0.9.0.0 +## v0.10.0.1 + + +### Added +- Support for sending multiple values for certain UserData parameters to Conversions API. + +## v0.10.0.0 + + +### Changed +- Graph API call upgrade to [v10.0](https://developers.facebook.com/docs/graph-api/changelog/version10.0) +- Support Ruby 3.0.0 + +## v0.9.0.1 +### Added +- `action_source` field to Event for Conversions API. + +## v0.9.0.0 +### Changed +- Graph API call upgrade to [v9.0](https://developers.facebook.com/docs/graph-api/changelog/version9.0) + ### Added - `delivery_category` field to Content for Conversions API. diff --git a/Gemfile.lock b/Gemfile.lock index 362cb63a..59afe48d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - facebookbusiness (0.8.0.3) + facebookbusiness (0.9.0.1) concurrent-ruby (~> 1.1) countries (~> 3.0) faraday (~> 1.0) diff --git a/examples/AdAccountAdCreativesPostCreateAdCreativePageLike.rb b/examples/AdAccountAdCreativesPost3CreateAdCreativePageLike.rb similarity index 100% rename from examples/AdAccountAdCreativesPostCreateAdCreativePageLike.rb rename to examples/AdAccountAdCreativesPost3CreateAdCreativePageLike.rb diff --git a/examples/AdAccountAdCreativesPostCreateAssetFeedSpec.rb b/examples/AdAccountAdCreativesPost3CreateAssetFeedSpec.rb similarity index 100% rename from examples/AdAccountAdCreativesPostCreateAssetFeedSpec.rb rename to examples/AdAccountAdCreativesPost3CreateAssetFeedSpec.rb diff --git a/examples/AdAccountAdCreativesPost2CreateCarouselCallToActionAppInstall.rb b/examples/AdAccountAdCreativesPost3CreateCarouselCallToActionAppInstall.rb similarity index 100% rename from examples/AdAccountAdCreativesPost2CreateCarouselCallToActionAppInstall.rb rename to examples/AdAccountAdCreativesPost3CreateCarouselCallToActionAppInstall.rb diff --git a/examples/AdAccountAdCreativesPostCreateDynamicAdCustomization.rb b/examples/AdAccountAdCreativesPost3CreateDynamicAdCustomization.rb similarity index 100% rename from examples/AdAccountAdCreativesPostCreateDynamicAdCustomization.rb rename to examples/AdAccountAdCreativesPost3CreateDynamicAdCustomization.rb diff --git a/examples/AdAccountAdCreativesPostCreateAdCreativeLinkAd.rb b/examples/AdAccountAdCreativesPostCreateAdCreativeLinkAd.rb deleted file mode 100644 index 5dd1ef30..00000000 --- a/examples/AdAccountAdCreativesPostCreateAdCreativeLinkAd.rb +++ /dev/null @@ -1,35 +0,0 @@ -# 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' - -access_token = '<ACCESS_TOKEN>' -app_secret = '<APP_SECRET>' -app_id = '<APP_ID>' -id = '<AD_ACCOUNT_ID>' - -FacebookAds.configure do |config| - config.access_token = access_token - config.app_secret = app_secret -end - -ad_account = FacebookAds::AdAccount.get(id) -adcreatives = ad_account.adcreatives.create({ - name: 'Sample Creative', - object_story_spec: {'page_id':'<pageID>','link_data':{'image_hash':'<imageHash>','link':'https:\/\/facebook.com\/<pageID>','message':'try it out'}}, -}) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPostCreateCarouselCallToActionAppInstall.rb b/examples/AdAccountAdCreativesPostCreateCarouselCallToActionAppInstall.rb deleted file mode 100644 index e830961f..00000000 --- a/examples/AdAccountAdCreativesPostCreateCarouselCallToActionAppInstall.rb +++ /dev/null @@ -1,35 +0,0 @@ -# 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' - -access_token = '<ACCESS_TOKEN>' -app_secret = '<APP_SECRET>' -app_id = '<APP_ID>' -id = '<AD_ACCOUNT_ID>' - -FacebookAds.configure do |config| - config.access_token = access_token - config.app_secret = app_secret -end - -ad_account = FacebookAds::AdAccount.get(id) -adcreatives = ad_account.adcreatives.create({ - name: 'Carousel app ad', - object_story_spec: {'page_id':'<pageID>','link_data':{'message':'My message','link':'http://www.example.com/appstoreurl','caption':'WWW.ITUNES.COM','name':'The link name','description':'The link description','child_attachments':[{'link':'http://www.example.com/appstoreurl','image_hash':'<imageHash>','call_to_action':{'type':'USE_MOBILE_APP','value':{'app_link':'<deepLink>'}}},{'link':'http://www.example.com/appstoreurl','image_hash':'<imageHash>','call_to_action':{'type':'USE_MOBILE_APP','value':{'app_link':'<deepLink>'}}},{'link':'http://www.example.com/appstoreurl','image_hash':'<imageHash>','call_to_action':{'type':'USE_MOBILE_APP','value':{'app_link':'<deepLink>'}}},{'link':'http://www.example.com/appstoreurl','image_hash':'<imageHash>','call_to_action':{'type':'USE_MOBILE_APP','value':{'app_link':'<deepLink>'}}}],'multi_share_optimized':true}}, -}) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPostCreateLinkAdCallToActionAppInstall.rb b/examples/AdAccountAdCreativesPostCreateLinkAdCallToActionAppInstall.rb deleted file mode 100644 index f8a85c07..00000000 --- a/examples/AdAccountAdCreativesPostCreateLinkAdCallToActionAppInstall.rb +++ /dev/null @@ -1,35 +0,0 @@ -# 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' - -access_token = '<ACCESS_TOKEN>' -app_secret = '<APP_SECRET>' -app_id = '<APP_ID>' -id = '<AD_ACCOUNT_ID>' - -FacebookAds.configure do |config| - config.access_token = access_token - config.app_secret = app_secret -end - -ad_account = FacebookAds::AdAccount.get(id) -adcreatives = ad_account.adcreatives.create({ - name: 'Sample Creative', - object_story_spec: {'page_id':'<pageID>','link_data':{'call_to_action':{'type':'INSTALL_MOBILE_APP','value':{'link':'<appLink>'}},'image_hash':'<imageHash>','link':'<appLink>','message':'Try it out'}}, -}) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPostCreateLinkAdImageCrop.rb b/examples/AdAccountAdCreativesPostCreateLinkAdImageCrop.rb deleted file mode 100644 index b0d1469d..00000000 --- a/examples/AdAccountAdCreativesPostCreateLinkAdImageCrop.rb +++ /dev/null @@ -1,35 +0,0 @@ -# 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' - -access_token = '<ACCESS_TOKEN>' -app_secret = '<APP_SECRET>' -app_id = '<APP_ID>' -id = '<AD_ACCOUNT_ID>' - -FacebookAds.configure do |config| - config.access_token = access_token - config.app_secret = app_secret -end - -ad_account = FacebookAds::AdAccount.get(id) -adcreatives = ad_account.adcreatives.create({ - name: 'Image crop creative', - object_story_spec: {'page_id':'<pageID>','link_data':{'image_crops':{'100x100':[[0,0],[100,100]]},'image_hash':'<imageHash>','link':'<url>','message':'Ad message'}}, -}) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPostCreateLinkAdNotToPage.rb b/examples/AdAccountAdCreativesPostCreateLinkAdNotToPage.rb deleted file mode 100644 index d0526034..00000000 --- a/examples/AdAccountAdCreativesPostCreateLinkAdNotToPage.rb +++ /dev/null @@ -1,39 +0,0 @@ -# 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' - -access_token = '<ACCESS_TOKEN>' -app_secret = '<APP_SECRET>' -app_id = '<APP_ID>' -id = '<ID>' - -FacebookAds.configure do |config| - config.access_token = access_token - config.app_secret = app_secret -end - -ad_account = FacebookAds::AdAccount.get(id) -adcreatives = ad_account.adcreatives.create({ - name: 'Sample Creative', - title: 'My title', - body: 'My body', - object_url: '<url>', - link_url: '<url>', - image_hash: '<imageHash>', -}) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPostCreateMAIDPA.rb b/examples/AdAccountAdCreativesPostCreateMAIDPA.rb deleted file mode 100644 index e94a0d57..00000000 --- a/examples/AdAccountAdCreativesPostCreateMAIDPA.rb +++ /dev/null @@ -1,36 +0,0 @@ -# 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' - -access_token = '<ACCESS_TOKEN>' -app_secret = '<APP_SECRET>' -app_id = '<APP_ID>' -id = '<AD_ACCOUNT_ID>' - -FacebookAds.configure do |config| - config.access_token = access_token - config.app_secret = app_secret -end - -ad_account = FacebookAds::AdAccount.get(id) -adcreatives = ad_account.adcreatives.create({ - name: 'Dynamic Ad Template Creative Sample', - object_story_spec: {'page_id':'<pageID>','template_data':{'call_to_action':{'type':'INSTALL_MOBILE_APP','value':{'link':'http://www.example.com/appstoreurl'}},'message':'Test {{product.name | titleize}}','link':'http://www.example.com/appstoreurl','name':'Headline {{product.price}}','description':'Description {{product.description}}'}}, - product_set_id: '<productSetID>', -}) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPostCreateVideoLeadAd.rb b/examples/AdAccountAdCreativesPostCreateVideoLeadAd.rb deleted file mode 100644 index af1069df..00000000 --- a/examples/AdAccountAdCreativesPostCreateVideoLeadAd.rb +++ /dev/null @@ -1,34 +0,0 @@ -# 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' - -access_token = '<ACCESS_TOKEN>' -app_secret = '<APP_SECRET>' -app_id = '<APP_ID>' -id = '<AD_ACCOUNT_ID>' - -FacebookAds.configure do |config| - config.access_token = access_token - config.app_secret = app_secret -end - -ad_account = FacebookAds::AdAccount.get(id) -adcreatives = ad_account.adcreatives.create({ - object_story_spec: {'page_id':'<pageID>','video_data':{'link_description':'try it out','image_url':'<imageURL>','video_id':'<videoID>','call_to_action':{'type':'SIGN_UP','value':{'link':'http:\/\/fb.me\/','lead_gen_form_id':'<formID>'}}}}, -}) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPostCreateVideoPageLikeAd.rb b/examples/AdAccountAdCreativesPostCreateVideoPageLikeAd.rb deleted file mode 100644 index 4be485f1..00000000 --- a/examples/AdAccountAdCreativesPostCreateVideoPageLikeAd.rb +++ /dev/null @@ -1,35 +0,0 @@ -# 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' - -access_token = '<ACCESS_TOKEN>' -app_secret = '<APP_SECRET>' -app_id = '<APP_ID>' -id = '<AD_ACCOUNT_ID>' - -FacebookAds.configure do |config| - config.access_token = access_token - config.app_secret = app_secret -end - -ad_account = FacebookAds::AdAccount.get(id) -adcreatives = ad_account.adcreatives.create({ - name: 'Sample Creative', - object_story_spec: {'page_id':'<pageID>','video_data':{'image_url':'<imageURL>','video_id':'<videoID>','call_to_action':{'type':'LIKE_PAGE','value':{'page':'<pageID>'}}}}, -}) \ No newline at end of file diff --git a/examples/AdAccountAdSetsPostAdSetCreateCpa.rb b/examples/AdAccountAdSetsPostAdSetCreateCpa.rb index 0777fbc9..1ba299b8 100644 --- a/examples/AdAccountAdSetsPostAdSetCreateCpa.rb +++ b/examples/AdAccountAdSetsPostAdSetCreateCpa.rb @@ -33,8 +33,8 @@ name: 'A CPA Ad Set', campaign_id: '<adCampaignLinkClicksID>', daily_budget: '5000', - start_time: '2020-10-29T22:16:32-0700', - end_time: '2020-11-05T22:16:32-0800', + start_time: '2021-04-25T09:42:56-0700', + end_time: '2021-05-02T09:42:56-0700', billing_event: 'IMPRESSIONS', optimization_goal: 'REACH', bid_amount: '1000', diff --git a/examples/AdAccountAdSetsPostAdSetCreateCpaAppEvents.rb b/examples/AdAccountAdSetsPostAdSetCreateCpaAppEvents.rb index 5d897b6e..1fafb645 100644 --- a/examples/AdAccountAdSetsPostAdSetCreateCpaAppEvents.rb +++ b/examples/AdAccountAdSetsPostAdSetCreateCpaAppEvents.rb @@ -33,8 +33,8 @@ name: 'A CPA Ad Set optimized for App Events', campaign_id: '<adCampaignAppInstallsID>', daily_budget: '300', - start_time: '2020-10-29T22:17:28-0700', - end_time: '2020-11-05T22:17:28-0800', + start_time: '2021-04-25T09:43:53-0700', + end_time: '2021-05-02T09:43:53-0700', billing_event: 'IMPRESSIONS', optimization_goal: 'OFFSITE_CONVERSIONS', bid_amount: '100', diff --git a/examples/AdAccountAdSetsPostCreateAdSet.rb b/examples/AdAccountAdSetsPostCreateAdSet.rb index cfb7fe48..8c69e9a0 100644 --- a/examples/AdAccountAdSetsPostCreateAdSet.rb +++ b/examples/AdAccountAdSetsPostCreateAdSet.rb @@ -32,8 +32,8 @@ adsets = ad_account.adsets.create({ name: 'My First AdSet', lifetime_budget: '20000', - start_time: '2020-10-29T22:15:36-0700', - end_time: '2020-11-05T22:15:36-0800', + start_time: '2021-04-25T09:42:08-0700', + end_time: '2021-05-02T09:42:08-0700', campaign_id: '<adCampaignLinkClicksID>', bid_amount: '500', billing_event: 'IMPRESSIONS', diff --git a/examples/AdAccountAdSetsPostCreateCampaign.rb b/examples/AdAccountAdSetsPostCreateCampaign.rb deleted file mode 100644 index 77942ac5..00000000 --- a/examples/AdAccountAdSetsPostCreateCampaign.rb +++ /dev/null @@ -1,36 +0,0 @@ -# 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' - -access_token = '<ACCESS_TOKEN>' -app_secret = '<APP_SECRET>' -app_id = '<APP_ID>' -id = '<AD_ACCOUNT_ID>' - -FacebookAds.configure do |config| - config.access_token = access_token - config.app_secret = app_secret -end - -ad_account = FacebookAds::AdAccount.get(id) -campaigns = ad_account.campaigns.create({ - name: 'My campaign', - objective: 'LINK_CLICKS', - status: 'PAUSED', -}) \ No newline at end of file diff --git a/examples/AdAccountAdSetsPostDailyBudget20.rb b/examples/AdAccountAdSetsPostDailyBudget20.rb index 51eaa6e0..3310ccc2 100644 --- a/examples/AdAccountAdSetsPostDailyBudget20.rb +++ b/examples/AdAccountAdSetsPostDailyBudget20.rb @@ -32,8 +32,8 @@ adsets = ad_account.adsets.create({ name: 'My First Adset', daily_budget: '2000', - start_time: '2020-10-22T22:17:00-0700', - end_time: '2020-10-29T22:17:00-0700', + start_time: '2021-04-18T09:43:24-0700', + end_time: '2021-04-25T09:43:24-0700', campaign_id: '<adCampaignLinkClicksID>', bid_amount: '100', billing_event: 'LINK_CLICKS', diff --git a/examples/AdAccountAdSetsPostLifetimeBudget200Duration10Days.rb b/examples/AdAccountAdSetsPostLifetimeBudget200Duration10Days.rb index 61679087..b1ed5a54 100644 --- a/examples/AdAccountAdSetsPostLifetimeBudget200Duration10Days.rb +++ b/examples/AdAccountAdSetsPostLifetimeBudget200Duration10Days.rb @@ -32,8 +32,8 @@ adsets = ad_account.adsets.create({ name: 'My First Adset', lifetime_budget: '20000', - start_time: '2020-10-22T22:17:10-0700', - end_time: '2020-11-01T22:17:10-0800', + start_time: '2021-04-18T09:43:34-0700', + end_time: '2021-04-28T09:43:34-0700', campaign_id: '<adCampaignLinkClicksID>', bid_amount: '100', billing_event: 'LINK_CLICKS', diff --git a/examples/AdAccountAdSetsPostOfferClaim.rb b/examples/AdAccountAdSetsPostOfferClaim.rb index 1cd3bacd..5870df76 100644 --- a/examples/AdAccountAdSetsPostOfferClaim.rb +++ b/examples/AdAccountAdSetsPostOfferClaim.rb @@ -32,8 +32,8 @@ adsets = ad_account.adsets.create({ name: 'My Offer Claim AdSet', lifetime_budget: '56000', - start_time: '2020-10-22T22:16:51-0700', - end_time: '2020-10-29T22:16:51-0700', + start_time: '2021-04-18T09:43:15-0700', + end_time: '2021-04-25T09:43:15-0700', campaign_id: '<adCampaignLinkClicksID>', billing_event: 'LINK_CLICKS', optimization_goal: 'LINK_CLICKS', diff --git a/examples/AdAccountAdSetsPostOptimizePostEngagement.rb b/examples/AdAccountAdSetsPostOptimizePostEngagement.rb index 5aa24c40..163ff100 100644 --- a/examples/AdAccountAdSetsPostOptimizePostEngagement.rb +++ b/examples/AdAccountAdSetsPostOptimizePostEngagement.rb @@ -32,8 +32,8 @@ adsets = ad_account.adsets.create({ name: 'My First Adset', lifetime_budget: '20000', - start_time: '2020-10-22T22:17:19-0700', - end_time: '2020-11-01T22:17:19-0800', + start_time: '2021-04-18T09:43:43-0700', + end_time: '2021-04-28T09:43:43-0700', campaign_id: '<adCampaignLinkClicksID>', bid_amount: '500', billing_event: 'IMPRESSIONS', diff --git a/examples/AdgroupLeadsEdgeAdgroupLeadsFiltered.rb b/examples/AdgroupLeadsEdgeAdgroupLeadsFiltered.rb index 673d6313..43274a37 100644 --- a/examples/AdgroupLeadsEdgeAdgroupLeadsFiltered.rb +++ b/examples/AdgroupLeadsEdgeAdgroupLeadsFiltered.rb @@ -31,5 +31,5 @@ ad = FacebookAds::Ad.get(id) leadss = ad.leads({ fields: { }, - filtering: [{'field':'time_created','operator':'GREATER_THAN','value':1602826030}], + filtering: [{'field':'time_created','operator':'GREATER_THAN','value':1618160236}], }) \ No newline at end of file diff --git a/examples/AdsPixelEventsPost.rb b/examples/AdsPixelEventsPost.rb index 9b76e474..902f81c1 100644 --- a/examples/AdsPixelEventsPost.rb +++ b/examples/AdsPixelEventsPost.rb @@ -30,5 +30,5 @@ ads_pixel = FacebookAds::AdsPixel.get(id) events = ads_pixel.events.create({ - data: [{'event_name':'PageView','event_time':1604520076,'user_data':{'fbc':'fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890','fbp':'fb.1.1558571054389.1098115397','em':'309a0a5c3e211326ae75ca18196d301a9bdbd1a882a4d2569511033da23f0abd'}}], + data: [{'event_name':'PageView','event_time':1618763836,'user_data':{'fbc':'fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890','fbp':'fb.1.1558571054389.1098115397','em':'309a0a5c3e211326ae75ca18196d301a9bdbd1a882a4d2569511033da23f0abd'}}], }) \ No newline at end of file diff --git a/examples/AdsPixelEventsPostCustom.rb b/examples/AdsPixelEventsPostCustom.rb index 21999d7a..edd0aa9f 100644 --- a/examples/AdsPixelEventsPostCustom.rb +++ b/examples/AdsPixelEventsPostCustom.rb @@ -27,22 +27,38 @@ user_data = FacebookAds::ServerSide::UserData.new( email: 'joe@eg.com', + # It is recommended to send Client IP and User Agent for Conversions API Events. + client_ip_address: request.remote_ip, + client_user_agent: request.user_agent, fbc: 'fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890', - fbp: 'fb.1.1558571054389.1098115397') + fbp: 'fb.1.1558571054389.1098115397' +) + +content = FacebookAds::ServerSide::Content.new( + product_id: 'product123', + quantity: 1, + delivery_category: 'home_delivery' +) custom_data = FacebookAds::ServerSide::CustomData.new( + contents: [content], currency: 'usd', - value: 123.45) + value: 123.45 +) event = FacebookAds::ServerSide::Event.new( event_name: 'Purchase', event_time: Time.now.to_i, user_data: user_data, - custom_data: custom_data) + custom_data: custom_data, + event_source_url: 'http://jaspers-market.com/product/123', + action_source: 'website' +) request = FacebookAds::ServerSide::EventRequest.new( pixel_id: pixel_id, - events: [event]) + events: [event] +) print request.execute \ No newline at end of file diff --git a/examples/AdsPixelNodeGetPixelCode.rb b/examples/AdsPixelNodeGetPixelCode.rb deleted file mode 100644 index 1ffa291f..00000000 --- a/examples/AdsPixelNodeGetPixelCode.rb +++ /dev/null @@ -1,31 +0,0 @@ -# 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' - -access_token = '<ACCESS_TOKEN>' -app_secret = '<APP_SECRET>' -app_id = '<APP_ID>' -id = '<ADS_PIXEL_ID>' - -FacebookAds.configure do |config| - config.access_token = access_token - config.app_secret = app_secret -end - -ads_pixel = FacebookAds::AdsPixel.get(id ,'code') \ No newline at end of file diff --git a/examples/MultiPromoteYourPage.rb b/examples/MultiPromoteYourPage.rb index a755cbae..9ec32770 100644 --- a/examples/MultiPromoteYourPage.rb +++ b/examples/MultiPromoteYourPage.rb @@ -66,6 +66,7 @@ name: 'My campaign', objective: 'LINK_CLICKS', status: 'PAUSED', + special_ad_categories: [], }) adcampaign_id = adcampaign.id print 'adcampaign_id:', adcampaign_id @@ -78,7 +79,7 @@ bid_amount: '2', daily_budget: '1000', campaign_id: adcampaign_id, - targeting: {'geo_locations':{'countries':['US']}}, + targeting: {'geo_locations':{'countries':['US']},'facebook_positions':['feed']}, status: 'PAUSED', promoted_object: {'page_id':page_id}, }) diff --git a/facebookbusiness.gemspec b/facebookbusiness.gemspec index 350e1a90..da45e307 100644 --- a/facebookbusiness.gemspec +++ b/facebookbusiness.gemspec @@ -37,7 +37,7 @@ Gem::Specification.new do |s| FacebookAds::VERSION end - s.required_ruby_version = '~> 2.0' + s.required_ruby_version = '> 2.4' s.add_dependency 'concurrent-ruby', '~> 1.1' s.add_dependency 'faraday', '~> 1.0' @@ -49,7 +49,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'bundler', '~> 1.17' s.add_development_dependency 'byebug', '~> 11.0' s.add_development_dependency 'dotenv', '~> 2.7' - s.add_development_dependency 'minitest', '~> 5.0' + s.add_development_dependency 'minitest', '~> 5.14.2' s.add_development_dependency 'pry', '~> 0.12' s.add_development_dependency 'pry-coolline', '~> 0.2' s.add_development_dependency 'rake', '~> 13.0' diff --git a/lib/facebook_ads/ad_objects/ad.rb b/lib/facebook_ads/ad_objects/ad.rb index 07660177..23f72f63 100644 --- a/lib/facebook_ads/ad_objects/ad.rb +++ b/lib/facebook_ads/ad_objects/ad.rb @@ -75,7 +75,7 @@ class Ad < AdObject "last_week_mon_sun", "last_week_sun_sat", "last_year", - "lifetime", + "maximum", "this_month", "this_quarter", "this_week_mon_today", @@ -114,6 +114,7 @@ class Ad < AdObject field :campaign, 'Campaign' field :campaign_id, 'string' field :configured_status, { enum: -> { CONFIGURED_STATUS }} + field :conversion_domain, 'string' field :conversion_specs, { list: 'ConversionActionQuery' } field :created_time, 'datetime' field :creative, 'AdCreative' @@ -196,6 +197,7 @@ class Ad < AdObject api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } api.has_param :use_account_attribution_setting, 'bool' + api.has_param :use_unified_attribution_setting, 'bool' end edge.post 'AdReportRun' do |api| api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} } @@ -218,6 +220,7 @@ class Ad < AdObject api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } api.has_param :use_account_attribution_setting, 'bool' + api.has_param :use_unified_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 a23f5a65..28a8fc79 100644 --- a/lib/facebook_ads/ad_objects/ad_account.rb +++ b/lib/facebook_ads/ad_objects/ad_account.rb @@ -87,12 +87,14 @@ class AdAccount < AdObject PERMITTED_TASKS = [ "ADVERTISE", "ANALYZE", + "DRAFT", "MANAGE", ] TASKS = [ "ADVERTISE", "ANALYZE", + "DRAFT", "MANAGE", ] @@ -143,7 +145,6 @@ class AdAccount < AdObject field :account_id, 'string' field :account_status, 'int' - field :ad_account_creation_request, 'AdAccountCreationRequest' field :ad_account_promotable_objects, 'AdAccountPromotableObjects' field :age, 'double' field :agency_client_declaration, 'AgencyClientDeclaration' @@ -281,6 +282,7 @@ class AdAccount < AdObject api.has_param :object_story_spec, 'AdCreativeObjectStorySpec' api.has_param :object_type, 'string' api.has_param :object_url, 'string' + api.has_param :place_page_set_id, 'string' api.has_param :platform_customizations, 'object' api.has_param :playable_asset_id, 'string' api.has_param :portrait_customizations, 'hash' @@ -375,6 +377,7 @@ class AdAccount < AdObject api.has_param :adset_spec, 'AdSet' api.has_param :audience_id, 'string' api.has_param :bid_amount, 'int' + api.has_param :conversion_domain, 'string' api.has_param :creative, 'AdCreative' api.has_param :date_format, 'string' api.has_param :display_sequence, 'int' @@ -506,7 +509,6 @@ class AdAccount < AdObject api.has_param :animated_effect_id, 'int' api.has_param :application_id, 'string' api.has_param :asked_fun_fact_prompt_id, 'int' - api.has_param :attribution_app_id, 'string' api.has_param :audio_story_wave_animation_handle, 'string' api.has_param :chunk_session_id, 'string' api.has_param :composer_entry_picker, 'string' @@ -638,13 +640,6 @@ class AdAccount < AdObject end end - has_edge :audiencereplace do |edge| - edge.post do |api| - api.has_param :payload, 'object' - api.has_param :session, 'object' - end - end - has_edge :block_list_drafts do |edge| edge.post 'AdAccount' do |api| api.has_param :publisher_urls_file, 'file' @@ -676,6 +671,7 @@ class AdAccount < AdObject api.has_param :buying_type, 'string' api.has_param :daily_budget, 'int' api.has_param :execution_options, { list: { enum: -> { Campaign::EXECUTION_OPTIONS }} } + api.has_param :is_skadnetwork_attribution, 'bool' api.has_param :iterative_split_test_configs, { list: 'object' } api.has_param :lifetime_budget, 'int' api.has_param :name, 'string' @@ -687,7 +683,9 @@ class AdAccount < AdObject api.has_param :special_ad_categories, { list: { enum: -> { Campaign::SPECIAL_AD_CATEGORIES }} } api.has_param :special_ad_category_country, { list: { enum: -> { Campaign::SPECIAL_AD_CATEGORY_COUNTRY }} } api.has_param :spend_cap, 'int' + api.has_param :start_time, 'datetime' api.has_param :status, { enum: -> { Campaign::STATUS }} + api.has_param :stop_time, 'datetime' api.has_param :topline_id, 'string' api.has_param :upstream_events, 'hash' end @@ -731,8 +729,6 @@ class AdAccount < AdObject api.has_param :pixel_id, 'string' end edge.post 'CustomAudience' do |api| - api.has_param :accountid, 'string' - api.has_param :additionalmetadata, 'string' api.has_param :allowed_domains, { list: 'string' } api.has_param :associated_audience_id, 'int' api.has_param :claim_objective, { enum: -> { CustomAudience::CLAIM_OBJECTIVE }} @@ -742,28 +738,19 @@ class AdAccount < AdObject api.has_param :customer_file_source, { enum: -> { CustomAudience::CUSTOMER_FILE_SOURCE }} api.has_param :dataset_id, 'string' api.has_param :description, 'string' - api.has_param :details, 'string' api.has_param :enable_fetch_or_create, 'bool' api.has_param :event_source_group, 'string' api.has_param :event_sources, { list: 'hash' } api.has_param :exclusions, { list: 'object' } - api.has_param :expectedsize, 'int' - api.has_param :gender, 'string' api.has_param :inclusions, { list: 'object' } - api.has_param :isprivate, 'bool' - api.has_param :is_household, 'bool' - api.has_param :is_household_exclusion, 'bool' api.has_param :is_snapshot, 'bool' api.has_param :is_value_based, 'bool' api.has_param :list_of_accounts, { list: 'int' } api.has_param :lookalike_spec, 'string' - api.has_param :maxage, 'int' - api.has_param :minage, 'int' api.has_param :name, 'string' api.has_param :opt_out_link, 'string' api.has_param :origin_audience_id, 'string' api.has_param :parent_audience_id, 'int' - api.has_param :partnerid, 'string' api.has_param :partner_reference_key, 'string' api.has_param :pixel_id, 'string' api.has_param :prefill, 'bool' @@ -773,10 +760,7 @@ class AdAccount < AdObject api.has_param :rev_share_policy_id, 'int' api.has_param :rule, 'string' api.has_param :rule_aggregation, 'string' - api.has_param :seed_audience, 'int' - api.has_param :source, 'string' api.has_param :subtype, { enum: -> { CustomAudience::SUBTYPE }} - api.has_param :tags, { list: 'string' } api.has_param :video_group_ids, { list: 'string' } end end @@ -861,6 +845,7 @@ class AdAccount < AdObject api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } api.has_param :use_account_attribution_setting, 'bool' + api.has_param :use_unified_attribution_setting, 'bool' end edge.post 'AdReportRun' do |api| api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} } @@ -883,6 +868,7 @@ class AdAccount < AdObject api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } api.has_param :use_account_attribution_setting, 'bool' + api.has_param :use_unified_attribution_setting, 'bool' end end @@ -896,6 +882,8 @@ class AdAccount < AdObject api.has_param :app_store, { enum: -> { AdAccountMatchedSearchApplicationsEdgeData::APP_STORE }} api.has_param :app_store_country, 'string' api.has_param :business_id, 'string' + api.has_param :is_skadnetwork_search, 'bool' + api.has_param :only_apps_with_permission, 'bool' api.has_param :query_term, 'string' end end @@ -933,8 +921,6 @@ class AdAccount < AdObject api.has_param :event_sources, { list: 'hash' } api.has_param :exclusions, { list: 'object' } api.has_param :inclusions, { list: 'object' } - api.has_param :is_household, 'bool' - api.has_param :is_household_exclusion, 'bool' api.has_param :is_snapshot, 'bool' api.has_param :is_value_based, 'bool' api.has_param :name, 'string' @@ -942,9 +928,7 @@ class AdAccount < AdObject api.has_param :parent_audience_id, 'int' api.has_param :product_set_id, 'string' api.has_param :rev_share_policy_id, 'int' - api.has_param :seed_audience, 'int' api.has_param :subtype, { enum: -> { AdAccount::SUBTYPE }} - api.has_param :tags, { list: 'string' } end end @@ -1015,15 +999,6 @@ class AdAccount < AdObject end end - has_edge :roas do |edge| - edge.get 'AdAccountRoas' do |api| - api.has_param :fields, { list: 'string' } - api.has_param :filtering, { list: 'object' } - api.has_param :time_increment, 'string' - api.has_param :time_range, 'object' - end - end - has_edge :saved_audiences do |edge| edge.get 'SavedAudience' do |api| api.has_param :business_id, 'string' @@ -1032,15 +1007,6 @@ class AdAccount < AdObject end end - has_edge :sponsored_message_ads do |edge| - edge.post do |api| - api.has_param :bid_amount, 'int' - api.has_param :daily_budget, 'int' - api.has_param :message_creative_id, 'string' - api.has_param :targeting, 'Targeting' - end - end - has_edge :subscribed_apps do |edge| edge.delete do |api| api.has_param :app_id, 'string' diff --git a/lib/facebook_ads/ad_objects/ad_account_creation_request.rb b/lib/facebook_ads/ad_objects/ad_account_creation_request.rb deleted file mode 100644 index 2ec5ceed..00000000 --- a/lib/facebook_ads/ad_objects/ad_account_creation_request.rb +++ /dev/null @@ -1,71 +0,0 @@ -# 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-generated. - - # 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 AdAccountCreationRequest < AdObject - - field :ad_accounts_currency, 'string' - field :ad_accounts_info, { list: 'object' } - field :additional_comment, 'string' - field :address_in_chinese, 'string' - field :address_in_english, 'object' - field :address_in_local_language, 'string' - field :advertiser_business, 'Business' - field :appeal_reason, 'object' - field :business, 'Business' - field :business_registration_id, 'string' - field :chinese_legal_entity_name, 'string' - field :contact, 'object' - field :creator, 'User' - field :credit_card_id, 'string' - field :disapproval_reasons, { list: 'object' } - field :english_legal_entity_name, 'string' - field :extended_credit_id, 'string' - field :id, 'string' - field :is_smb, 'bool' - field :is_test, 'bool' - field :legal_entity_name_in_local_language, 'string' - field :oe_request_id, 'string' - field :official_website_url, 'string' - field :planning_agency_business, 'Business' - field :planning_agency_business_id, 'string' - field :promotable_app_ids, { list: 'string' } - field :promotable_page_ids, { list: 'string' } - field :promotable_urls, { list: 'string' } - field :request_change_reasons, { list: 'object' } - field :status, 'string' - field :subvertical, 'string' - field :time_created, 'datetime' - field :vertical, 'string' - has_no_post - has_no_delete - - has_edge :adaccounts do |edge| - edge.get 'AdAccount' - end - - 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 index 49d66519..db44b48b 100644 --- a/lib/facebook_ads/ad_objects/ad_account_delivery_estimate.rb +++ b/lib/facebook_ads/ad_objects/ad_account_delivery_estimate.rb @@ -45,6 +45,7 @@ class AdAccountDeliveryEstimate < AdObject "PAGE_ENGAGEMENT", "PAGE_LIKES", "POST_ENGAGEMENT", + "QUALITY_CALL", "QUALITY_LEAD", "REACH", "REPLIES", diff --git a/lib/facebook_ads/ad_objects/ad_account_matched_search_applications_edge_data.rb b/lib/facebook_ads/ad_objects/ad_account_matched_search_applications_edge_data.rb index f459c599..ede3a1af 100644 --- a/lib/facebook_ads/ad_objects/ad_account_matched_search_applications_edge_data.rb +++ b/lib/facebook_ads/ad_objects/ad_account_matched_search_applications_edge_data.rb @@ -32,6 +32,7 @@ class AdAccountMatchedSearchApplicationsEdgeData < AdObject "FB_ANDROID_STORE", "FB_CANVAS", "FB_GAMEROOM", + "GALAXY_STORE", "GOOGLE_PLAY", "INSTANT_GAME", "ITUNES", diff --git a/lib/facebook_ads/ad_objects/ad_account_roas.rb b/lib/facebook_ads/ad_objects/ad_account_roas.rb deleted file mode 100644 index f102115a..00000000 --- a/lib/facebook_ads/ad_objects/ad_account_roas.rb +++ /dev/null @@ -1,65 +0,0 @@ -# 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-generated. - - # 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 AdAccountRoas < AdObject - - field :adgroup_id, 'string' - field :arpu_180d, 'double' - field :arpu_1d, 'double' - field :arpu_30d, 'double' - field :arpu_365d, 'double' - field :arpu_3d, 'double' - field :arpu_7d, 'double' - field :arpu_90d, 'double' - field :campaign_group_id, 'string' - field :campaign_id, 'string' - field :date_start, 'string' - field :date_stop, 'string' - field :installs, 'int' - field :revenue, 'double' - field :revenue_180d, 'double' - field :revenue_1d, 'double' - field :revenue_30d, 'double' - field :revenue_365d, 'double' - field :revenue_3d, 'double' - field :revenue_7d, 'double' - field :revenue_90d, 'double' - field :spend, 'double' - field :yield_180d, 'double' - field :yield_1d, 'double' - field :yield_30d, 'double' - field :yield_365d, 'double' - field :yield_3d, 'double' - field :yield_7d, 'double' - field :yield_90d, 'double' - 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 e971d115..1c6c5c2b 100644 --- a/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb +++ b/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb @@ -95,6 +95,7 @@ class AdAccountTargetingUnified < AdObject "effective_facebook_positions", "effective_instagram_positions", "effective_messenger_positions", + "effective_oculus_positions", "effective_publisher_platforms", "effective_whatsapp_positions", "engagement_specs", @@ -153,6 +154,7 @@ class AdAccountTargetingUnified < AdObject "mobile_device_model", "moms", "net_worth", + "oculus_positions", "office_type", "page_types", "place_page_set_ids", @@ -191,6 +193,7 @@ class AdAccountTargetingUnified < AdObject "fb_android_store", "fb_canvas", "fb_gameroom", + "galaxy_store", "google_play", "instant_game", "itunes", @@ -211,7 +214,6 @@ class AdAccountTargetingUnified < AdObject "LOCAL_AWARENESS", "MESSAGES", "OFFER_CLAIMS", - "OUTCOME_LEADS", "PAGE_LIKES", "POST_ENGAGEMENT", "PRODUCT_CATALOG_SALES", diff --git a/lib/facebook_ads/ad_objects/ad_asset_feed_spec.rb b/lib/facebook_ads/ad_objects/ad_asset_feed_spec.rb index 86dac460..9108bc52 100644 --- a/lib/facebook_ads/ad_objects/ad_asset_feed_spec.rb +++ b/lib/facebook_ads/ad_objects/ad_asset_feed_spec.rb @@ -73,6 +73,7 @@ class AdAssetFeedSpec < AdObject "SEE_MORE", "SELL_NOW", "SEND_A_GIFT", + "SEND_GIFT_MONEY", "SHARE", "SHOP_NOW", "SIGN_UP", @@ -85,6 +86,7 @@ class AdAssetFeedSpec < AdObject "USE_APP", "USE_MOBILE_APP", "VIDEO_ANNOTATION", + "VIDEO_CALL", "VISIT_PAGES_FEED", "WATCH_MORE", "WATCH_VIDEO", @@ -106,6 +108,7 @@ class AdAssetFeedSpec < AdObject field :groups, { list: 'AdAssetFeedSpecGroupRule' } field :images, { list: 'AdAssetFeedSpecImage' } field :link_urls, { list: 'AdAssetFeedSpecLinkUrl' } + field :onsite_destinations, { list: 'object' } field :optimization_type, 'string' field :posts, { list: 'object' } field :titles, { list: 'AdAssetFeedSpecTitle' } diff --git a/lib/facebook_ads/ad_objects/ad_campaign_activity.rb b/lib/facebook_ads/ad_objects/ad_campaign_activity.rb index b3c94683..d0ee1260 100644 --- a/lib/facebook_ads/ad_objects/ad_campaign_activity.rb +++ b/lib/facebook_ads/ad_objects/ad_campaign_activity.rb @@ -30,14 +30,12 @@ class AdCampaignActivity < AdObject "COST_CAP", "LOWEST_COST_WITHOUT_CAP", "LOWEST_COST_WITH_BID_CAP", - "TARGET_COST", ] BID_STRATEGY_OLD = [ "COST_CAP", "LOWEST_COST_WITHOUT_CAP", "LOWEST_COST_WITH_BID_CAP", - "TARGET_COST", ] BILLING_EVENT_NEW = [ @@ -45,10 +43,12 @@ class AdCampaignActivity < AdObject "CLICKS", "IMPRESSIONS", "LINK_CLICKS", + "LISTING_INTERACTION", "NONE", "OFFER_CLAIMS", "PAGE_LIKES", "POST_ENGAGEMENT", + "PURCHASE", "THRUPLAY", ] @@ -57,10 +57,12 @@ class AdCampaignActivity < AdObject "CLICKS", "IMPRESSIONS", "LINK_CLICKS", + "LISTING_INTERACTION", "NONE", "OFFER_CLAIMS", "PAGE_LIKES", "POST_ENGAGEMENT", + "PURCHASE", "THRUPLAY", ] @@ -83,6 +85,7 @@ class AdCampaignActivity < AdObject "PAGE_ENGAGEMENT", "PAGE_LIKES", "POST_ENGAGEMENT", + "QUALITY_CALL", "QUALITY_LEAD", "REACH", "REPLIES", @@ -112,6 +115,7 @@ class AdCampaignActivity < AdObject "PAGE_ENGAGEMENT", "PAGE_LIKES", "POST_ENGAGEMENT", + "QUALITY_CALL", "QUALITY_LEAD", "REACH", "REPLIES", diff --git a/lib/facebook_ads/ad_objects/ad_campaign_delivery_estimate.rb b/lib/facebook_ads/ad_objects/ad_campaign_delivery_estimate.rb index f31a3f87..6d4d04bd 100644 --- a/lib/facebook_ads/ad_objects/ad_campaign_delivery_estimate.rb +++ b/lib/facebook_ads/ad_objects/ad_campaign_delivery_estimate.rb @@ -45,6 +45,7 @@ class AdCampaignDeliveryEstimate < AdObject "PAGE_ENGAGEMENT", "PAGE_LIKES", "POST_ENGAGEMENT", + "QUALITY_CALL", "QUALITY_LEAD", "REACH", "REPLIES", diff --git a/lib/facebook_ads/ad_objects/ad_creative.rb b/lib/facebook_ads/ad_objects/ad_creative.rb index 19073386..804ec264 100644 --- a/lib/facebook_ads/ad_objects/ad_creative.rb +++ b/lib/facebook_ads/ad_objects/ad_creative.rb @@ -26,12 +26,6 @@ module FacebookAds # pull request for this class. class AdCreative < AdObject - APPLINK_TREATMENT = [ - "deeplink_with_appstore_fallback", - "deeplink_with_web_fallback", - "web_only", - ] - CALL_TO_ACTION_TYPE = [ "ADD_TO_CART", "APPLY_NOW", @@ -79,6 +73,7 @@ class AdCreative < AdObject "SEE_MORE", "SELL_NOW", "SEND_A_GIFT", + "SEND_GIFT_MONEY", "SHARE", "SHOP_NOW", "SIGN_UP", @@ -91,6 +86,7 @@ class AdCreative < AdObject "USE_APP", "USE_MOBILE_APP", "VIDEO_ANNOTATION", + "VIDEO_CALL", "VISIT_PAGES_FEED", "WATCH_MORE", "WATCH_VIDEO", @@ -121,6 +117,12 @@ class AdCreative < AdObject "WITH_ISSUES", ] + APPLINK_TREATMENT = [ + "deeplink_with_appstore_fallback", + "deeplink_with_web_fallback", + "web_only", + ] + AUTHORIZATION_CATEGORY = [ "NONE", "POLITICAL", @@ -158,7 +160,7 @@ class AdCreative < AdObject field :account_id, 'string' field :actor_id, 'string' field :adlabels, { list: 'AdLabel' } - field :applink_treatment, { enum: -> { APPLINK_TREATMENT }} + field :applink_treatment, 'string' field :asset_feed_spec, 'AdAssetFeedSpec' field :authorization_category, 'string' field :auto_update, 'bool' 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 21bc3e2c..3d6869bd 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 @@ -73,6 +73,7 @@ class AdCreativeLinkDataCallToAction < AdObject "SEE_MORE", "SELL_NOW", "SEND_A_GIFT", + "SEND_GIFT_MONEY", "SHARE", "SHOP_NOW", "SIGN_UP", @@ -85,6 +86,7 @@ class AdCreativeLinkDataCallToAction < AdObject "USE_APP", "USE_MOBILE_APP", "VIDEO_ANNOTATION", + "VIDEO_CALL", "VISIT_PAGES_FEED", "WATCH_MORE", "WATCH_VIDEO", diff --git a/lib/facebook_ads/ad_objects/read_only_analytics_user_property_config.rb b/lib/facebook_ads/ad_objects/ad_creative_omnichannel_link_spec.rb similarity index 91% rename from lib/facebook_ads/ad_objects/read_only_analytics_user_property_config.rb rename to lib/facebook_ads/ad_objects/ad_creative_omnichannel_link_spec.rb index 09cd1ac6..82e3adef 100644 --- a/lib/facebook_ads/ad_objects/read_only_analytics_user_property_config.rb +++ b/lib/facebook_ads/ad_objects/ad_creative_omnichannel_link_spec.rb @@ -25,10 +25,12 @@ module FacebookAds # on github and we'll fix in our codegen framework. We'll not be able to accept # pull request for this class. - class ReadOnlyAnalyticsUserPropertyConfig < AdObject + class AdCreativeOmnichannelLinkSpec < AdObject - field :active_properties, { list: 'string' } - field :id, 'string' + field :app, 'object' + field :web, 'object' + has_no_id + has_no_get has_no_post has_no_delete diff --git a/lib/facebook_ads/ad_objects/ad_creative_portrait_customizations.rb b/lib/facebook_ads/ad_objects/ad_creative_portrait_customizations.rb index 179410a8..5c22c850 100644 --- a/lib/facebook_ads/ad_objects/ad_creative_portrait_customizations.rb +++ b/lib/facebook_ads/ad_objects/ad_creative_portrait_customizations.rb @@ -27,6 +27,7 @@ module FacebookAds class AdCreativePortraitCustomizations < AdObject + field :carousel_delivery_mode, 'string' field :specifications, { list: 'object' } has_no_id has_no_get diff --git a/lib/facebook_ads/ad_objects/ad_preview.rb b/lib/facebook_ads/ad_objects/ad_preview.rb index d7bf2f5d..a49d6894 100644 --- a/lib/facebook_ads/ad_objects/ad_preview.rb +++ b/lib/facebook_ads/ad_objects/ad_preview.rb @@ -33,12 +33,16 @@ class AdPreview < AdObject "AUDIENCE_NETWORK_REWARDED_VIDEO", "DESKTOP_FEED_STANDARD", "FACEBOOK_STORY_MOBILE", + "FACEBOOK_STORY_STICKER_MOBILE", "INSTAGRAM_EXPLORE_CONTEXTUAL", "INSTAGRAM_EXPLORE_IMMERSIVE", + "INSTAGRAM_REELS", "INSTAGRAM_STANDARD", "INSTAGRAM_STORY", "INSTANT_ARTICLE_RECIRCULATION_AD", "INSTANT_ARTICLE_STANDARD", + "INSTREAM_BANNER_DESKTOP", + "INSTREAM_BANNER_MOBILE", "INSTREAM_VIDEO_DESKTOP", "INSTREAM_VIDEO_IMAGE", "INSTREAM_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 c20b3b20..32349804 100644 --- a/lib/facebook_ads/ad_objects/ad_report_run.rb +++ b/lib/facebook_ads/ad_objects/ad_report_run.rb @@ -60,6 +60,7 @@ class AdReportRun < AdObject field :time_range, 'object' field :time_ranges, { list: 'object' } field :use_account_attribution_setting, 'bool' + field :use_unified_attribution_setting, 'bool' has_no_post has_no_delete diff --git a/lib/facebook_ads/ad_objects/ad_rule_evaluation_spec.rb b/lib/facebook_ads/ad_objects/ad_rule_evaluation_spec.rb index 3c1da8d4..278b8407 100644 --- a/lib/facebook_ads/ad_objects/ad_rule_evaluation_spec.rb +++ b/lib/facebook_ads/ad_objects/ad_rule_evaluation_spec.rb @@ -35,8 +35,7 @@ class AdRuleEvaluationSpec < AdObject field :evaluation_type, { enum: -> { EVALUATION_TYPE }} field :filters, { list: 'AdRuleFilters' } field :trigger, 'AdRuleTrigger' - has_no_id - has_no_get + field :id, 'string' has_no_post has_no_delete diff --git a/lib/facebook_ads/ad_objects/ad_rule_execution_spec.rb b/lib/facebook_ads/ad_objects/ad_rule_execution_spec.rb index 3bb3e318..d3d0ce92 100644 --- a/lib/facebook_ads/ad_objects/ad_rule_execution_spec.rb +++ b/lib/facebook_ads/ad_objects/ad_rule_execution_spec.rb @@ -45,8 +45,7 @@ class AdRuleExecutionSpec < AdObject field :execution_options, { list: 'AdRuleExecutionOptions' } field :execution_type, { enum: -> { EXECUTION_TYPE }} - has_no_id - has_no_get + field :id, 'string' 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 0ead0e40..0d65433a 100644 --- a/lib/facebook_ads/ad_objects/ad_set.rb +++ b/lib/facebook_ads/ad_objects/ad_set.rb @@ -30,7 +30,6 @@ class AdSet < AdObject "COST_CAP", "LOWEST_COST_WITHOUT_CAP", "LOWEST_COST_WITH_BID_CAP", - "TARGET_COST", ] BILLING_EVENT = [ @@ -38,10 +37,12 @@ class AdSet < AdObject "CLICKS", "IMPRESSIONS", "LINK_CLICKS", + "LISTING_INTERACTION", "NONE", "OFFER_CLAIMS", "PAGE_LIKES", "POST_ENGAGEMENT", + "PURCHASE", "THRUPLAY", ] @@ -81,6 +82,7 @@ class AdSet < AdObject "PAGE_ENGAGEMENT", "PAGE_LIKES", "POST_ENGAGEMENT", + "QUALITY_CALL", "QUALITY_LEAD", "REACH", "REPLIES", @@ -110,7 +112,7 @@ class AdSet < AdObject "last_week_mon_sun", "last_week_sun_sat", "last_year", - "lifetime", + "maximum", "this_month", "this_quarter", "this_week_mon_today", @@ -355,6 +357,7 @@ class AdSet < AdObject api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } api.has_param :use_account_attribution_setting, 'bool' + api.has_param :use_unified_attribution_setting, 'bool' end edge.post 'AdReportRun' do |api| api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} } @@ -377,6 +380,7 @@ class AdSet < AdObject api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } api.has_param :use_account_attribution_setting, 'bool' + api.has_param :use_unified_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 b757247c..e4eea9ef 100644 --- a/lib/facebook_ads/ad_objects/ad_study.rb +++ b/lib/facebook_ads/ad_objects/ad_study.rb @@ -40,6 +40,7 @@ class AdStudy < AdObject field :cooldown_start_time, 'datetime' field :created_by, 'User' field :created_time, 'datetime' + field :datasets_information, { list: 'string' } field :description, 'string' field :end_time, 'datetime' field :id, 'string' @@ -60,19 +61,15 @@ class AdStudy < AdObject edge.get 'AdStudyCell' end + has_edge :instances do |edge| + edge.get 'PrivateLiftStudyInstance' + edge.post 'PrivateLiftStudyInstance' do |api| + api.has_param :breakdown_key, 'hash' + end + end + has_edge :objectives do |edge| edge.get 'AdStudyObjective' - 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 :offline_conversion_data_sets, { list: 'object' } - api.has_param :product_catalogs, { list: 'object' } - api.has_param :product_sets, { list: 'object' } - api.has_param :type, { enum: -> { AdStudyObjective::TYPE }} - end end end diff --git a/lib/facebook_ads/ad_objects/ad_study_objective.rb b/lib/facebook_ads/ad_objects/ad_study_objective.rb index 122252e4..6ce56cb3 100644 --- a/lib/facebook_ads/ad_objects/ad_study_objective.rb +++ b/lib/facebook_ads/ad_objects/ad_study_objective.rb @@ -27,11 +27,13 @@ module FacebookAds class AdStudyObjective < AdObject TYPE = [ + "AEP_CONVERSION", "BRAND", "BRANDLIFT", "FTL", "MAE", "MAI", + "MPC_CONVERSION", "NONSALES", "PARTNER", "SALES", @@ -45,6 +47,7 @@ class AdStudyObjective < AdObject field :name, 'string' field :results, { list: 'string' } field :type, 'string' + has_no_delete has_edge :ad_place_page_sets do |edge| edge.get 'AdPlacePageSet' diff --git a/lib/facebook_ads/ad_objects/ad_video.rb b/lib/facebook_ads/ad_objects/ad_video.rb index 5b275823..6f360875 100644 --- a/lib/facebook_ads/ad_objects/ad_video.rb +++ b/lib/facebook_ads/ad_objects/ad_video.rb @@ -27,6 +27,7 @@ module FacebookAds class AdVideo < AdObject CONTAINER_TYPE = [ + "ACO_AUTOEXTRACTED_VIDEO", "ACO_VIDEO_VARIATION", "AD_BREAK_PREVIEW", "AD_DERIVATIVE", @@ -37,8 +38,6 @@ class AdVideo < AdObject "APP_REVIEW_SCREENCAST", "ATLAS_VIDEO", "AUDIO_BROADCAST", - "BELL_POLL", - "BRAND_EQUITY_POLL_VIDEO", "BROADCAST", "CANDIDATE_VIDEOS", "CANVAS", @@ -47,6 +46,7 @@ class AdVideo < AdObject "CONTAINED_POST_ATTACHMENT", "CONTAINED_POST_AUDIO_BROADCAST", "CONTAINED_POST_BROADCAST", + "CONTAINED_POST_COPYRIGHT_REFERENCE_BROADCAST", "COPYRIGHT_REFERENCE_BROADCAST", "COPYRIGHT_REFERENCE_VIDEO", "CULTURAL_MOMENT_DEPRECATED", @@ -64,9 +64,10 @@ class AdVideo < AdObject "EVENT_TOUR", "FACECAST_DVR", "FB_SHORTS", + "FB_SHORTS_GROUP_POST", + "FB_SHORTS_POST", "FUNDRAISER_COVER_VIDEO", "GAME_CLIP", - "GAMING_UPDATE_VIDEO", "GEMSTONE", "GOODWILL_ANNIVERSARY_DEPRECATED", "GOODWILL_ANNIVERSARY_PROMOTION_DEPRECATED", @@ -75,9 +76,11 @@ class AdVideo < AdObject "GOODWILL_VIDEO_SHARE", "GOODWILL_VIDEO_TOKEN_REQUIRED", "GROUP_POST", + "HACK_TV", "HEURISTIC_CLUSTER_VIDEO", "HEURISTIC_PREVIEW", "HIGHLIGHT_CLIP_VIDEO", + "HUDDLE_BROADCAST", "IG_REELS_XPV", "IG_STORIES_READER", "INSPIRATION_VIDEO", @@ -86,6 +89,7 @@ class AdVideo < AdObject "INSTANT_ARTICLE", "INSTANT_GAME_CLIP", "ISSUE_MODULE", + "JOBS_VISUAL_INTRO_ENTRY", "JOB_APPLICATION_VIDEO", "JOB_OPENING_VIDEO", "KOTOTORO", @@ -97,7 +101,6 @@ class AdVideo < AdObject "LOOK_NOW_DEPRECATED", "MARKETPLACE_LISTING_VIDEO", "MARKETPLACE_PRE_RECORDED_VIDEO", - "MOMENTS_VIDEO", "NEO_ASYNC_GAME_VIDEO", "NO_STORY", "NO_STORY_WITH_ENTPOST", @@ -107,13 +110,17 @@ class AdVideo < AdObject "PAGES_COVER_VIDEO", "PAGE_REVIEW_SCREENCAST", "PAGE_SLIDESHOW_VIDEO", + "PARTNER_DIRECTORY_BRAND_MEDIA", "PIXELCLOUD", + "PODCAST_RSS", + "PODCAST_VOICES", "PREMIERE_SOURCE", + "PREMIUM_MUSIC_VIDEO_NO_NEWSFEED_STORY", + "PREMIUM_MUSIC_VIDEO_WITH_NEWSFEED_STORY", "PRIVATE_GALLERY_VIDEO", "PRODUCT_VIDEO", "PROFILE_COVER_VIDEO", "PROFILE_INTRO_CARD", - "PROFILE_TO_PAGE_UPLOADED_VIDEO", "PROFILE_VIDEO", "PROTON", "QUICK_PROMOTION", @@ -125,7 +132,9 @@ class AdVideo < AdObject "SLIDESHOW_SHAKR", "SLIDESHOW_VARIATION_VIDEO", "SOTTO_CONTENT", + "SOUNDBITES_VIDEO", "SOUND_PLATFORM_STREAM", + "SRT_ATTACHMENT", "STORIES_VIDEO", "STORYLINE", "STORYLINE_WITH_EXTERNAL_MUSIC", @@ -135,7 +144,10 @@ class AdVideo < AdObject "TAROT_DIGEST", "TEMP_MULTIMEDIA_POST", "UNLISTED", + "UNLISTED_HACK_TV", + "UNLISTED_OCULUS", "VIDEO_COMMENT", + "VIDEO_COMPOSITION_VARIATION", "VIDEO_CREATIVE_EDITOR_AUTOGEN_AD_VIDEO", "VIDEO_SUPERRES", "VU_GENERATED_VIDEO", @@ -239,7 +251,7 @@ class AdVideo < AdObject field :live_audience_count, 'int' field :live_status, 'string' field :music_video_copyright, 'MusicVideoCopyright' - field :permalink_url, 'string' + field :permalink_url, 'object' field :picture, 'string' field :place, 'Place' field :premiere_living_room_status, 'string' @@ -256,7 +268,6 @@ class AdVideo < AdObject field :animated_effect_id, 'int' field :application_id, 'string' field :asked_fun_fact_prompt_id, 'int' - field :attribution_app_id, 'string' field :audio_story_wave_animation_handle, 'string' field :chunk_session_id, 'string' field :composer_entry_picker, 'string' @@ -385,16 +396,6 @@ class AdVideo < AdObject end end - has_edge :reactions do |edge| - edge.get 'Profile' do |api| - api.has_param :type, { enum: -> { Profile::TYPE }} - end - end - - has_edge :sharedposts do |edge| - edge.get 'Post' - end - has_edge :sponsor_tags do |edge| edge.get 'Page' end diff --git a/lib/facebook_ads/ad_objects/adgroup_activity.rb b/lib/facebook_ads/ad_objects/adgroup_activity.rb index 7fe9e1cb..7b014a9b 100644 --- a/lib/facebook_ads/ad_objects/adgroup_activity.rb +++ b/lib/facebook_ads/ad_objects/adgroup_activity.rb @@ -115,8 +115,6 @@ class AdgroupActivity < AdObject field :target_spec_id_old, 'string' field :targets_spec_new, 'object' field :targets_spec_old, 'object' - field :tracking_pixel_ids_new, { list: 'string' } - field :tracking_pixel_ids_old, { list: 'string' } field :tracking_specs_new, { list: 'object' } field :tracking_specs_old, { list: 'object' } field :update_time_new, 'datetime' diff --git a/lib/facebook_ads/ad_objects/adgroup_placement_specific_review_feedback.rb b/lib/facebook_ads/ad_objects/adgroup_placement_specific_review_feedback.rb index 322fd22f..b0244243 100644 --- a/lib/facebook_ads/ad_objects/adgroup_placement_specific_review_feedback.rb +++ b/lib/facebook_ads/ad_objects/adgroup_placement_specific_review_feedback.rb @@ -44,6 +44,7 @@ class AdgroupPlacementSpecificReviewFeedback < AdObject field :facebook_pages_live_shopping, 'hash' field :instagram, 'hash' field :instagram_shop, 'hash' + field :job_search, 'hash' field :lead_gen_honeypot, 'hash' field :marketplace, 'hash' field :marketplace_home_rentals, 'hash' diff --git a/lib/facebook_ads/ad_objects/adoptable_pet.rb b/lib/facebook_ads/ad_objects/adoptable_pet.rb index f323a371..86b10668 100644 --- a/lib/facebook_ads/ad_objects/adoptable_pet.rb +++ b/lib/facebook_ads/ad_objects/adoptable_pet.rb @@ -26,6 +26,15 @@ module FacebookAds # pull request for this class. class AdoptablePet < AdObject + IMAGE_FETCH_STATUS = [ + "DIRECT_UPLOAD", + "FETCHED", + "FETCH_FAILED", + "NO_STATUS", + "OUTDATED", + "PARTIAL_FETCH", + ] + field :address, 'object' field :adoptable_pet_id, 'string' @@ -43,6 +52,7 @@ class AdoptablePet < AdObject field :features, { list: 'string' } field :gender, 'string' field :id, 'string' + field :image_fetch_status, { enum: -> { IMAGE_FETCH_STATUS }} field :images, { list: 'string' } field :name, 'string' field :price, 'string' @@ -58,5 +68,13 @@ class AdoptablePet < AdObject has_no_post has_no_delete + has_edge :augmented_realities_metadata do |edge| + edge.get + end + + has_edge :videos_metadata do |edge| + edge.get + end + end end diff --git a/lib/facebook_ads/ad_objects/ads_action_stats.rb b/lib/facebook_ads/ad_objects/ads_action_stats.rb index 0cb2b1a0..c8a5bf26 100644 --- a/lib/facebook_ads/ad_objects/ads_action_stats.rb +++ b/lib/facebook_ads/ad_objects/ads_action_stats.rb @@ -33,10 +33,12 @@ class AdsActionStats < AdObject field :_28d_view, 'string' field :_7d_click, 'string' field :_7d_view, 'string' + field :action_brand, 'string' field :action_canvas_component_id, 'string' field :action_canvas_component_name, 'string' field :action_carousel_card_id, 'string' field :action_carousel_card_name, 'string' + field :action_category, 'string' field :action_converted_product_id, 'string' field :action_destination, 'string' field :action_device, 'string' diff --git a/lib/facebook_ads/ad_objects/ads_insights.rb b/lib/facebook_ads/ad_objects/ads_insights.rb index 9e4c719a..12d1de6b 100644 --- a/lib/facebook_ads/ad_objects/ads_insights.rb +++ b/lib/facebook_ads/ad_objects/ads_insights.rb @@ -93,7 +93,7 @@ class AdsInsights < AdObject "last_week_mon_sun", "last_week_sun_sat", "last_year", - "lifetime", + "maximum", "this_month", "this_quarter", "this_week_mon_today", @@ -146,6 +146,7 @@ class AdsInsights < AdObject field :adset_name, 'string' field :adset_start, 'string' field :age_targeting, 'string' + field :attribution_setting, 'string' field :auction_bid, 'string' field :auction_competitiveness, 'string' field :auction_max_competitor_bid, 'string' @@ -214,6 +215,7 @@ class AdsInsights < AdObject field :location, 'string' field :mobile_app_purchase_roas, { list: 'AdsActionStats' } field :objective, 'string' + field :optimization_goal, 'string' field :outbound_clicks, { list: 'AdsActionStats' } field :outbound_clicks_ctr, { list: 'AdsActionStats' } field :place_page_name, 'string' diff --git a/lib/facebook_ads/ad_objects/ads_pixel.rb b/lib/facebook_ads/ad_objects/ads_pixel.rb index 7a48fea3..d9a77264 100644 --- a/lib/facebook_ads/ad_objects/ads_pixel.rb +++ b/lib/facebook_ads/ad_objects/ads_pixel.rb @@ -73,6 +73,7 @@ class AdsPixel < AdObject field :first_party_cookie_status, 'string' field :id, 'string' field :is_created_by_business, 'bool' + field :is_crm, 'bool' field :is_unavailable, 'bool' field :last_fired_time, 'datetime' field :name, 'string' @@ -110,6 +111,10 @@ class AdsPixel < AdObject end end + has_edge :shadowtraffichelper do |edge| + edge.post + end + has_edge :shared_accounts do |edge| edge.delete do |api| api.has_param :account_id, 'string' diff --git a/lib/facebook_ads/ad_objects/album.rb b/lib/facebook_ads/ad_objects/album.rb index 17ee524b..458b35f2 100644 --- a/lib/facebook_ads/ad_objects/album.rb +++ b/lib/facebook_ads/ad_objects/album.rb @@ -152,15 +152,5 @@ class Album < AdObject end end - has_edge :reactions do |edge| - edge.get 'Profile' do |api| - api.has_param :type, { enum: -> { Profile::TYPE }} - end - end - - has_edge :sharedposts do |edge| - edge.get 'Post' - end - end end diff --git a/lib/facebook_ads/ad_objects/application.rb b/lib/facebook_ads/ad_objects/application.rb index 9945367b..6678965a 100644 --- a/lib/facebook_ads/ad_objects/application.rb +++ b/lib/facebook_ads/ad_objects/application.rb @@ -36,6 +36,7 @@ class Application < AdObject "IPHONE", "MOBILE_WEB", "OCULUS", + "SAMSUNG", "SUPPLEMENTARY_IMAGES", "WEB", "WINDOWS", @@ -47,6 +48,7 @@ class Application < AdObject "INSTANT_ARTICLES", "IOS", "MOBILE_WEB", + "OCULUS", "UNKNOWN", ] @@ -287,6 +289,18 @@ class Application < AdObject end end + has_edge :aem_conversion_configs do |edge| + edge.get do |api| + api.has_param :advertiser_ids, { list: 'string' } + end + end + + has_edge :aem_conversions do |edge| + edge.post do |api| + api.has_param :aem_conversions, { list: 'hash' } + end + end + has_edge :agencies do |edge| edge.get 'Business' end @@ -296,6 +310,7 @@ class Application < AdObject api.has_param :ecpms, { list: 'string' } api.has_param :query_ids, { list: 'string' } api.has_param :request_id, 'string' + api.has_param :sync_api, 'bool' end end @@ -471,12 +486,6 @@ class Application < AdObject end end - has_edge :live_videos do |edge| - edge.get 'LiveVideo' do |api| - api.has_param :broadcast_status, { enum: -> { LiveVideo::BROADCAST_STATUS }} - end - end - has_edge :mmp_auditing do |edge| edge.post do |api| api.has_param :advertiser_id, 'string' @@ -513,10 +522,6 @@ class Application < AdObject end end - has_edge :ozone_release do |edge| - edge.get - end - has_edge :page_activities do |edge| edge.post 'Application' do |api| api.has_param :advertiser_tracking_enabled, 'bool' @@ -560,6 +565,13 @@ class Application < AdObject end end + has_edge :push_token_register do |edge| + edge.post do |api| + api.has_param :device_id, 'string' + api.has_param :push_token, 'string' + end + end + has_edge :roles do |edge| edge.get end diff --git a/lib/facebook_ads/ad_objects/atlas_campaign.rb b/lib/facebook_ads/ad_objects/atlas_campaign.rb index a93bb0d6..d5011087 100644 --- a/lib/facebook_ads/ad_objects/atlas_campaign.rb +++ b/lib/facebook_ads/ad_objects/atlas_campaign.rb @@ -34,14 +34,6 @@ class AtlasCampaign < AdObject field :cost_per_visit, 'double' field :created_by, 'object' field :created_date, 'datetime' - field :data_driven_convs, 'double' - field :data_driven_convs_per_1k_impress, 'double' - field :data_driven_convs_per_click, 'double' - field :data_driven_convs_per_visit, 'double' - field :data_driven_cpa, 'double' - field :data_driven_nullable_convs, 'double' - field :data_driven_revenue, 'double' - field :data_driven_roas, 'double' field :even_credit_convs, 'double' field :even_credit_convs_per_1k_impress, 'double' field :even_credit_convs_per_click, 'double' diff --git a/lib/facebook_ads/ad_objects/automotive_model.rb b/lib/facebook_ads/ad_objects/automotive_model.rb index 3c321f85..f52e48ff 100644 --- a/lib/facebook_ads/ad_objects/automotive_model.rb +++ b/lib/facebook_ads/ad_objects/automotive_model.rb @@ -26,6 +26,40 @@ module FacebookAds # pull request for this class. class AutomotiveModel < AdObject + IMAGE_FETCH_STATUS = [ + "DIRECT_UPLOAD", + "FETCHED", + "FETCH_FAILED", + "NO_STATUS", + "OUTDATED", + "PARTIAL_FETCH", + ] + + BODY_STYLE = [ + "CONVERTIBLE", + "COUPE", + "CROSSOVER", + "ESTATE", + "GRANDTOURER", + "HATCHBACK", + "MINIBUS", + "MINIVAN", + "MPV", + "NONE", + "OTHER", + "PICKUP", + "ROADSTER", + "SALOON", + "SEDAN", + "SPORTSCAR", + "SUPERCAR", + "SUPERMINI", + "SUV", + "TRUCK", + "VAN", + "WAGON", + ] + field :applinks, 'CatalogItemAppLinks' field :automotive_model_id, 'string' @@ -42,6 +76,7 @@ class AutomotiveModel < AdObject field :fuel_type, 'string' field :generation, 'string' field :id, 'string' + field :image_fetch_status, { enum: -> { IMAGE_FETCH_STATUS }} field :images, { list: 'string' } field :interior_color, 'string' field :interior_upholstery, 'string' @@ -57,5 +92,13 @@ class AutomotiveModel < AdObject has_no_post has_no_delete + has_edge :augmented_realities_metadata do |edge| + edge.get + end + + has_edge :videos_metadata do |edge| + edge.get + end + end end diff --git a/lib/facebook_ads/ad_objects/business.rb b/lib/facebook_ads/ad_objects/business.rb index 5ab7c272..456aaedf 100644 --- a/lib/facebook_ads/ad_objects/business.rb +++ b/lib/facebook_ads/ad_objects/business.rb @@ -60,6 +60,7 @@ class Business < AdObject PERMITTED_TASKS = [ "ADVERTISE", "ANALYZE", + "DRAFT", "MANAGE", ] @@ -86,6 +87,7 @@ class Business < AdObject "PROFILE_PLUS_ADVERTISE", "PROFILE_PLUS_ANALYZE", "PROFILE_PLUS_CREATE_CONTENT", + "PROFILE_PLUS_FACEBOOK_ACCESS", "PROFILE_PLUS_MANAGE", "PROFILE_PLUS_MESSAGING", "PROFILE_PLUS_MODERATE", @@ -204,6 +206,7 @@ class Business < AdObject api.has_param :sort_by, { enum: -> { AdsPixel::SORT_BY }} end edge.post 'AdsPixel' do |api| + api.has_param :is_crm, 'bool' api.has_param :name, 'string' end end @@ -220,6 +223,7 @@ class Business < AdObject api.has_param :ecpms, { list: 'string' } api.has_param :query_ids, { list: 'string' } api.has_param :request_id, 'string' + api.has_param :sync_api, 'bool' end end @@ -238,14 +242,14 @@ class Business < AdObject end has_edge :business_invoices do |edge| - edge.get 'OracleTransaction' do |api| + edge.get 'OmegaCustomerTrx' do |api| api.has_param :end_date, 'string' - api.has_param :invoice_id, 'int' + api.has_param :invoice_id, 'string' api.has_param :issue_end_date, 'string' api.has_param :issue_start_date, 'string' api.has_param :root_id, 'int' api.has_param :start_date, 'string' - api.has_param :type, { enum: -> { OracleTransaction::TYPE }} + api.has_param :type, { enum: -> { OmegaCustomerTrx::TYPE }} end end @@ -258,6 +262,10 @@ class Business < AdObject has_edge :business_users do |edge| edge.get 'BusinessUser' + edge.post 'BusinessUser' do |api| + api.has_param :email, 'string' + api.has_param :role, { enum: -> { BusinessUser::ROLE }} + end end has_edge :claim_custom_conversions do |edge| @@ -380,12 +388,32 @@ class Business < AdObject end end + has_edge :extendedcreditapplications do |edge| + edge.get do |api| + api.has_param :only_show_pending, 'bool' + end + end + has_edge :extendedcredits do |edge| edge.get 'ExtendedCredit' do |api| api.has_param :order_by_is_owned_credential, 'bool' end end + has_edge :franchise_programs do |edge| + edge.post do |api| + api.has_param :business_asset_group, 'string' + api.has_param :creative_folder, 'string' + api.has_param :creative_spec_template_data, 'hash' + api.has_param :description, 'string' + api.has_param :end_date, 'datetime' + api.has_param :name, 'string' + api.has_param :program_approval_type, { enum: %w{APPROVAL PUBLIC }} + api.has_param :shared_custom_audience, 'string' + api.has_param :start_date, 'datetime' + end + end + has_edge :initiated_audience_sharing_requests do |edge| edge.get 'BusinessAssetSharingAgreement' do |api| api.has_param :recipient_id, 'string' @@ -577,8 +605,17 @@ class Business < AdObject end end + has_edge :spaco_dataset_collections do |edge| + edge.get + end + has_edge :system_users do |edge| edge.get 'SystemUser' + edge.post 'SystemUser' do |api| + api.has_param :name, 'string' + api.has_param :role, { enum: -> { SystemUser::ROLE }} + api.has_param :system_user_id, 'int' + end end has_edge :third_party_measurement_report_dataset do |edge| diff --git a/lib/facebook_ads/ad_objects/business_asset_group.rb b/lib/facebook_ads/ad_objects/business_asset_group.rb index cd9138da..7b375490 100644 --- a/lib/facebook_ads/ad_objects/business_asset_group.rb +++ b/lib/facebook_ads/ad_objects/business_asset_group.rb @@ -29,6 +29,7 @@ class BusinessAssetGroup < AdObject ADACCOUNT_TASKS = [ "ADVERTISE", "ANALYZE", + "DRAFT", "MANAGE", ] @@ -55,6 +56,7 @@ class BusinessAssetGroup < AdObject "PROFILE_PLUS_ADVERTISE", "PROFILE_PLUS_ANALYZE", "PROFILE_PLUS_CREATE_CONTENT", + "PROFILE_PLUS_FACEBOOK_ACCESS", "PROFILE_PLUS_MANAGE", "PROFILE_PLUS_MESSAGING", "PROFILE_PLUS_MODERATE", diff --git a/lib/facebook_ads/ad_objects/campaign.rb b/lib/facebook_ads/ad_objects/campaign.rb index b940809c..d160ecc9 100644 --- a/lib/facebook_ads/ad_objects/campaign.rb +++ b/lib/facebook_ads/ad_objects/campaign.rb @@ -30,7 +30,6 @@ class Campaign < AdObject "COST_CAP", "LOWEST_COST_WITHOUT_CAP", "LOWEST_COST_WITH_BID_CAP", - "TARGET_COST", ] CONFIGURED_STATUS = [ @@ -68,7 +67,7 @@ class Campaign < AdObject "last_week_mon_sun", "last_week_sun_sat", "last_year", - "lifetime", + "maximum", "this_month", "this_quarter", "this_week_mon_today", @@ -93,7 +92,6 @@ class Campaign < AdObject "LOCAL_AWARENESS", "MESSAGES", "OFFER_CLAIMS", - "OUTCOME_LEADS", "PAGE_LIKES", "POST_ENGAGEMENT", "PRODUCT_CATALOG_SALES", @@ -405,6 +403,7 @@ class Campaign < AdObject field :daily_budget, 'string' field :effective_status, { enum: -> { EFFECTIVE_STATUS }} field :id, 'string' + field :is_skadnetwork_attribution, 'bool' field :issues_info, { list: 'AdCampaignIssuesInfo' } field :last_budget_toggling_time, 'datetime' field :lifetime_budget, 'string' @@ -413,6 +412,7 @@ class Campaign < AdObject field :pacing_type, { list: 'string' } field :promoted_object, 'AdPromotedObject' field :recommendations, { list: 'AdRecommendation' } + field :smart_promotion_type, 'string' field :source_campaign, 'Campaign' field :source_campaign_id, 'string' field :special_ad_categories, { list: 'string' } @@ -427,7 +427,6 @@ class Campaign < AdObject field :adbatch, { list: 'object' } field :execution_options, { list: { enum: -> { EXECUTION_OPTIONS }} } field :iterative_split_test_configs, { list: 'object' } - field :smart_promotion_type, { enum: -> { SMART_PROMOTION_TYPE }} field :upstream_events, 'hash' has_edge :ad_studies do |edge| @@ -514,6 +513,7 @@ class Campaign < AdObject api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } api.has_param :use_account_attribution_setting, 'bool' + api.has_param :use_unified_attribution_setting, 'bool' end edge.post 'AdReportRun' do |api| api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} } @@ -536,6 +536,7 @@ class Campaign < AdObject api.has_param :time_range, 'object' api.has_param :time_ranges, { list: 'object' } api.has_param :use_account_attribution_setting, 'bool' + api.has_param :use_unified_attribution_setting, 'bool' end end diff --git a/lib/facebook_ads/ad_objects/user_payment_modules_options.rb b/lib/facebook_ads/ad_objects/catalog_item_channels_to_integrity_status.rb similarity index 87% rename from lib/facebook_ads/ad_objects/user_payment_modules_options.rb rename to lib/facebook_ads/ad_objects/catalog_item_channels_to_integrity_status.rb index 8a343d0e..802d45c7 100644 --- a/lib/facebook_ads/ad_objects/user_payment_modules_options.rb +++ b/lib/facebook_ads/ad_objects/catalog_item_channels_to_integrity_status.rb @@ -25,12 +25,10 @@ module FacebookAds # on github and we'll fix in our codegen framework. We'll not be able to accept # pull request for this class. - class UserPaymentModulesOptions < AdObject + class CatalogItemChannelsToIntegrityStatus < AdObject - field :account_id, 'string' - field :available_payment_options, { list: 'object' } - field :country, 'string' - field :currency, 'string' + field :channels, { list: 'string' } + field :rejection_information, 'object' has_no_id has_no_get has_no_post diff --git a/lib/facebook_ads/ad_objects/catalog_sub_vertical_list.rb b/lib/facebook_ads/ad_objects/catalog_sub_vertical_list.rb index 3b30b342..cc059668 100644 --- a/lib/facebook_ads/ad_objects/catalog_sub_vertical_list.rb +++ b/lib/facebook_ads/ad_objects/catalog_sub_vertical_list.rb @@ -39,11 +39,11 @@ class CatalogSubVerticalList < AdObject field :clo_offer, 'object' field :clothing, 'object' field :clothing_accessories, 'object' - field :clothing_group, 'object' field :computer_components, 'object' field :computers_and_tablets, 'object' field :computers_laptops_and_tablets, 'object' field :diapering_and_potty_training, 'object' + field :digital_product_offer, 'object' field :electronic_accessories_and_cables, 'object' field :electronics_accessories, 'object' field :furniture, 'object' @@ -53,6 +53,8 @@ class CatalogSubVerticalList < AdObject field :household_and_cleaning_supplies, 'object' field :jewelry, 'object' field :large_appliances, 'object' + field :local_service_business_item, 'object' + field :local_service_business_restaurant, 'object' field :loyalty_offer, 'object' field :meetup_space, 'object' field :nursery, 'object' diff --git a/lib/facebook_ads/ad_objects/comment.rb b/lib/facebook_ads/ad_objects/comment.rb index 6aa8b7d4..e7863ef6 100644 --- a/lib/facebook_ads/ad_objects/comment.rb +++ b/lib/facebook_ads/ad_objects/comment.rb @@ -27,11 +27,13 @@ module FacebookAds class Comment < AdObject COMMENT_PRIVACY_VALUE = [ + "DECLINED_BY_ADMIN_ASSISTANT", "DEFAULT_PRIVACY", "FRIENDS_AND_POST_OWNER", "FRIENDS_ONLY", "GRAPHQL_MULTIPLE_VALUE_HACK_DO_NOT_USE", "OWNER_OR_COMMENTER", + "PENDING_APPROVAL", "SIDE_CONVERSATION", "SIDE_CONVERSATION_AND_POST_OWNER", ] @@ -72,7 +74,7 @@ class Comment < AdObject field :message_tags, { list: 'EntityAtTextRange' } field :object, 'object' field :parent, 'Comment' - field :permalink_url, 'string' + field :permalink_url, 'object' field :private_reply_conversation, 'object' field :user_likes, 'bool' diff --git a/lib/facebook_ads/ad_objects/commerce_merchant_settings.rb b/lib/facebook_ads/ad_objects/commerce_merchant_settings.rb index 74fa008d..8a6535d9 100644 --- a/lib/facebook_ads/ad_objects/commerce_merchant_settings.rb +++ b/lib/facebook_ads/ad_objects/commerce_merchant_settings.rb @@ -35,7 +35,9 @@ class CommerceMerchantSettings < AdObject field :display_name, 'string' field :external_merchant_id, 'string' field :facebook_channel, 'object' + field :feature_eligibility, 'object' field :has_discount_code, 'bool' + field :has_onsite_intent, 'bool' field :id, 'string' field :instagram_channel, 'object' field :merchant_alert_email, 'string' diff --git a/lib/facebook_ads/ad_objects/content_delivery_report.rb b/lib/facebook_ads/ad_objects/content_delivery_report.rb index 9b828cbc..3d0576d1 100644 --- a/lib/facebook_ads/ad_objects/content_delivery_report.rb +++ b/lib/facebook_ads/ad_objects/content_delivery_report.rb @@ -32,6 +32,7 @@ class ContentDeliveryReport < AdObject "HIDDEN_AAA", "INSTAGRAM", "MESSENGER", + "OCULUS", "UNKNOWN", "WHATSAPP", ] @@ -46,6 +47,7 @@ class ContentDeliveryReport < AdObject "HIDDEN_AAA", "INSTAGRAM_EXPLORE", "INSTAGRAM_IGTV", + "INSTAGRAM_REELS", "INSTAGRAM_STORIES", "INSTANT_ARTICLE", "INSTREAM_VIDEO", @@ -53,11 +55,13 @@ class ContentDeliveryReport < AdObject "MARKETPLACE", "MESSENGER_INBOX", "MESSENGER_STORIES", + "OCULUS_TWILIGHT_FEED", "OTHERS", "REWARDED_VIDEO", "RIGHT_HAND_COLUMN", "SEARCH", "STATUS", + "STICKERS", "SUGGESTED_VIDEO", "UNKNOWN", "VIDEO_FEEDS", diff --git a/lib/facebook_ads/ad_objects/offline_terms_of_service.rb b/lib/facebook_ads/ad_objects/contextual_bundling_spec.rb similarity index 91% rename from lib/facebook_ads/ad_objects/offline_terms_of_service.rb rename to lib/facebook_ads/ad_objects/contextual_bundling_spec.rb index 3eeee0d9..67c983d1 100644 --- a/lib/facebook_ads/ad_objects/offline_terms_of_service.rb +++ b/lib/facebook_ads/ad_objects/contextual_bundling_spec.rb @@ -25,11 +25,11 @@ module FacebookAds # on github and we'll fix in our codegen framework. We'll not be able to accept # pull request for this class. - class OfflineTermsOfService < AdObject + class ContextualBundlingSpec < AdObject - field :accept_time, 'int' - field :id, 'string' - field :signed_by_user, 'User' + field :status, 'string' + has_no_id + has_no_get has_no_post has_no_delete diff --git a/lib/facebook_ads/ad_objects/cpas_parent_catalog_settings.rb b/lib/facebook_ads/ad_objects/cpas_parent_catalog_settings.rb index d26cab49..59819277 100644 --- a/lib/facebook_ads/ad_objects/cpas_parent_catalog_settings.rb +++ b/lib/facebook_ads/ad_objects/cpas_parent_catalog_settings.rb @@ -40,6 +40,7 @@ class CpasParentCatalogSettings < AdObject field :attribution_windows, { list: 'string' } field :default_currency, 'string' + field :disable_use_as_parent_catalog, 'bool' field :id, 'string' has_no_delete diff --git a/lib/facebook_ads/ad_objects/custom_audience.rb b/lib/facebook_ads/ad_objects/custom_audience.rb index 0e8ad9c2..2c7f84fb 100644 --- a/lib/facebook_ads/ad_objects/custom_audience.rb +++ b/lib/facebook_ads/ad_objects/custom_audience.rb @@ -113,8 +113,6 @@ class CustomAudience < AdObject field :time_content_updated, 'int' field :time_created, 'int' field :time_updated, 'int' - field :accountid, 'string' - field :additionalmetadata, 'string' field :allowed_domains, { list: 'string' } field :associated_audience_id, 'int' field :claim_objective, { enum: -> { CLAIM_OBJECTIVE }} @@ -122,27 +120,17 @@ class CustomAudience < AdObject field :countries, 'string' field :creation_params, 'hash' field :dataset_id, 'string' - field :details, 'string' field :enable_fetch_or_create, 'bool' field :event_source_group, 'string' field :event_sources, { list: 'hash' } field :exclusions, { list: 'object' } - field :expectedsize, 'int' - field :gender, 'string' field :inclusions, { list: 'object' } - field :isprivate, 'bool' - field :is_household_exclusion, 'bool' field :list_of_accounts, { list: 'int' } - field :maxage, 'int' - field :minage, 'int' field :origin_audience_id, 'string' field :parent_audience_id, 'int' - field :partnerid, 'string' field :partner_reference_key, 'string' field :prefill, 'bool' field :product_set_id, 'string' - field :source, 'string' - field :tags, { list: 'string' } field :video_group_ids, { list: 'string' } has_edge :adaccounts do |edge| @@ -190,5 +178,13 @@ class CustomAudience < AdObject end end + has_edge :usersreplace do |edge| + edge.post 'CustomAudience' do |api| + api.has_param :namespace, 'string' + api.has_param :payload, 'object' + api.has_param :session, 'object' + end + end + end end 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 91736c5a..1b2eeb76 100644 --- a/lib/facebook_ads/ad_objects/custom_audience_data_source.rb +++ b/lib/facebook_ads/ad_objects/custom_audience_data_source.rb @@ -42,6 +42,7 @@ class CustomAudienceDataSource < AdObject "EXPANDED_AUDIENCE", "EXTERNAL_IDS", "EXTERNAL_IDS_MIX", + "FACEBOOK_WIFI_EVENTS", "FB_EVENT_SIGNALS", "FB_PIXEL_HITS", "HASHES", diff --git a/lib/facebook_ads/ad_objects/delivery_window.rb b/lib/facebook_ads/ad_objects/delivery_window.rb new file mode 100644 index 00000000..b2da49ea --- /dev/null +++ b/lib/facebook_ads/ad_objects/delivery_window.rb @@ -0,0 +1,287 @@ +# 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-generated. + + # 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 DeliveryWindow < AdObject + + field :ad, 'int' + field :ae, 'int' + field :af, 'int' + field :ag, 'int' + field :ai, 'int' + field :al, 'int' + field :all, 'int' + field :am, 'int' + field :an, 'int' + field :ao, 'int' + field :aq, 'int' + field :ar, 'int' + field :as, 'int' + field :at, 'int' + field :au, 'int' + field :aw, 'int' + field :ax, 'int' + field :az, 'int' + field :ba, 'int' + field :bb, 'int' + field :bd, 'int' + field :be, 'int' + field :bf, 'int' + field :bg, 'int' + field :bh, 'int' + field :bi, 'int' + field :bj, 'int' + field :bl, 'int' + field :bm, 'int' + field :bn, 'int' + field :bo, 'int' + field :bq, 'int' + field :br, 'int' + field :bs, 'int' + field :bt, 'int' + field :bv, 'int' + field :bw, 'int' + field :by, 'int' + field :bz, 'int' + field :ca, 'int' + field :cc, 'int' + field :cd, 'int' + field :cf, 'int' + field :cg, 'int' + field :ch, 'int' + field :ci, 'int' + field :ck, 'int' + field :cl, 'int' + field :cm, 'int' + field :cn, 'int' + field :co, 'int' + field :cr, 'int' + field :cu, 'int' + field :cv, 'int' + field :cw, 'int' + field :cx, 'int' + field :cy, 'int' + field :cz, 'int' + field :de, 'int' + field :dj, 'int' + field :dk, 'int' + field :dm, 'int' + field :_do, 'int' + field :dz, 'int' + field :ec, 'int' + field :ee, 'int' + field :eg, 'int' + field :eh, 'int' + field :er, 'int' + field :es, 'int' + field :et, 'int' + field :fi, 'int' + field :fj, 'int' + field :fk, 'int' + field :fm, 'int' + field :fo, 'int' + field :fr, 'int' + field :ga, 'int' + field :gb, 'int' + field :gd, 'int' + field :ge, 'int' + field :gf, 'int' + field :gg, 'int' + field :gh, 'int' + field :gi, 'int' + field :gl, 'int' + field :gm, 'int' + field :gn, 'int' + field :gp, 'int' + field :gq, 'int' + field :gr, 'int' + field :gs, 'int' + field :gt, 'int' + field :gu, 'int' + field :gw, 'int' + field :gy, 'int' + field :hk, 'int' + field :hm, 'int' + field :hn, 'int' + field :hr, 'int' + field :ht, 'int' + field :hu, 'int' + field :id, 'int' + field :ie, 'int' + field :il, 'int' + field :im, 'int' + field :in, 'int' + field :io, 'int' + field :iq, 'int' + field :ir, 'int' + field :is, 'int' + field :it, 'int' + field :je, 'int' + field :jm, 'int' + field :jo, 'int' + field :jp, 'int' + field :ke, 'int' + field :kg, 'int' + field :kh, 'int' + field :ki, 'int' + field :km, 'int' + field :kn, 'int' + field :kp, 'int' + field :kr, 'int' + field :kw, 'int' + field :ky, 'int' + field :kz, 'int' + field :la, 'int' + field :lb, 'int' + field :lc, 'int' + field :li, 'int' + field :lk, 'int' + field :lr, 'int' + field :ls, 'int' + field :lt, 'int' + field :lu, 'int' + field :lv, 'int' + field :ly, 'int' + field :ma, 'int' + field :mc, 'int' + field :md, 'int' + field :me, 'int' + field :mf, 'int' + field :mg, 'int' + field :mh, 'int' + field :mk, 'int' + field :ml, 'int' + field :mm, 'int' + field :mn, 'int' + field :mo, 'int' + field :mp, 'int' + field :mq, 'int' + field :mr, 'int' + field :ms, 'int' + field :mt, 'int' + field :mu, 'int' + field :mv, 'int' + field :mw, 'int' + field :mx, 'int' + field :my, 'int' + field :mz, 'int' + field :na, 'int' + field :nc, 'int' + field :ne, 'int' + field :nf, 'int' + field :ng, 'int' + field :ni, 'int' + field :nl, 'int' + field :no, 'int' + field :np, 'int' + field :nr, 'int' + field :nu, 'int' + field :nz, 'int' + field :om, 'int' + field :pa, 'int' + field :pe, 'int' + field :pf, 'int' + field :pg, 'int' + field :ph, 'int' + field :pk, 'int' + field :pl, 'int' + field :pm, 'int' + field :pn, 'int' + field :pr, 'int' + field :ps, 'int' + field :pt, 'int' + field :pw, 'int' + field :py, 'int' + field :qa, 'int' + field :re, 'int' + field :ro, 'int' + field :rs, 'int' + field :ru, 'int' + field :rw, 'int' + field :sa, 'int' + field :sb, 'int' + field :sc, 'int' + field :sd, 'int' + field :se, 'int' + field :sg, 'int' + field :sh, 'int' + field :si, 'int' + field :sj, 'int' + field :sk, 'int' + field :sl, 'int' + field :sm, 'int' + field :sn, 'int' + field :so, 'int' + field :sr, 'int' + field :ss, 'int' + field :st, 'int' + field :sv, 'int' + field :sx, 'int' + field :sy, 'int' + field :sz, 'int' + field :tc, 'int' + field :td, 'int' + field :tf, 'int' + field :tg, 'int' + field :th, 'int' + field :tj, 'int' + field :tk, 'int' + field :tl, 'int' + field :tm, 'int' + field :tn, 'int' + field :to, 'int' + field :tr, 'int' + field :tt, 'int' + field :tv, 'int' + field :tw, 'int' + field :tz, 'int' + field :ua, 'int' + field :ug, 'int' + field :um, 'int' + field :us, 'int' + field :uy, 'int' + field :uz, 'int' + field :va, 'int' + field :vc, 'int' + field :ve, 'int' + field :vg, 'int' + field :vi, 'int' + field :vn, 'int' + field :vu, 'int' + field :wf, 'int' + field :ws, 'int' + field :xk, 'int' + field :ye, 'int' + field :yt, 'int' + field :za, 'int' + field :zm, 'int' + field :zw, 'int' + has_no_get + has_no_post + has_no_delete + + end +end diff --git a/lib/facebook_ads/ad_objects/destination.rb b/lib/facebook_ads/ad_objects/destination.rb index 36b0405d..15505792 100644 --- a/lib/facebook_ads/ad_objects/destination.rb +++ b/lib/facebook_ads/ad_objects/destination.rb @@ -26,6 +26,15 @@ module FacebookAds # pull request for this class. class Destination < AdObject + IMAGE_FETCH_STATUS = [ + "DIRECT_UPLOAD", + "FETCHED", + "FETCH_FAILED", + "NO_STATUS", + "OUTDATED", + "PARTIAL_FETCH", + ] + field :address, 'string' field :applinks, 'CatalogItemAppLinks' @@ -34,6 +43,7 @@ class Destination < AdObject field :description, 'string' field :destination_id, 'string' field :id, 'string' + field :image_fetch_status, { enum: -> { IMAGE_FETCH_STATUS }} field :images, { list: 'string' } field :name, 'string' field :price, 'string' @@ -44,5 +54,13 @@ class Destination < AdObject has_no_post has_no_delete + has_edge :augmented_realities_metadata do |edge| + edge.get + end + + has_edge :videos_metadata do |edge| + edge.get + end + end end diff --git a/lib/facebook_ads/ad_objects/flight.rb b/lib/facebook_ads/ad_objects/flight.rb index b0bd2d7d..409c744e 100644 --- a/lib/facebook_ads/ad_objects/flight.rb +++ b/lib/facebook_ads/ad_objects/flight.rb @@ -26,6 +26,15 @@ module FacebookAds # pull request for this class. class Flight < AdObject + IMAGE_FETCH_STATUS = [ + "DIRECT_UPLOAD", + "FETCHED", + "FETCH_FAILED", + "NO_STATUS", + "OUTDATED", + "PARTIAL_FETCH", + ] + field :applinks, 'CatalogItemAppLinks' field :category_specific_fields, 'CatalogSubVerticalList' @@ -35,6 +44,7 @@ class Flight < AdObject field :destination_city, 'string' field :flight_id, 'string' field :id, 'string' + field :image_fetch_status, { enum: -> { IMAGE_FETCH_STATUS }} field :images, { list: 'string' } field :oneway_currency, 'string' field :oneway_price, 'string' @@ -45,5 +55,13 @@ class Flight < AdObject field :url, 'string' has_no_delete + has_edge :augmented_realities_metadata do |edge| + edge.get + end + + has_edge :videos_metadata do |edge| + edge.get + end + end end diff --git a/lib/facebook_ads/ad_objects/group.rb b/lib/facebook_ads/ad_objects/group.rb index 4ea3f044..16020f9b 100644 --- a/lib/facebook_ads/ad_objects/group.rb +++ b/lib/facebook_ads/ad_objects/group.rb @@ -150,15 +150,6 @@ class Group < AdObject "WORK_VC_CALL", ] - SUGGESTION_CATEGORY = [ - "EVENT", - "MESSENGER", - "WORK", - "WORKPLACE", - "WORKPLACE_1_1", - "WORKPLACE_MANAGER", - ] - field :archived, 'bool' field :cover, 'CoverPhoto' @@ -171,7 +162,6 @@ class Group < AdObject field :member_count, 'int' field :member_request_count, 'int' field :name, 'string' - field :owner, 'object' field :parent, 'object' field :permissions, { list: 'string' } field :privacy, 'string' @@ -216,7 +206,15 @@ class Group < AdObject end has_edge :feed do |edge| - edge.post do |api| + edge.get 'Post' do |api| + api.has_param :include_hidden, 'bool' + api.has_param :q, 'string' + api.has_param :show_expired, 'bool' + api.has_param :since, 'datetime' + api.has_param :until, 'datetime' + api.has_param :with, 'string' + end + edge.post 'Post' do |api| api.has_param :actions, 'object' api.has_param :adaptive_type, 'string' api.has_param :album_id, 'string' @@ -230,10 +228,10 @@ class Group < AdObject api.has_param :attached_media, { list: 'object' } api.has_param :audience_exp, 'bool' api.has_param :backdated_time, 'datetime' - api.has_param :backdated_time_granularity, { enum: %w{day hour min month none year }} + api.has_param :backdated_time_granularity, { enum: -> { Post::BACKDATED_TIME_GRANULARITY }} api.has_param :call_to_action, 'object' api.has_param :caption, 'string' - api.has_param :checkin_entry_point, { enum: %w{BRANDING_CHECKIN BRANDING_OTHER BRANDING_PHOTO BRANDING_STATUS }} + api.has_param :checkin_entry_point, { enum: -> { Post::CHECKIN_ENTRY_POINT }} api.has_param :child_attachments, { list: 'object' } api.has_param :client_mutation_id, 'string' api.has_param :composer_entry_picker, 'string' @@ -253,7 +251,7 @@ class Group < AdObject api.has_param :expanded_height, 'int' api.has_param :expanded_width, 'int' api.has_param :feed_targeting, 'object' - api.has_param :formatting, { enum: %w{MARKDOWN PLAINTEXT }} + api.has_param :formatting, { enum: -> { Post::FORMATTING }} api.has_param :fun_fact_prompt_id, 'int' api.has_param :fun_fact_toastee_id, 'int' api.has_param :has_nickname, 'bool' @@ -290,11 +288,11 @@ class Group < AdObject api.has_param :page_recommendation, 'string' api.has_param :picture, 'string' api.has_param :place, 'object' - api.has_param :place_attachment_setting, { enum: %w{1 2 }} + api.has_param :place_attachment_setting, { enum: -> { Post::PLACE_ATTACHMENT_SETTING }} api.has_param :place_list, 'string' api.has_param :place_list_data, { list: 'string' } - api.has_param :post_surfaces_blacklist, { list: { enum: %w{1 2 3 4 5 }} } - api.has_param :posting_to_redspace, { enum: %w{disabled enabled }} + api.has_param :post_surfaces_blacklist, { list: { enum: -> { Post::POST_SURFACES_BLACKLIST }} } + api.has_param :posting_to_redspace, { enum: -> { Post::POSTING_TO_REDSPACE }} api.has_param :privacy, 'string' api.has_param :prompt_id, 'string' api.has_param :prompt_tracking_string, 'string' @@ -314,7 +312,7 @@ class Group < AdObject api.has_param :sponsor_relationship, 'int' api.has_param :suggested_place_id, 'object' api.has_param :tags, { list: 'int' } - api.has_param :target_surface, { enum: %w{STORY TIMELINE }} + api.has_param :target_surface, { enum: -> { Post::TARGET_SURFACE }} api.has_param :targeting, 'object' api.has_param :text_format_metadata, 'string' api.has_param :text_format_preset_id, 'string' @@ -324,7 +322,7 @@ class Group < AdObject api.has_param :time_since_original_post, 'int' api.has_param :title, 'string' api.has_param :tracking_info, 'string' - api.has_param :unpublished_content_type, { enum: %w{ADS_POST DRAFT INLINE_CREATED PUBLISHED REVIEWABLE_BRANDED_CONTENT SCHEDULED SCHEDULED_RECURRING }} + api.has_param :unpublished_content_type, { enum: -> { Post::UNPUBLISHED_CONTENT_TYPE }} api.has_param :user_selected_tags, 'bool' api.has_param :video_start_time_ms, 'int' api.has_param :viewer_coordinates, 'object' @@ -332,6 +330,10 @@ class Group < AdObject end end + has_edge :files do |edge| + edge.get + end + has_edge :groups do |edge| edge.get 'Group' edge.post 'Group' do |api| @@ -346,8 +348,14 @@ class Group < AdObject api.has_param :post_requires_admin_approval, 'bool' api.has_param :privacy, 'string' api.has_param :ref, 'string' - api.has_param :suggestion_category, { enum: -> { Group::SUGGESTION_CATEGORY }} - api.has_param :suggestion_identifier, 'string' + end + end + + has_edge :important_posts do |edge| + edge.post do |api| + api.has_param :button_type, { enum: %w{DISMISS DONE MARK_AS_READ }} + api.has_param :expiration_time, 'datetime' + api.has_param :post_id, 'string' end end @@ -466,6 +474,15 @@ class Group < AdObject end end + has_edge :pinned_posts do |edge| + edge.delete do |api| + api.has_param :post_id, 'string' + end + edge.post 'Post' do |api| + api.has_param :post_ids, { list: 'string' } + end + end + has_edge :videos do |edge| edge.get 'AdVideo' do |api| api.has_param :type, { enum: -> { AdVideo::TYPE }} @@ -475,7 +492,6 @@ class Group < AdObject api.has_param :animated_effect_id, 'int' api.has_param :application_id, 'string' api.has_param :asked_fun_fact_prompt_id, 'int' - api.has_param :attribution_app_id, 'string' api.has_param :audio_story_wave_animation_handle, 'string' api.has_param :composer_entry_picker, 'string' api.has_param :composer_entry_point, 'string' diff --git a/lib/facebook_ads/ad_objects/home_listing.rb b/lib/facebook_ads/ad_objects/home_listing.rb index 69aef0a8..cfa1fdb9 100644 --- a/lib/facebook_ads/ad_objects/home_listing.rb +++ b/lib/facebook_ads/ad_objects/home_listing.rb @@ -26,6 +26,15 @@ module FacebookAds # pull request for this class. class HomeListing < AdObject + IMAGE_FETCH_STATUS = [ + "DIRECT_UPLOAD", + "FETCHED", + "FETCH_FAILED", + "NO_STATUS", + "OUTDATED", + "PARTIAL_FETCH", + ] + field :ac_type, 'string' field :additional_fees_description, 'string' @@ -50,6 +59,7 @@ class HomeListing < AdObject field :heating_type, 'string' field :home_listing_id, 'string' field :id, 'string' + field :image_fetch_status, { enum: -> { IMAGE_FETCH_STATUS }} field :images, { list: 'string' } field :laundry_type, 'string' field :listing_type, 'string' @@ -71,5 +81,13 @@ class HomeListing < AdObject field :url, 'string' field :year_built, 'int' + has_edge :augmented_realities_metadata do |edge| + edge.get + end + + has_edge :videos_metadata do |edge| + edge.get + end + end end diff --git a/lib/facebook_ads/ad_objects/hotel.rb b/lib/facebook_ads/ad_objects/hotel.rb index 0baf4502..c2d88973 100644 --- a/lib/facebook_ads/ad_objects/hotel.rb +++ b/lib/facebook_ads/ad_objects/hotel.rb @@ -26,6 +26,15 @@ module FacebookAds # pull request for this class. class Hotel < AdObject + IMAGE_FETCH_STATUS = [ + "DIRECT_UPLOAD", + "FETCHED", + "FETCH_FAILED", + "NO_STATUS", + "OUTDATED", + "PARTIAL_FETCH", + ] + field :address, 'string' field :applinks, 'CatalogItemAppLinks' @@ -37,6 +46,7 @@ class Hotel < AdObject field :guest_ratings, 'string' field :hotel_id, 'string' field :id, 'string' + field :image_fetch_status, { enum: -> { IMAGE_FETCH_STATUS }} field :images, { list: 'string' } field :lowest_base_price, 'string' field :loyalty_program, 'string' @@ -49,9 +59,17 @@ class Hotel < AdObject field :url, 'string' field :base_price, 'int' + has_edge :augmented_realities_metadata do |edge| + edge.get + end + has_edge :hotel_rooms do |edge| edge.get 'HotelRoom' end + has_edge :videos_metadata do |edge| + edge.get + end + end end diff --git a/lib/facebook_ads/ad_objects/ig_media.rb b/lib/facebook_ads/ad_objects/ig_media.rb index 4c0dcd94..79bab5c7 100644 --- a/lib/facebook_ads/ad_objects/ig_media.rb +++ b/lib/facebook_ads/ad_objects/ig_media.rb @@ -27,13 +27,13 @@ module FacebookAds class IgMedia < AdObject - field :alt_text, 'string' field :caption, 'string' field :comments_count, 'int' field :id, 'string' field :ig_id, 'string' field :is_comment_enabled, 'bool' field :like_count, 'int' + field :media_product_type, 'string' field :media_type, 'string' field :media_url, 'string' field :owner, 'IgUser' @@ -42,6 +42,7 @@ class IgMedia < AdObject field :thumbnail_url, 'string' field :timestamp, 'datetime' field :username, 'string' + field :video_title, 'string' has_no_delete has_edge :children do |edge| diff --git a/lib/facebook_ads/ad_objects/ig_user.rb b/lib/facebook_ads/ad_objects/ig_user.rb index 9609f512..6ec5f4cc 100644 --- a/lib/facebook_ads/ad_objects/ig_user.rb +++ b/lib/facebook_ads/ad_objects/ig_user.rb @@ -33,7 +33,6 @@ class IgUser < AdObject field :follows_count, 'int' field :id, 'string' field :ig_id, 'int' - field :is_ig_shopping_seller_policy_enabled, 'bool' field :media_count, 'int' field :mentioned_comment, 'IgComment' field :mentioned_media, 'IgMedia' @@ -45,6 +44,12 @@ class IgUser < AdObject has_no_post has_no_delete + has_edge :content_publishing_limit do |edge| + edge.get do |api| + api.has_param :since, 'datetime' + end + end + has_edge :insights do |edge| edge.get 'InstagramInsightsResult' do |api| api.has_param :metric, { list: { enum: -> { InstagramInsightsResult::METRIC }} } diff --git a/lib/facebook_ads/ad_objects/image_copyright.rb b/lib/facebook_ads/ad_objects/image_copyright.rb new file mode 100644 index 00000000..bc3b9a8c --- /dev/null +++ b/lib/facebook_ads/ad_objects/image_copyright.rb @@ -0,0 +1,302 @@ +# 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-generated. + + # 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 ImageCopyright < AdObject + GEO_OWNERSHIP = [ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AN", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TP", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "XK", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ] + + + field :artist, 'string' + field :copyright_monitoring_status, 'string' + field :creation_time, 'datetime' + field :creator, 'string' + field :custom_id, 'string' + field :description, 'string' + field :filename, 'string' + field :id, 'string' + field :image, 'Photo' + field :matches_count, 'int' + field :original_content_creation_date, 'datetime' + field :ownership_countries, 'VideoCopyrightGeoGate' + field :tags, { list: 'string' } + field :title, 'string' + field :update_time, 'datetime' + + end +end diff --git a/lib/facebook_ads/ad_objects/insights_result.rb b/lib/facebook_ads/ad_objects/insights_result.rb index e9e7a932..dcb64cc3 100644 --- a/lib/facebook_ads/ad_objects/insights_result.rb +++ b/lib/facebook_ads/ad_objects/insights_result.rb @@ -38,7 +38,7 @@ class InsightsResult < AdObject "last_week_mon_sun", "last_week_sun_sat", "last_year", - "lifetime", + "maximum", "this_month", "this_quarter", "this_week_mon_today", diff --git a/lib/facebook_ads/ad_objects/instagram_user.rb b/lib/facebook_ads/ad_objects/instagram_user.rb index 2235e894..1472126d 100644 --- a/lib/facebook_ads/ad_objects/instagram_user.rb +++ b/lib/facebook_ads/ad_objects/instagram_user.rb @@ -40,9 +40,6 @@ class InstagramUser < AdObject has_no_delete has_edge :agencies do |edge| - edge.delete do |api| - api.has_param :business, 'string' - end edge.get 'Business' end diff --git a/lib/facebook_ads/ad_objects/invoice_campaign.rb b/lib/facebook_ads/ad_objects/invoice_campaign_new.rb similarity index 97% rename from lib/facebook_ads/ad_objects/invoice_campaign.rb rename to lib/facebook_ads/ad_objects/invoice_campaign_new.rb index 523dd63a..a7c7cc25 100644 --- a/lib/facebook_ads/ad_objects/invoice_campaign.rb +++ b/lib/facebook_ads/ad_objects/invoice_campaign_new.rb @@ -25,7 +25,7 @@ module FacebookAds # on github and we'll fix in our codegen framework. We'll not be able to accept # pull request for this class. - class InvoiceCampaign < AdObject + class InvoiceCampaignNew < AdObject field :ad_account_id, 'string' field :billed_amount_details, 'BilledAmountDetails' diff --git a/lib/facebook_ads/ad_objects/link.rb b/lib/facebook_ads/ad_objects/link.rb index 30716e13..6ffe8ede 100644 --- a/lib/facebook_ads/ad_objects/link.rb +++ b/lib/facebook_ads/ad_objects/link.rb @@ -43,12 +43,6 @@ class Link < AdObject has_no_delete has_edge :comments do |edge| - edge.get 'Comment' do |api| - api.has_param :filter, { enum: -> { Comment::FILTER }} - api.has_param :live_filter, { enum: -> { Comment::LIVE_FILTER }} - api.has_param :order, { enum: -> { Comment::ORDER }} - api.has_param :since, 'datetime' - end edge.post 'Comment' do |api| api.has_param :attachment_id, 'string' api.has_param :attachment_share_url, 'string' @@ -70,9 +64,5 @@ class Link < AdObject edge.get 'Profile' end - has_edge :sharedposts do |edge| - edge.get 'Post' - end - end end diff --git a/lib/facebook_ads/ad_objects/live_video.rb b/lib/facebook_ads/ad_objects/live_video.rb index 96676e6d..3c7a7949 100644 --- a/lib/facebook_ads/ad_objects/live_video.rb +++ b/lib/facebook_ads/ad_objects/live_video.rb @@ -26,18 +26,6 @@ module FacebookAds # pull request for this class. class LiveVideo < AdObject - BROADCAST_STATUS = [ - "live", - "live_stopped", - "processing", - "scheduled_canceled", - "scheduled_expired", - "scheduled_live", - "scheduled_unpublished", - "unpublished", - "vod", - ] - PROJECTION = [ "CUBEMAP", "EQUIRECTANGULAR", @@ -67,12 +55,25 @@ class LiveVideo < AdObject "REGULAR", ] + BROADCAST_STATUS = [ + "LIVE", + "LIVE_STOPPED", + "PROCESSING", + "SCHEDULED_CANCELED", + "SCHEDULED_EXPIRED", + "SCHEDULED_LIVE", + "SCHEDULED_UNPUBLISHED", + "UNPUBLISHED", + "VOD", + ] + SOURCE = [ "owner", "target", ] LIVE_COMMENT_MODERATION_SETTING = [ + "DEFAULT", "DISCUSSION", "FOLLOWER", "PROTECTED_MODE", @@ -81,6 +82,12 @@ class LiveVideo < AdObject "SUPPORTER", ] + PERSISTENT_STREAM_KEY_STATUS = [ + "DISABLE", + "ENABLE", + "REGENERATE", + ] + field :ad_break_config, 'LiveVideoAdBreakConfig' field :ad_break_failure_reason, 'string' @@ -99,7 +106,7 @@ class LiveVideo < AdObject field :live_encoders, { list: 'LiveEncoder' } field :live_views, 'int' field :overlay_url, 'string' - field :permalink_url, 'string' + field :permalink_url, 'object' field :planned_start_time, 'datetime' field :seconds_left, 'int' field :secure_stream_url, 'string' diff --git a/lib/facebook_ads/ad_objects/messenger_profile.rb b/lib/facebook_ads/ad_objects/messenger_profile.rb index 59831453..4ddd4035 100644 --- a/lib/facebook_ads/ad_objects/messenger_profile.rb +++ b/lib/facebook_ads/ad_objects/messenger_profile.rb @@ -33,6 +33,7 @@ class MessengerProfile < AdObject field :ice_breakers, { list: 'object' } field :payment_settings, 'object' field :persistent_menu, { list: 'object' } + field :subject_to_new_eu_privacy_rules, 'bool' field :target_audience, 'object' field :whitelisted_domains, { list: 'string' } has_no_id diff --git a/lib/facebook_ads/ad_objects/event_tour.rb b/lib/facebook_ads/ad_objects/omega_customer_trx.rb similarity index 63% rename from lib/facebook_ads/ad_objects/event_tour.rb rename to lib/facebook_ads/ad_objects/omega_customer_trx.rb index 2b3d9406..b5e54701 100644 --- a/lib/facebook_ads/ad_objects/event_tour.rb +++ b/lib/facebook_ads/ad_objects/omega_customer_trx.rb @@ -25,31 +25,39 @@ module FacebookAds # on github and we'll fix in our codegen framework. We'll not be able to accept # pull request for this class. - class EventTour < AdObject + class OmegaCustomerTrx < AdObject + TYPE = [ + "CM", + "DM", + "INV", + "PRO_FORMA", + ] - field :description, 'string' - field :dominant_color, 'string' - field :end_time, 'string' + + field :ad_account_ids, { list: 'string' } + field :amount, 'string' + field :amount_due, 'CurrencyAmount' + field :billed_amount_details, 'BilledAmountDetails' + field :billing_period, 'string' + field :campaign, 'AtlasCampaign' + field :cdn_download_uri, 'string' + field :currency, 'string' + field :download_uri, 'string' + field :due_date, 'datetime' + field :entity, 'string' field :id, 'string' - field :is_past, 'bool' - field :last_event_timestamp, 'int' - field :name, 'string' - field :num_events, 'int' - field :photo, 'Photo' - field :publishing_state, 'string' - field :scheduled_publish_timestamp, 'int' - field :start_time, 'string' - field :ticketing_uri, 'string' - field :video, 'AdVideo' + field :invoice_date, 'datetime' + field :invoice_id, 'string' + field :invoice_type, 'string' + field :liability_type, 'string' + field :payment_status, 'string' + field :payment_term, 'string' + field :type, 'string' has_no_post has_no_delete - has_edge :events do |edge| - edge.get 'Event' - end - - has_edge :pages do |edge| - edge.get 'Page' + has_edge :campaigns do |edge| + edge.get 'InvoiceCampaignNew' end end diff --git a/lib/facebook_ads/ad_objects/oracle_transaction.rb b/lib/facebook_ads/ad_objects/oracle_transaction.rb index 7ed29d23..ba55bf5e 100644 --- a/lib/facebook_ads/ad_objects/oracle_transaction.rb +++ b/lib/facebook_ads/ad_objects/oracle_transaction.rb @@ -26,11 +26,6 @@ module FacebookAds # pull request for this class. class OracleTransaction < AdObject - TYPE = [ - "CM", - "INV", - ] - field :ad_account_ids, { list: 'string' } field :amount, 'string' @@ -54,7 +49,7 @@ class OracleTransaction < AdObject has_no_delete has_edge :campaigns do |edge| - edge.get 'InvoiceCampaign' + edge.get 'InvoiceCampaignNew' end end diff --git a/lib/facebook_ads/ad_objects/page.rb b/lib/facebook_ads/ad_objects/page.rb index 0c711fe5..e3222c75 100644 --- a/lib/facebook_ads/ad_objects/page.rb +++ b/lib/facebook_ads/ad_objects/page.rb @@ -121,6 +121,7 @@ class Page < AdObject "PROFILE_PLUS_ADVERTISE", "PROFILE_PLUS_ANALYZE", "PROFILE_PLUS_CREATE_CONTENT", + "PROFILE_PLUS_FACEBOOK_ACCESS", "PROFILE_PLUS_MANAGE", "PROFILE_PLUS_MESSAGING", "PROFILE_PLUS_MODERATE", @@ -144,6 +145,7 @@ class Page < AdObject "PROFILE_PLUS_ADVERTISE", "PROFILE_PLUS_ANALYZE", "PROFILE_PLUS_CREATE_CONTENT", + "PROFILE_PLUS_FACEBOOK_ACCESS", "PROFILE_PLUS_MANAGE", "PROFILE_PLUS_MESSAGING", "PROFILE_PLUS_MODERATE", @@ -380,6 +382,7 @@ class Page < AdObject field :fan_count, 'int' field :featured_video, 'AdVideo' field :features, 'string' + field :followers_count, 'int' field :food_styles, { list: 'string' } field :founded, 'string' field :general_info, 'string' @@ -388,6 +391,7 @@ class Page < AdObject field :global_brand_page_name, 'string' field :global_brand_root_id, 'string' field :has_added_app, 'bool' + field :has_transitioned_to_new_page_experience, 'bool' field :has_whatsapp_business_number, 'bool' field :has_whatsapp_number, 'bool' field :hometown, 'string' @@ -489,6 +493,10 @@ class Page < AdObject end end + has_edge :admin_notes do |edge| + edge.get 'PageAdminNote' + end + has_edge :ads_posts do |edge| edge.get 'PagePost' do |api| api.has_param :exclude_dynamic_ads, 'bool' @@ -546,6 +554,13 @@ class Page < AdObject end has_edge :business_data do |edge| + edge.delete do |api| + api.has_param :email, 'string' + api.has_param :external_id, 'string' + api.has_param :object_name, { enum: %w{contact order order_item }} + api.has_param :order_id, 'string' + api.has_param :order_item_id, 'string' + end edge.post 'Page' do |api| api.has_param :data, { list: 'string' } api.has_param :partner_agent, 'string' @@ -589,12 +604,13 @@ class Page < AdObject end has_edge :claimed_urls do |edge| - edge.delete do |api| - api.has_param :url, 'string' - end edge.get 'Url' end + has_edge :commerce_eligibility do |edge| + edge.get 'PageCommerceEligibility' + end + has_edge :commerce_merchant_settings do |edge| edge.get 'CommerceMerchantSettings' end @@ -815,6 +831,21 @@ class Page < AdObject edge.get 'Page' end + has_edge :image_copyrights do |edge| + edge.get 'ImageCopyright' + edge.post 'ImageCopyright' do |api| + api.has_param :artist, 'string' + api.has_param :creator, 'string' + api.has_param :custom_id, 'string' + api.has_param :description, 'string' + api.has_param :filename, 'string' + api.has_param :geo_ownership, { list: { enum: -> { ImageCopyright::GEO_OWNERSHIP }} } + api.has_param :original_content_creation_date, 'int' + api.has_param :reference_photo, 'string' + api.has_param :title, 'string' + end + end + has_edge :indexed_videos do |edge| edge.get 'AdVideo' end @@ -1002,7 +1033,7 @@ class Page < AdObject has_edge :messenger_profile do |edge| edge.delete do |api| - api.has_param :fields, { list: { enum: %w{ACCOUNT_LINKING_URL GET_STARTED GREETING HOME_URL ICE_BREAKERS PAYMENT_SETTINGS PERSISTENT_MENU PLATFORM TARGET_AUDIENCE WHITELISTED_DOMAINS }} } + api.has_param :fields, { list: { enum: %w{ACCOUNT_LINKING_URL GET_STARTED GREETING HOME_URL ICE_BREAKERS PAYMENT_SETTINGS PERSISTENT_MENU PLATFORM SUBJECT_TO_NEW_EU_PRIVACY_RULES TARGET_AUDIENCE WHITELISTED_DOMAINS }} } end edge.get 'MessengerProfile' edge.post 'Page' do |api| @@ -1092,6 +1123,13 @@ class Page < AdObject end end + has_edge :phone_data do |edge| + edge.post do |api| + api.has_param :call_ads_phone_data_use_case, { enum: %w{CALL_DESTINATION_AD CALL_EXTENSION_AD }} + api.has_param :phone_number, 'string' + end + end + has_edge :photos do |edge| edge.get 'Photo' do |api| api.has_param :biz_tag_id, 'int' @@ -1211,8 +1249,10 @@ class Page < AdObject has_edge :published_posts do |edge| edge.get 'PagePost' do |api| - api.has_param :since, 'datetime' - api.has_param :until, 'datetime' + api.has_param :include_hidden, 'bool' + api.has_param :limit, 'int' + api.has_param :show_expired, 'bool' + api.has_param :with, { enum: -> { PagePost::WITH }} end end @@ -1276,6 +1316,9 @@ class Page < AdObject end has_edge :tabs do |edge| + edge.delete do |api| + api.has_param :tab, 'string' + end edge.get 'Tab' do |api| api.has_param :tab, { list: 'string' } end @@ -1314,10 +1357,6 @@ class Page < AdObject end end - has_edge :tours do |edge| - edge.get 'EventTour' - end - has_edge :unlink_accounts do |edge| edge.post 'Page' do |api| api.has_param :psid, 'string' @@ -1367,7 +1406,6 @@ class Page < AdObject api.has_param :animated_effect_id, 'int' api.has_param :application_id, 'string' api.has_param :asked_fun_fact_prompt_id, 'int' - api.has_param :attribution_app_id, 'string' api.has_param :audio_story_wave_animation_handle, 'string' api.has_param :backdated_post, { list: 'string' } api.has_param :call_to_action, 'object' diff --git a/lib/facebook_ads/ad_objects/page_call_to_action.rb b/lib/facebook_ads/ad_objects/page_call_to_action.rb index a28b5724..b8698e29 100644 --- a/lib/facebook_ads/ad_objects/page_call_to_action.rb +++ b/lib/facebook_ads/ad_objects/page_call_to_action.rb @@ -35,6 +35,7 @@ class PageCallToAction < AdObject "MARKETPLACE_INVENTORY_PAGE", "MESSENGER", "MINI_SHOP", + "MOBILE_CENTER", "NONE", "PHONE_CALL", "SHOP_ON_FACEBOOK", @@ -75,6 +76,7 @@ class PageCallToAction < AdObject "LISTEN", "LOCAL_DEV_PLATFORM", "MESSAGE", + "MOBILE_CENTER", "OPEN_APP", "ORDER_FOOD", "PLAY_MUSIC", @@ -98,6 +100,7 @@ class PageCallToAction < AdObject "EMAIL", "FOLLOW", "MESSENGER", + "MOBILE_CENTER", "NONE", "SHOP_ON_FACEBOOK", "WEBSITE", diff --git a/lib/facebook_ads/ad_objects/page_commerce_eligibility.rb b/lib/facebook_ads/ad_objects/page_commerce_eligibility.rb new file mode 100644 index 00000000..577b0a30 --- /dev/null +++ b/lib/facebook_ads/ad_objects/page_commerce_eligibility.rb @@ -0,0 +1,38 @@ +# 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-generated. + + # 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 PageCommerceEligibility < AdObject + + field :offsite, 'object' + field :onsite, 'object' + has_no_id + has_no_get + has_no_post + has_no_delete + + end +end diff --git a/lib/facebook_ads/ad_objects/page_post.rb b/lib/facebook_ads/ad_objects/page_post.rb index 7bd1a284..af927bf2 100644 --- a/lib/facebook_ads/ad_objects/page_post.rb +++ b/lib/facebook_ads/ad_objects/page_post.rb @@ -62,21 +62,16 @@ class PagePost < AdObject field :comments_mirroring_domain, 'string' field :coordinates, 'object' field :created_time, 'datetime' - field :delivery_growth_optimizations, { list: 'string' } - field :entities, 'object' field :event, 'Event' field :expanded_height, 'int' field :expanded_width, 'int' field :feed_targeting, 'object' - field :formatting, 'string' field :from, 'object' field :full_picture, 'string' field :height, 'int' field :icon, 'string' field :id, 'string' - field :implicit_place, 'Place' field :instagram_eligibility, 'string' - field :instream_eligibility, 'string' field :is_app_share, 'bool' field :is_eligible_for_promotion, 'bool' field :is_expired, 'bool' @@ -86,7 +81,6 @@ class PagePost < AdObject field :is_popular, 'bool' field :is_published, 'bool' field :is_spherical, 'bool' - field :live_video_eligibility, { list: 'string' } field :message, 'string' field :message_tags, { list: 'string' } field :multi_share_end_card, 'bool' @@ -95,12 +89,10 @@ class PagePost < AdObject field :permalink_url, 'object' field :picture, 'string' field :place, 'Place' - field :poll, 'object' field :privacy, 'Privacy' field :promotable_id, 'string' field :promotion_status, 'string' field :properties, { list: 'string' } - field :publishing_stats, 'int' field :scheduled_publish_time, 'double' field :shares, 'object' field :status_type, 'string' @@ -110,12 +102,10 @@ class PagePost < AdObject field :target, 'Profile' field :targeting, 'object' field :timeline_visibility, 'string' - field :translations, 'hash' field :updated_time, 'datetime' field :via, 'object' field :video_buying_eligibility, { list: 'string' } field :width, 'int' - field :will_be_autocropped_when_deliver_to_instagram, 'bool' has_edge :attachments do |edge| edge.get diff --git a/lib/facebook_ads/ad_objects/payment_engine_payment.rb b/lib/facebook_ads/ad_objects/payment_engine_payment.rb new file mode 100644 index 00000000..e20bc445 --- /dev/null +++ b/lib/facebook_ads/ad_objects/payment_engine_payment.rb @@ -0,0 +1,73 @@ +# 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-generated. + + # 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 PaymentEnginePayment < AdObject + REASON = [ + "BANNED_USER", + "DENIED_REFUND", + "GRANTED_REPLACEMENT_ITEM", + ] + + + field :actions, { list: 'object' } + field :application, 'Application' + field :country, 'string' + field :created_time, 'datetime' + field :disputes, { list: 'object' } + field :fraud_status, 'string' + field :fulfillment_status, 'string' + field :id, 'string' + field :is_from_ad, 'bool' + field :is_from_page_post, 'bool' + field :items, { list: 'object' } + field :payout_foreign_exchange_rate, 'double' + field :phone_support_eligible, 'bool' + field :refundable_amount, 'CurrencyAmount' + field :request_id, 'string' + field :tax, 'string' + field :tax_country, 'string' + field :test, 'int' + field :user, 'User' + has_no_post + has_no_delete + + has_edge :dispute do |edge| + edge.post 'PaymentEnginePayment' do |api| + api.has_param :reason, { enum: -> { PaymentEnginePayment::REASON }} + end + end + + has_edge :refunds do |edge| + edge.post 'PaymentEnginePayment' do |api| + api.has_param :amount, 'double' + api.has_param :currency, 'string' + api.has_param :reason, { enum: -> { PaymentEnginePayment::REASON }} + end + end + + end +end diff --git a/lib/facebook_ads/ad_objects/payment_subscription.rb b/lib/facebook_ads/ad_objects/payment_subscription.rb index a8d83a98..1d3fa8e0 100644 --- a/lib/facebook_ads/ad_objects/payment_subscription.rb +++ b/lib/facebook_ads/ad_objects/payment_subscription.rb @@ -29,13 +29,13 @@ class PaymentSubscription < AdObject field :amount, 'string' field :app_param_data, 'string' - field :application, 'Profile' + field :application, 'Application' field :billing_period, 'string' field :canceled_reason, 'string' field :created_time, 'datetime' field :currency, 'string' field :id, 'string' - field :last_payment, 'string' + field :last_payment, 'PaymentEnginePayment' field :next_bill_time, 'datetime' field :next_period_amount, 'string' field :next_period_currency, 'string' @@ -50,7 +50,7 @@ class PaymentSubscription < AdObject field :trial_currency, 'string' field :trial_expiry_time, 'datetime' field :updated_time, 'datetime' - field :user, 'Profile' + field :user, 'User' has_no_post has_no_delete diff --git a/lib/facebook_ads/ad_objects/photo.rb b/lib/facebook_ads/ad_objects/photo.rb index 46c55cf7..b2d98f18 100644 --- a/lib/facebook_ads/ad_objects/photo.rb +++ b/lib/facebook_ads/ad_objects/photo.rb @@ -125,16 +125,6 @@ class Photo < AdObject end end - has_edge :reactions do |edge| - edge.get 'Profile' do |api| - api.has_param :type, { enum: -> { Profile::TYPE }} - end - end - - has_edge :sharedposts do |edge| - edge.get 'Post' - end - has_edge :sponsor_tags do |edge| edge.get 'Page' end diff --git a/lib/facebook_ads/ad_objects/post.rb b/lib/facebook_ads/ad_objects/post.rb index d97c2cd3..a6ff0ca5 100644 --- a/lib/facebook_ads/ad_objects/post.rb +++ b/lib/facebook_ads/ad_objects/post.rb @@ -35,17 +35,6 @@ class Post < AdObject "year", ] - FEED_STORY_VISIBILITY = [ - "hidden", - "visible", - ] - - TIMELINE_VISIBILITY = [ - "forced_allow", - "hidden", - "normal", - ] - CHECKIN_ENTRY_POINT = [ "BRANDING_CHECKIN", "BRANDING_OTHER", @@ -91,6 +80,17 @@ class Post < AdObject "SCHEDULED_RECURRING", ] + FEED_STORY_VISIBILITY = [ + "hidden", + "visible", + ] + + TIMELINE_VISIBILITY = [ + "forced_allow", + "hidden", + "normal", + ] + field :actions, { list: 'string' } field :admin_creator, 'object' @@ -104,22 +104,17 @@ class Post < AdObject field :comments_mirroring_domain, 'string' field :coordinates, 'object' field :created_time, 'datetime' - field :delivery_growth_optimizations, { list: 'string' } field :description, 'string' - field :entities, 'object' field :event, 'Event' field :expanded_height, 'int' field :expanded_width, 'int' field :feed_targeting, 'object' - field :formatting, 'string' field :from, 'object' field :full_picture, 'string' field :height, 'int' field :icon, 'string' field :id, 'string' - field :implicit_place, 'Place' field :instagram_eligibility, 'string' - field :instream_eligibility, 'string' field :is_app_share, 'bool' field :is_eligible_for_promotion, 'bool' field :is_expired, 'bool' @@ -129,8 +124,7 @@ class Post < AdObject field :is_popular, 'bool' field :is_published, 'bool' field :is_spherical, 'bool' - field :link, 'string' - field :live_video_eligibility, { list: 'string' } + field :link, 'object' field :message, 'string' field :message_tags, { list: 'string' } field :multi_share_end_card, 'bool' @@ -141,12 +135,10 @@ class Post < AdObject field :permalink_url, 'object' field :picture, 'string' field :place, 'Place' - field :poll, 'object' field :privacy, 'Privacy' field :promotable_id, 'string' field :promotion_status, 'string' field :properties, { list: 'string' } - field :publishing_stats, 'int' field :scheduled_publish_time, 'double' field :shares, 'object' field :source, 'string' @@ -157,13 +149,11 @@ class Post < AdObject field :target, 'Profile' field :targeting, 'object' field :timeline_visibility, 'string' - field :translations, 'hash' field :type, 'string' field :updated_time, 'datetime' field :via, 'object' field :video_buying_eligibility, { list: 'string' } field :width, 'int' - field :will_be_autocropped_when_deliver_to_instagram, 'bool' has_edge :attachments do |edge| edge.get @@ -217,24 +207,6 @@ class Post < AdObject end end - has_edge :promotions do |edge| - edge.post do |api| - api.has_param :ad_account_id, 'string' - api.has_param :ad_conversion_pixel_id, 'int' - api.has_param :audience, { enum: %w{AUTO_LOOKALIKE AUTO_PAGE_LOOKALIKE AUTO_TARGETING COUNTRY_AND_INTEREST CREATE_NEW CUSTOM_AUDIENCE DISTRICT EVENT_CUSTOM_AUDIENCES EVENT_ENGAGEMENT FANS GROUPER HEC_AUDIENCE IG_PROMOTED_POST_AUTO LOCAL LOOKALIKE MARKETPLACE_DEFAULT MARKETPLACE_NATIONWIDE_AUDIENCE MARKETPLACE_SAVED_AUDIENCE MULT_CUSTOM_AUDIENCES NCPP SAVED_AUDIENCE SMART_AUDIENCE }} - api.has_param :audience_id, 'string' - api.has_param :bid_amount, 'int' - api.has_param :budget, 'int' - api.has_param :cta_type, { enum: %w{ADD_TO_CART APPLY_NOW BOOK_TRAVEL BUY BUY_NOW BUY_TICKETS CALL CALL_ME CONTACT CONTACT_US DONATE DONATE_NOW DOWNLOAD EVENT_RSVP FIND_A_GROUP FIND_YOUR_GROUPS FOLLOW_NEWS_STORYLINE FOLLOW_PAGE FOLLOW_USER GET_DIRECTIONS GET_OFFER GET_OFFER_VIEW GET_QUOTE GET_SHOWTIMES INSTALL_APP INSTALL_MOBILE_APP LEARN_MORE LIKE_PAGE LISTEN_MUSIC LISTEN_NOW MESSAGE_PAGE MOBILE_DOWNLOAD MOMENTS NO_BUTTON OPEN_LINK ORDER_NOW PAY_TO_ACCESS PLAY_GAME PURCHASE_GIFT_CARDS RECORD_NOW REFER_FRIENDS REQUEST_TIME SAY_THANKS SEE_MORE SELL_NOW SEND_A_GIFT SHARE SHOP_NOW SIGN_UP SOTTO_SUBSCRIBE START_ORDER SUBSCRIBE SWIPE_UP_PRODUCT SWIPE_UP_SHOP UPDATE_APP USE_APP USE_MOBILE_APP VIDEO_ANNOTATION VISIT_PAGES_FEED WATCH_MORE WATCH_VIDEO WHATSAPP_MESSAGE WOODHENGE_SUPPORT }} - api.has_param :currency, 'string' - api.has_param :flow_id, 'string' - api.has_param :placement, 'string' - api.has_param :start_time, 'int' - api.has_param :stop_time, 'int' - api.has_param :targeting, 'Targeting' - end - end - has_edge :reactions do |edge| edge.get 'Profile' do |api| api.has_param :type, { enum: -> { Profile::TYPE }} diff --git a/lib/facebook_ads/ad_objects/private_lift_study_instance.rb b/lib/facebook_ads/ad_objects/private_lift_study_instance.rb new file mode 100644 index 00000000..4665472e --- /dev/null +++ b/lib/facebook_ads/ad_objects/private_lift_study_instance.rb @@ -0,0 +1,46 @@ +# 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-generated. + + # 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 PrivateLiftStudyInstance < AdObject + OPERATION = [ + "AGGREGATE", + "COMPUTE", + "ID_MATCH", + "NONE", + ] + + + field :breakdown_key, 'string' + field :created_time, 'datetime' + field :id, 'string' + field :latest_status_update_time, 'datetime' + field :server_ips, { list: 'string' } + field :status, 'string' + has_no_delete + + end +end diff --git a/lib/facebook_ads/ad_objects/product_catalog.rb b/lib/facebook_ads/ad_objects/product_catalog.rb index e62269d8..258c4039 100644 --- a/lib/facebook_ads/ad_objects/product_catalog.rb +++ b/lib/facebook_ads/ad_objects/product_catalog.rb @@ -139,11 +139,32 @@ class ProductCatalog < AdObject end end + has_edge :auto_markets do |edge| + edge.get + end + has_edge :automotive_models do |edge| edge.get 'AutomotiveModel' do |api| api.has_param :bulk_pagination, 'bool' api.has_param :filter, 'object' end + edge.post 'AutomotiveModel' do |api| + api.has_param :automotive_model_id, 'string' + api.has_param :body_style, { enum: -> { AutomotiveModel::BODY_STYLE }} + api.has_param :currency, 'string' + api.has_param :description, 'string' + api.has_param :images, { list: 'object' } + api.has_param :make, 'string' + api.has_param :model, 'string' + api.has_param :price, 'int' + api.has_param :title, 'string' + api.has_param :url, 'string' + api.has_param :year, 'int' + end + end + + has_edge :autos do |edge| + edge.get end has_edge :batch do |edge| @@ -274,6 +295,13 @@ class ProductCatalog < AdObject end end + has_edge :media_titles do |edge| + edge.get do |api| + api.has_param :bulk_pagination, 'bool' + api.has_param :filter, 'object' + end + end + has_edge :pricing_variables_batch do |edge| edge.get 'ProductCatalogPricingVariablesBatch' do |api| api.has_param :handle, 'string' @@ -306,8 +334,8 @@ class ProductCatalog < AdObject api.has_param :quoted_fields_mode, { enum: -> { ProductFeed::QUOTED_FIELDS_MODE }} api.has_param :rules, { list: 'string' } api.has_param :schedule, 'string' + api.has_param :selected_override_fields, { list: 'string' } api.has_param :update_schedule, 'string' - api.has_param :whitelisted_properties, { list: 'string' } end end @@ -347,7 +375,6 @@ class ProductCatalog < AdObject api.has_param :return_only_approved_products, 'bool' end edge.post 'ProductItem' do |api| - api.has_param :additional_image_files, { list: 'file' } api.has_param :additional_image_urls, { list: 'string' } api.has_param :additional_uploaded_image_ids, { list: 'string' } api.has_param :additional_variant_attributes, 'hash' diff --git a/lib/facebook_ads/ad_objects/product_feed.rb b/lib/facebook_ads/ad_objects/product_feed.rb index 6905ade4..082dc3dd 100644 --- a/lib/facebook_ads/ad_objects/product_feed.rb +++ b/lib/facebook_ads/ad_objects/product_feed.rb @@ -53,6 +53,7 @@ class ProductFeed < AdObject FEED_TYPE = [ "AUTO", + "AUTOMOTIVE_MODEL", "DESTINATION", "FLIGHT", "HOME_LISTING", @@ -126,7 +127,11 @@ class ProductFeed < AdObject field :feed_type, { enum: -> { FEED_TYPE }} field :override_value, 'string' field :rules, { list: 'string' } - field :whitelisted_properties, { list: 'string' } + field :selected_override_fields, { list: 'string' } + + has_edge :auto_markets do |edge| + edge.get + end has_edge :automotive_models do |edge| edge.get 'AutomotiveModel' do |api| @@ -135,6 +140,10 @@ class ProductFeed < AdObject end end + has_edge :autos do |edge| + edge.get + end + has_edge :destinations do |edge| edge.get 'Destination' do |api| api.has_param :bulk_pagination, 'bool' @@ -163,6 +172,13 @@ class ProductFeed < AdObject end end + has_edge :media_titles do |edge| + edge.get do |api| + api.has_param :bulk_pagination, 'bool' + api.has_param :filter, 'object' + end + end + has_edge :products do |edge| edge.get 'ProductItem' do |api| api.has_param :bulk_pagination, 'bool' diff --git a/lib/facebook_ads/ad_objects/product_feed_schedule.rb b/lib/facebook_ads/ad_objects/product_feed_schedule.rb index 9c148aed..c8786858 100644 --- a/lib/facebook_ads/ad_objects/product_feed_schedule.rb +++ b/lib/facebook_ads/ad_objects/product_feed_schedule.rb @@ -54,6 +54,8 @@ class ProductFeedSchedule < AdObject field :timezone, 'string' field :url, 'string' field :username, 'string' + has_no_post + has_no_delete end end diff --git a/lib/facebook_ads/ad_objects/product_item.rb b/lib/facebook_ads/ad_objects/product_item.rb index e40a9939..2e8e3aab 100644 --- a/lib/facebook_ads/ad_objects/product_item.rb +++ b/lib/facebook_ads/ad_objects/product_item.rb @@ -62,6 +62,15 @@ class ProductItem < AdObject "unisex", ] + IMAGE_FETCH_STATUS = [ + "DIRECT_UPLOAD", + "FETCHED", + "FETCH_FAILED", + "NO_STATUS", + "OUTDATED", + "PARTIAL_FETCH", + ] + REVIEW_STATUS = [ "", "approved", @@ -92,6 +101,7 @@ class ProductItem < AdObject "FB_APRL_CLOTHING", "FB_APRL_COSTUME", "FB_APRL_CSTM", + "FB_APRL_FORMAL", "FB_APRL_HANDBAG", "FB_APRL_JEWELRY", "FB_APRL_SHOE", @@ -293,6 +303,7 @@ class ProductItem < AdObject field :additional_variant_attributes, 'hash' field :age_group, { enum: -> { AGE_GROUP }} field :applinks, 'CatalogItemAppLinks' + field :ar_data, 'ProductItemArData' field :availability, { enum: -> { AVAILABILITY }} field :brand, 'string' field :capability_to_review_status, 'hash' @@ -315,6 +326,7 @@ class ProductItem < AdObject field :gtin, 'string' field :id, 'string' field :image_cdn_urls, 'hash' + field :image_fetch_status, { enum: -> { IMAGE_FETCH_STATUS }} field :image_url, 'string' field :images, { list: 'string' } field :inventory, 'int' @@ -323,6 +335,7 @@ class ProductItem < AdObject field :mobile_link, 'string' field :name, 'string' field :ordering_index, 'int' + field :parent_product_id, 'string' field :pattern, 'string' field :price, 'string' field :product_catalog, 'ProductCatalog' @@ -343,7 +356,6 @@ class ProductItem < AdObject field :start_date, 'string' field :url, 'string' field :visibility, { enum: -> { VISIBILITY }} - field :additional_image_files, { list: 'file' } field :additional_uploaded_image_ids, { list: 'string' } field :android_app_name, 'string' field :android_class, 'string' @@ -369,6 +381,10 @@ class ProductItem < AdObject field :windows_phone_app_name, 'string' field :windows_phone_url, 'string' + has_edge :channels_to_integrity_status do |edge| + edge.get 'CatalogItemChannelsToIntegrityStatus' + end + has_edge :product_sets do |edge| edge.get 'ProductSet' end diff --git a/lib/facebook_ads/ad_objects/user_payment_methods_info.rb b/lib/facebook_ads/ad_objects/product_item_ar_data.rb similarity index 68% rename from lib/facebook_ads/ad_objects/user_payment_methods_info.rb rename to lib/facebook_ads/ad_objects/product_item_ar_data.rb index f31621a9..b20220c1 100644 --- a/lib/facebook_ads/ad_objects/user_payment_methods_info.rb +++ b/lib/facebook_ads/ad_objects/product_item_ar_data.rb @@ -25,15 +25,31 @@ module FacebookAds # on github and we'll fix in our codegen framework. We'll not be able to accept # pull request for this class. - class UserPaymentMethodsInfo < AdObject + class ProductItemArData < AdObject + SURFACES = [ + "B2C_MARKETPLACE", + "C2C_MARKETPLACE", + "DA", + "DAILY_DEALS", + "DAILY_DEALS_LEGACY", + "IG_PRODUCT_TAGGING", + "MARKETPLACE", + "MARKETPLACE_ADS_DEPRECATED", + "MARKETPLACE_SHOPS", + "OFFLINE_CONVERSIONS", + "SHOPS", + "UNIVERSAL_CHECKOUT", + "WHATSAPP", + ] - field :account_id, 'string' - field :available_card_types, { list: 'string' } - field :available_payment_methods, { list: 'string' } - field :available_payment_methods_details, { list: 'object' } - field :country, 'string' - field :currency, 'string' - field :existing_payment_methods, { list: 'object' } + + field :container_effect, 'string' + field :effect_icon, 'string' + field :effect_parameters, 'object' + field :picker_icon, 'string' + field :product_ar_link, 'object' + field :state, 'string' + field :surfaces, { list: { enum: -> { SURFACES }} } has_no_id has_no_get has_no_post diff --git a/lib/facebook_ads/ad_objects/product_set.rb b/lib/facebook_ads/ad_objects/product_set.rb index bbf7d426..03eca6f7 100644 --- a/lib/facebook_ads/ad_objects/product_set.rb +++ b/lib/facebook_ads/ad_objects/product_set.rb @@ -73,6 +73,13 @@ class ProductSet < AdObject end end + has_edge :media_titles do |edge| + edge.get do |api| + api.has_param :bulk_pagination, 'bool' + api.has_param :filter, 'object' + end + end + has_edge :products do |edge| edge.get 'ProductItem' do |api| api.has_param :bulk_pagination, 'bool' diff --git a/lib/facebook_ads/ad_objects/saved_audience.rb b/lib/facebook_ads/ad_objects/saved_audience.rb index 043ccd4d..56e8713f 100644 --- a/lib/facebook_ads/ad_objects/saved_audience.rb +++ b/lib/facebook_ads/ad_objects/saved_audience.rb @@ -29,6 +29,7 @@ class SavedAudience < AdObject field :account, 'AdAccount' field :approximate_count, 'int' + field :approximate_count_64bit, 'int' field :description, 'string' field :extra_info, 'string' field :id, 'string' diff --git a/lib/facebook_ads/ad_objects/server_side/action_source.rb b/lib/facebook_ads/ad_objects/server_side/action_source.rb new file mode 100644 index 00000000..89f6af57 --- /dev/null +++ b/lib/facebook_ads/ad_objects/server_side/action_source.rb @@ -0,0 +1,48 @@ +# 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 ServerSide + ActionSource = Set[ + + # Conversion happened over email. + 'email', + + # Conversion was made on your website. + 'website', + + # Conversion was made using your app. + 'app', + + # Conversion was made over the phone. + 'phone_call', + + # Conversion was made via a messaging app, SMS, or online messaging feature. + 'chat', + + # Conversion was made in person at your physical store. + 'physical_store', + + # Conversion happened automatically, for example, a subscription renewal that's set on auto-pay each month. + 'system_generated', + + # Conversion happened in a way that is not listed. + 'other' + ] + end +end diff --git a/lib/facebook_ads/ad_objects/server_side/event.rb b/lib/facebook_ads/ad_objects/server_side/event.rb index bea6ba62..f30e57dc 100644 --- a/lib/facebook_ads/ad_objects/server_side/event.rb +++ b/lib/facebook_ads/ad_objects/server_side/event.rb @@ -64,6 +64,9 @@ class Event # For more details see https://developers.facebook.com/docs/marketing-apis/data-processing-options attr_accessor :data_processing_options_state + # Where the conversion occurred. + attr_accessor :action_source + # @param [String] event_name # @param [int] event_time # @param [String] event_source_url @@ -74,6 +77,7 @@ class Event # @param [Array<String>] data_processing_options # @param [int] data_processing_options_country # @param [int] data_processing_options_state + # @param String action_source def initialize(event_name: nil, event_time: nil, event_source_url: nil, @@ -83,7 +87,8 @@ def initialize(event_name: nil, custom_data: nil, data_processing_options: nil, data_processing_options_country: nil, - data_processing_options_state: nil) + data_processing_options_state: nil, + action_source: nil) unless event_name.nil? self.event_name = event_name @@ -115,6 +120,9 @@ def initialize(event_name: nil, unless data_processing_options_state.nil? self.data_processing_options_state = data_processing_options_state end + unless action_source.nil? + self.action_source = action_source + end end # build the object using the input hash @@ -154,15 +162,19 @@ def build(attributes = {}) end if attributes.has_key?(:'data_processing_options') - self.custom_data = attributes[:'data_processing_options'] + self.data_processing_options = attributes[:'data_processing_options'] end if attributes.has_key?(:'data_processing_options_country') - self.custom_data = attributes[:'data_processing_options_country'] + self.data_processing_options_country = attributes[:'data_processing_options_country'] end if attributes.has_key?(:'data_processing_options_state') - self.custom_data = attributes[:'data_processing_options_state'] + self.data_processing_options_state = attributes[:'data_processing_options_state'] + end + + if attributes.has_key?(:'action_source') + self.action_source = attributes[:'action_source'] end end @@ -207,7 +219,8 @@ def ==(o) custom_data == o.custom_data && data_processing_options == o.data_processing_options && data_processing_options_country == o.data_processing_options_country && - data_processing_options_state == o.data_processing_options_state + data_processing_options_state == o.data_processing_options_state && + action_source == o.action_source end # @see the `==` method @@ -218,7 +231,11 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [event_name, event_time, event_source_url, opt_out, event_id, user_data, custom_data, data_processing_options, data_processing_options_country, data_processing_options_state].hash + [ + event_name, event_time, event_source_url, opt_out, event_id, user_data, custom_data, + data_processing_options, data_processing_options_country, data_processing_options_state, + action_source, + ].hash end def to_s @@ -253,6 +270,9 @@ def to_s unless data_processing_options_state.nil? hash['data_processing_options_state'] = data_processing_options_state.to_s end + unless action_source.nil? + hash['action_source'] = action_source + end hash.to_s end @@ -290,6 +310,12 @@ def normalize unless data_processing_options_state.nil? hash['data_processing_options_state'] = data_processing_options_state end + unless action_source.nil? + hash['action_source'] = FacebookAds::ServerSide::Util.normalize( + action_source, + 'action_source' + ) + end hash end diff --git a/lib/facebook_ads/ad_objects/server_side/user_data.rb b/lib/facebook_ads/ad_objects/server_side/user_data.rb index c434ffee..5bf456c3 100644 --- a/lib/facebook_ads/ad_objects/server_side/user_data.rb +++ b/lib/facebook_ads/ad_objects/server_side/user_data.rb @@ -22,53 +22,157 @@ module ServerSide # UserData is a set of identifiers Facebook can use for targeted attribution class UserData + # A list of email addresses, in lowercase. + # Example: ['joe@eg.com'] + attr_accessor :emails + # An email address, in lowercase. # Example: joe@eg.com - attr_accessor :email + def email + @emails ? @emails[0] : nil + end + def email=(email) + @emails = [email] + end + + # A list of phone numbers. Include only digits with country code, area code, and number. + # Example: ['16505551212'] + attr_accessor :phones # A phone number. Include only digits with country code, area code, and number. # Example: 16505551212 - attr_accessor :phone + def phone + @phones ? @phones[0] : nil + end + def phone=(phone) + @phones = [phone] + end + + # A list of genders, in lowercase. + # Example: ['f'] + attr_accessor :genders # Gender, in lowercase. Either f or m. - attr_accessor :gender + def gender + @genders ? @genders[0] : nil + end + def gender=(gender) + @genders = [gender] + end + + # A list of dates of birth given as year, month, and day. + # Format should be 'YYYYMMDD' + # Example: ['19971226'] for December 26, 1997. + attr_accessor :dates_of_birth # A date of birth given as year, month, and day. # Format should be 'YYYYMMDD' # Example: 19971226 for December 26, 1997. - attr_accessor :date_of_birth + def date_of_birth + @dates_of_birth ? @dates_of_birth[0] : nil + end + def date_of_birth=(date_of_birth) + @dates_of_birth = [date_of_birth] + end + + # A list of last names in lowercase. + # Example: ['smith'] + attr_accessor :last_names # A last name in lowercase. # Example: smith - attr_accessor :last_name + def last_name + @last_names ? @last_names[0] : nil + end + def last_name=(last_name) + @last_names = [last_name] + end + + # A list of first names in lowercase. + # Example: ['joe'] + attr_accessor :first_names # A first name in lowercase. # Example: joe - attr_accessor :first_name + def first_name + @first_names ? @first_names[0] : nil + end + def first_name=(first_name) + @first_names = [first_name] + end + + # A list of cities in lower-case without spaces or punctuation. + # Example: ['menlopark'] + attr_accessor :cities # A city in lower-case without spaces or punctuation. # Example: menlopark - attr_accessor :city + def city + @cities ? @cities[0] : nil + end + def city=(city) + @cities = [city] + end + + # A list of two-letter country codes in lowercase. + # Example: ['us'] + attr_accessor :country_codes # A two-letter country code in lowercase. # Example: us - attr_accessor :country_code + def country_code + @country_codes ? @country_codes[0] : nil + end + def country_code=(country_code) + @country_codes = [country_code] + end + + # A list of two-letter state codes in lowercase. + # Example: ['ca'] + attr_accessor :states # A two-letter state code in lowercase. # Example: ca - attr_accessor :state + def state + @states ? @states[0] : nil + end + def state=(state) + @states = [state] + end + + # A list of five-digit zip codes for United States. + # For other locations, follow each country's standards. + # Example: ['94035'] (for United States) + attr_accessor :zip_codes # A five-digit zip code for United States. # For other locations, follow each country's standards. # Example: 94035 (for United States) - attr_accessor :zip_code + def zip_code + @zip_codes ? @zip_codes[0] : nil + end + def zip_code=(zip_code) + @zip_codes = [zip_code] + end + + # A list of unique IDs from the advertiser, such as loyalty membership IDs, user IDs, and external cookie IDs. + # In the Offline Conversions API (https://www.facebook.com/business/help/104039186799009), + # this is known as extern_id. For more information, see Offline Conversions, Providing External IDs. + # If External ID is being sent via other channels, then it should be sent in the same format + # via the Conversions API. + attr_accessor :external_ids # Any unique ID from the advertiser, such as loyalty membership IDs, user IDs, and external cookie IDs. # In the Offline Conversions API (https://www.facebook.com/business/help/104039186799009), # this is known as extern_id. For more information, see Offline Conversions, Providing External IDs. # If External ID is being sent via other channels, then it should be sent in the same format - # via the server-side API. - attr_accessor :external_id + # via the Conversions API. + def external_id + @external_ids ? @external_ids[0] : nil + end + def external_id=(external_id) + @external_ids = [external_id] + end # The IP address of the browser corresponding to the event. attr_accessor :client_ip_address @@ -78,13 +182,13 @@ class UserData # The Facebook click ID value stored in the _fbc browser cookie under your domain. # See Managing fbc and fbp Parameters for how to get this value - # (https://developers.facebook.com/docs/marketing-api/facebook-pixel/server-side-api/parameters#fbc), + # (https://developers.facebook.com/docs/marketing-api/facebook-pixel/conversions-api/parameters#fbc), # or generate this value from a fbclid query parameter. attr_accessor :fbc # The Facebook browser ID value stored in the _fbp browser cookie under your domain. # See Managing fbc and fbp Parameters for how to get this value - # (https://developers.facebook.com/docs/marketing-api/facebook-pixel/server-side-api/parameters#fbc), + # (https://developers.facebook.com/docs/marketing-api/facebook-pixel/conversions-api/parameters#fbc), # or generate this value from a fbclid query parameter. attr_accessor :fbp @@ -109,21 +213,32 @@ class UserData # The date of birth month. attr_accessor :dobm - # THe date of birth year. + # The date of birth year. attr_accessor :doby #UserData is a set of identifiers Facebook can use for targeted attribution # @param [String] email + # @param [Array<String>] emails # @param [String] phone + # @param [Array<String>] phones # @param [String] gender + # @param [Array<String>] genders # @param [String] date_of_birth + # @param [Array<String>] dates_of_births # @param [String] last_name + # @param [Array<String>] last_names # @param [String] first_name + # @param [Array<String>] first_names # @param [String] city + # @param [Array<String>] cities # @param [String] state + # @param [Array<String>] states # @param [String] country_code + # @param [Array<String>] country_codes # @param [String] zip_code + # @param [Array<String>] zip_codes # @param [String] external_id + # @param [Array<String>] external_ids # @param [String] client_ip_address # @param [String] client_user_agent # @param [String] fbc @@ -136,44 +251,91 @@ class UserData # @param [String] dobd # @param [String] dobm # @param [String] doby - def initialize(email: nil, phone: nil, gender: nil, date_of_birth: nil, - last_name: nil, first_name: nil, city: nil, state: nil, - country_code: nil, zip_code: nil, external_id: nil, client_ip_address: nil, + def initialize(email: nil, emails: nil, phone: nil, phones: nil, gender: nil, genders: nil, + date_of_birth: nil, dates_of_birth: nil, last_name: nil, last_names: nil, + first_name: nil, first_names: nil, city: nil, cities: nil, state: nil, states: nil, + country_code: nil, country_codes: nil, zip_code: nil, zip_codes: nil, + external_id: nil, external_ids: nil, client_ip_address: nil, client_user_agent: nil, fbc: nil, fbp: nil, subscription_id: nil, lead_id: nil, f5first: nil, f5last: nil, fi: nil, dobd: nil, dobm: nil, doby: nil) + validate_constructor_values(emails, email, 'emails', 'email') + validate_constructor_values(phones, phone, 'phones', 'phone') + validate_constructor_values(genders, gender, 'genders', 'gender') + validate_constructor_values(dates_of_birth, date_of_birth, 'dates_of_birth', 'date_of_birth') + validate_constructor_values(first_names, first_name, 'first_names', 'first_name') + validate_constructor_values(last_names, last_name, 'last_names', 'last_name') + validate_constructor_values(cities, city, 'cities', 'city') + validate_constructor_values(country_codes, country_code, 'country_codes', 'country_code') + validate_constructor_values(states, state, 'states', 'state') + validate_constructor_values(zip_codes, zip_code, 'zip_codes', 'zip_code') + validate_constructor_values(external_ids, external_id, 'external_ids', 'external_id') + unless email.nil? self.email = email end + unless emails.nil? + self.emails = emails + end unless phone.nil? self.phone = phone end + unless phones.nil? + self.phones = phones + end unless gender.nil? self.gender = gender end + unless genders.nil? + self.genders = genders + end unless date_of_birth.nil? self.date_of_birth = date_of_birth end + unless dates_of_birth.nil? + self.dates_of_birth = dates_of_birth + end unless last_name.nil? self.last_name = last_name end + unless last_names.nil? + self.last_names = last_names + end unless first_name.nil? self.first_name = first_name end + unless first_names.nil? + self.first_names = first_names + end unless city.nil? self.city = city end + unless cities.nil? + self.cities = cities + end unless state.nil? self.state = state end + unless states.nil? + self.states = states + end unless country_code.nil? self.country_code = country_code end + unless country_codes.nil? + self.country_codes = country_codes + end unless zip_code.nil? self.zip_code = zip_code end + unless zip_codes.nil? + self.zip_codes = zip_codes + end unless external_id.nil? self.external_id = external_id end + unless external_ids.nil? + self.external_ids = external_ids + end unless client_ip_address.nil? self.client_ip_address = client_ip_address end @@ -220,48 +382,70 @@ def build(attributes = {}) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } - if attributes.has_key?(:'email') - self.email = attributes[:'email'] + if attributes.has_key?(:'emails') + self.emails = attributes[:'emails'] + elsif attributes.has_key?(:'email') + self.emails = [attributes[:'email']] end - if attributes.has_key?(:'phone') - self.phone = attributes[:'phone'] + if attributes.has_key?(:'phones') + self.phones = attributes[:'phones'] + elsif attributes.has_key?(:'phone') + self.phones = [attributes[:'phone']] end - if attributes.has_key?(:'gender') - self.gender = attributes[:'gender'] + if attributes.has_key?(:'genders') + self.genders = attributes[:'genders'] + elsif attributes.has_key?(:'gender') + self.genders = [attributes[:'gender']] end - if attributes.has_key?(:'date_of_birth') - self.date_of_birth = attributes[:'date_of_birth'] + if attributes.has_key?(:'dates_of_birth') + self.dates_of_birth = attributes[:'dates_of_birth'] + elsif attributes.has_key?(:'date_of_birth') + self.dates_of_birth = [attributes[:'date_of_birth']] end - if attributes.has_key?(:'last_name') - self.last_name = attributes[:'last_name'] + if attributes.has_key?(:'last_names') + self.last_names = attributes[:'last_names'] + elsif attributes.has_key?(:'last_name') + self.last_names = [attributes[:'last_name']] end - if attributes.has_key?(:'first_name') - self.first_name = attributes[:'first_name'] + if attributes.has_key?(:'first_names') + self.first_names = attributes[:'first_names'] + elsif attributes.has_key?(:'first_name') + self.first_names = [attributes[:'first_name']] end - if attributes.has_key?(:'city') - self.city = attributes[:'city'] + if attributes.has_key?(:'cities') + self.cities = attributes[:'cities'] + elsif attributes.has_key?(:'city') + self.cities = [attributes[:'city']] end - if attributes.has_key?(:'country_code') - self.country_code = attributes[:'country_code'] + if attributes.has_key?(:'country_codes') + self.country_codes = attributes[:'country_codes'] + elsif attributes.has_key?(:'country_code') + self.country_codes = [attributes[:'country_code']] end - if attributes.has_key?(:'state') - self.state = attributes[:'state'] + if attributes.has_key?(:'states') + self.states = attributes[:'states'] + elsif attributes.has_key?(:'state') + self.states = [attributes[:'state']] end - if attributes.has_key?(:'zip_code') - self.zip_code = attributes[:'zip_code'] + if attributes.has_key?(:'zip_codes') + self.zip_codes = attributes[:'zip_codes'] + elsif attributes.has_key?(:'zip_code') + self.zip_codes = [attributes[:'zip_code']] end - if attributes.has_key?(:'external_id') - self.external_id = attributes[:'external_id'] + if attributes.has_key?(:'external_ids') + self.external_ids = attributes[:'external_ids'] + elsif attributes.has_key?(:'external_id') + self.external_ids = [attributes[:'external_id']] end if attributes.has_key?(:'client_ip_address') @@ -313,17 +497,17 @@ def build(attributes = {}) def ==(o) return true if self.equal?(o) self.class == o.class && - email == o.email && - phone == o.phone && - gender == o.gender && - date_of_birth == o.date_of_birth && - last_name == o.last_name && - first_name == o.first_name && - city == o.city && - country_code == o.country_code && - state == o.state && - zip_code == o.zip_code && - external_id == o.external_id && + emails == o.emails && + phones == o.phones && + genders == o.genders && + dates_of_birth == o.dates_of_birth && + last_names == o.last_names && + first_names == o.first_names && + cities == o.cities && + country_codes == o.country_codes && + states == o.states && + zip_codes == o.zip_codes && + external_ids == o.external_ids && client_ip_address == o.client_ip_address && client_user_agent == o.client_user_agent && fbc == o.fbc && @@ -347,17 +531,17 @@ def eql?(o) # @return [Fixnum] Hash code def hash [ - email, - phone, - gender, - date_of_birth, - last_name, - first_name, - city, - country_code, - state, - zip_code, - external_id, + emails, + phones, + genders, + dates_of_birth, + last_names, + first_names, + cities, + country_codes, + states, + zip_codes, + external_ids, client_ip_address, client_user_agent, fbc, @@ -378,38 +562,38 @@ def hash # @return [String] String presentation of the object def to_s hash = {} - unless email.nil? - hash['email'] = email + unless emails.nil? + hash['emails'] = emails end - unless phone.nil? - hash['phone'] = phone + unless phones.nil? + hash['phones'] = phones end - unless gender.nil? - hash['gender'] = gender + unless genders.nil? + hash['genders'] = genders end - unless date_of_birth.nil? - hash['date_of_birth'] = date_of_birth + unless dates_of_birth.nil? + hash['dates_of_birth'] = dates_of_birth end - unless last_name.nil? - hash['last_name'] = last_name + unless last_names.nil? + hash['last_names'] = last_names end - unless first_name.nil? - hash['first_name'] = first_name + unless first_names.nil? + hash['first_names'] = first_names end - unless city.nil? - hash['city'] = city + unless cities.nil? + hash['cities'] = cities end - unless country_code.nil? - hash['country_code'] = country_code + unless country_codes.nil? + hash['country_codes'] = country_codes end - unless state.nil? - hash['state'] = state + unless states.nil? + hash['states'] = states end - unless zip_code.nil? - hash['zip_code'] = zip_code + unless zip_codes.nil? + hash['zip_codes'] = zip_codes end - unless external_id.nil? - hash['external_id'] = external_id + unless external_ids.nil? + hash['external_ids'] = external_ids end unless client_ip_address.nil? hash['client_ip_address'] = client_ip_address @@ -455,37 +639,37 @@ def to_s def normalize hash = {} unless email.nil? - hash['em'] = FacebookAds::ServerSide::Util.normalize(email, 'em') + hash['em'] = FacebookAds::ServerSide::Util.normalize_array(emails, 'em') end unless phone.nil? - hash['ph'] = FacebookAds::ServerSide::Util.normalize(phone, 'ph') + hash['ph'] = FacebookAds::ServerSide::Util.normalize_array(phones, 'ph') end unless gender.nil? - hash['ge'] = FacebookAds::ServerSide::Util.normalize(gender, 'ge') + hash['ge'] = FacebookAds::ServerSide::Util.normalize_array(genders, 'ge') end unless date_of_birth.nil? - hash['db'] = FacebookAds::ServerSide::Util.normalize(date_of_birth, 'db') + hash['db'] = FacebookAds::ServerSide::Util.normalize_array(dates_of_birth, 'db') end unless last_name.nil? - hash['ln'] = FacebookAds::ServerSide::Util.normalize(last_name, 'ln') + hash['ln'] = FacebookAds::ServerSide::Util.normalize_array(last_names, 'ln') end unless first_name.nil? - hash['fn'] = FacebookAds::ServerSide::Util.normalize(first_name, 'fn') + hash['fn'] = FacebookAds::ServerSide::Util.normalize_array(first_names, 'fn') end unless city.nil? - hash['ct'] = FacebookAds::ServerSide::Util.normalize(city, 'ct') + hash['ct'] = FacebookAds::ServerSide::Util.normalize_array(cities, 'ct') end unless country_code.nil? - hash['country'] = FacebookAds::ServerSide::Util.normalize(country_code, 'country') + hash['country'] = FacebookAds::ServerSide::Util.normalize_array(country_codes, 'country') end unless state.nil? - hash['st'] = FacebookAds::ServerSide::Util.normalize(state, 'st') + hash['st'] = FacebookAds::ServerSide::Util.normalize_array(states, 'st') end unless zip_code.nil? - hash['zp'] = FacebookAds::ServerSide::Util.normalize(zip_code, 'zp') + hash['zp'] = FacebookAds::ServerSide::Util.normalize_array(zip_codes, 'zp') end unless external_id.nil? - hash['external_id'] = external_id + hash['external_id'] = external_ids end unless client_ip_address.nil? hash['client_ip_address'] = client_ip_address @@ -523,7 +707,17 @@ def normalize unless doby.nil? hash['doby'] = FacebookAds::ServerSide::Util.normalize(doby, 'doby') end - hash + hash.select{|k, v| !v.nil?} + end + + def validate_constructor_values(multi_value, single_value, multi_string, single_string) + if !multi_value.nil? && !single_value.nil? + raise ArgumentError.new( + 'Cannot set both %s and %s parameters via constructor. ' % [ + multi_string, single_string + ] + 'Please set either the multi or single parameter, not both.' + ) + end end end end diff --git a/lib/facebook_ads/ad_objects/server_side/util.rb b/lib/facebook_ads/ad_objects/server_side/util.rb index f07d95d9..cca00aa8 100644 --- a/lib/facebook_ads/ad_objects/server_side/util.rb +++ b/lib/facebook_ads/ad_objects/server_side/util.rb @@ -32,6 +32,21 @@ class Util # RFC 2822 for email format EMAIL_REGEX = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i + # Normalizes the input array of strings given the field_type + # @param [Array<String>] input string array that needs to be normalized + # @param [String] field_type Type/Key for the value provided + # @return [Array<String>] Normalized values for the input and field_type. + def self.normalize_array(input_array, field_type) + return nil unless input_array.is_a?(Enumerable) + return nil if input_array.empty? + return nil unless input_array.all?{|value| value.is_a?(String)} + + input_array + .map{|value| self.normalize(value, field_type)} + .to_set + .to_a + end + # Normalizes the input string given the field_type # @param [String] input Input string that needs to be normalized # @param [String] field_type Type/Key for the value provided @@ -52,6 +67,8 @@ def self.normalize(input, field_type) normalized_input = input; case field_type + when 'action_source' + return normalize_action_source input when 'country' normalized_input = normalize_country input when 'ct' @@ -152,7 +169,7 @@ def self.normalize_currency(currency) def self.normalize_email(email) if EMAIL_REGEX.match(email) == nil - return ArgumentError, "Invalid email format for the passed email:' + email + '.Please check the passed email format." + raise ArgumentError, "Invalid email format for the passed email: '#{email}'. Please check the passed email format." end return email @@ -290,6 +307,17 @@ def self.normalize_delivery_category(delivery_category) delivery_category; end + # Normalizes the input action_source and returns valid value (or throw exception if invalid). + def self.normalize_action_source(action_source) + unless FacebookAds::ServerSide::ActionSource.include?(action_source) + values = FacebookAds::ServerSide::ActionSource.to_a.join(',') + raise ArgumentError.new( + "Invalid action_source passed: #{action_source}. Please use one of the defined values: #{values}" + ) + end + + action_source + end end end end diff --git a/lib/facebook_ads/ad_objects/system_user.rb b/lib/facebook_ads/ad_objects/system_user.rb index 0f61e8e6..c41a01cc 100644 --- a/lib/facebook_ads/ad_objects/system_user.rb +++ b/lib/facebook_ads/ad_objects/system_user.rb @@ -26,6 +26,24 @@ module FacebookAds # pull request for this class. class SystemUser < AdObject + ROLE = [ + "ADMIN", + "ADS_RIGHTS_REVIEWER", + "DEFAULT", + "DEVELOPER", + "EMPLOYEE", + "FINANCE_ANALYST", + "FINANCE_EDIT", + "FINANCE_EDITOR", + "FINANCE_VIEW", + "MANAGE", + "PARTNER_CENTER_ADMIN", + "PARTNER_CENTER_ANALYST", + "PARTNER_CENTER_EDUCATION", + "PARTNER_CENTER_MARKETING", + "PARTNER_CENTER_OPERATIONS", + ] + field :created_by, 'User' field :created_time, 'datetime' @@ -33,6 +51,8 @@ class SystemUser < AdObject field :id, 'string' field :ip_permission, 'string' field :name, 'string' + field :role, { enum: -> { ROLE }} + field :system_user_id, 'int' has_no_post has_no_delete diff --git a/lib/facebook_ads/ad_objects/targeting.rb b/lib/facebook_ads/ad_objects/targeting.rb index 9bd8f9e4..6fd05e78 100644 --- a/lib/facebook_ads/ad_objects/targeting.rb +++ b/lib/facebook_ads/ad_objects/targeting.rb @@ -27,13 +27,11 @@ module FacebookAds class Targeting < AdObject DEVICE_PLATFORMS = [ - "connected_tv", "desktop", "mobile", ] EFFECTIVE_DEVICE_PLATFORMS = [ - "connected_tv", "desktop", "mobile", ] diff --git a/lib/facebook_ads/ad_objects/unified_thread.rb b/lib/facebook_ads/ad_objects/unified_thread.rb index e67ea4a7..f13f3588 100644 --- a/lib/facebook_ads/ad_objects/unified_thread.rb +++ b/lib/facebook_ads/ad_objects/unified_thread.rb @@ -32,7 +32,6 @@ class UnifiedThread < AdObject field :id, 'string' field :is_subscribed, 'bool' field :link, 'string' - field :linked_group, 'Group' field :message_count, 'int' field :name, 'string' field :participants, 'object' diff --git a/lib/facebook_ads/ad_objects/user.rb b/lib/facebook_ads/ad_objects/user.rb index 50f1db34..ce35f3c8 100644 --- a/lib/facebook_ads/ad_objects/user.rb +++ b/lib/facebook_ads/ad_objects/user.rb @@ -49,14 +49,10 @@ class User < AdObject field :about, 'string' - field :address, 'Location' - field :admin_notes, { list: 'PageAdminNote' } field :age_range, 'AgeRange' - field :auth_method, 'string' field :birthday, 'string' field :cover, 'UserCoverPhoto' field :currency, 'Currency' - field :devices, { list: 'UserDevice' } field :education, { list: 'object' } field :email, 'string' field :favorite_athletes, { list: 'Experience' } @@ -79,15 +75,12 @@ class User < AdObject field :locale, 'string' field :location, 'Page' field :meeting_for, { list: 'string' } - field :messenger_join_notifications_enabled, 'bool' field :middle_name, 'string' field :name, 'string' field :name_format, 'string' field :payment_pricepoints, 'PaymentPricepoints' field :political, 'string' field :profile_pic, 'string' - field :public_key, 'string' - field :published_timeline, 'bool' field :quotes, 'string' field :relationship_status, 'string' field :religion, 'string' @@ -100,15 +93,17 @@ class User < AdObject field :timezone, 'double' field :token_for_business, 'string' field :updated_time, 'datetime' - field :user_storage_key, 'string' - field :username, 'string' field :verified, 'bool' field :video_upload_limits, 'VideoUploadLimits' field :website, 'string' - field :work, { list: 'object' } has_edge :access_tokens do |edge| edge.delete + edge.post 'User' do |api| + api.has_param :business_app, 'int' + api.has_param :page_id, 'string' + api.has_param :scope, { list: 'Permission' } + end end has_edge :accounts do |edge| @@ -511,8 +506,8 @@ class User < AdObject end end - has_edge :owned_product_catalogs do |edge| - edge.get 'ProductCatalog' + has_edge :payment_transactions do |edge| + edge.get 'PaymentEnginePayment' end has_edge :permissions do |edge| @@ -599,6 +594,17 @@ class User < AdObject end end + has_edge :posts do |edge| + edge.get 'Post' do |api| + api.has_param :include_hidden, 'bool' + api.has_param :q, 'string' + api.has_param :show_expired, 'bool' + api.has_param :since, 'datetime' + api.has_param :until, 'datetime' + api.has_param :with, 'string' + end + end + has_edge :rich_media_documents do |edge| edge.get 'Canvas' do |api| api.has_param :query, 'string' @@ -620,7 +626,6 @@ class User < AdObject api.has_param :animated_effect_id, 'int' api.has_param :application_id, 'string' api.has_param :asked_fun_fact_prompt_id, 'int' - api.has_param :attribution_app_id, 'string' api.has_param :audio_story_wave_animation_handle, 'string' api.has_param :composer_entry_picker, 'string' api.has_param :composer_entry_point, 'string' diff --git a/lib/facebook_ads/ad_objects/vehicle.rb b/lib/facebook_ads/ad_objects/vehicle.rb index 9a716aa7..b842ed7c 100644 --- a/lib/facebook_ads/ad_objects/vehicle.rb +++ b/lib/facebook_ads/ad_objects/vehicle.rb @@ -26,6 +26,15 @@ module FacebookAds # pull request for this class. class Vehicle < AdObject + IMAGE_FETCH_STATUS = [ + "DIRECT_UPLOAD", + "FETCHED", + "FETCH_FAILED", + "NO_STATUS", + "OUTDATED", + "PARTIAL_FETCH", + ] + AVAILABILITY = [ "AVAILABLE", "NOT_AVAILABLE", @@ -127,6 +136,7 @@ class Vehicle < AdObject field :features, { list: 'object' } field :fuel_type, 'string' field :id, 'string' + field :image_fetch_status, { enum: -> { IMAGE_FETCH_STATUS }} field :images, { list: 'string' } field :interior_color, 'string' field :legal_disclosure_impressum_url, 'string' @@ -152,5 +162,13 @@ class Vehicle < AdObject field :year, 'int' has_no_delete + has_edge :augmented_realities_metadata do |edge| + edge.get + end + + has_edge :videos_metadata do |edge| + edge.get + end + end end diff --git a/lib/facebook_ads/ad_objects/vehicle_offer.rb b/lib/facebook_ads/ad_objects/vehicle_offer.rb index 61fc720e..afb41bda 100644 --- a/lib/facebook_ads/ad_objects/vehicle_offer.rb +++ b/lib/facebook_ads/ad_objects/vehicle_offer.rb @@ -26,6 +26,15 @@ module FacebookAds # pull request for this class. class VehicleOffer < AdObject + IMAGE_FETCH_STATUS = [ + "DIRECT_UPLOAD", + "FETCHED", + "FETCH_FAILED", + "NO_STATUS", + "OUTDATED", + "PARTIAL_FETCH", + ] + field :amount_currency, 'string' field :amount_percentage, 'double' @@ -44,6 +53,7 @@ class VehicleOffer < AdObject field :end_date, 'string' field :end_time, 'int' field :id, 'string' + field :image_fetch_status, { enum: -> { IMAGE_FETCH_STATUS }} field :images, { list: 'string' } field :make, 'string' field :model, 'string' @@ -64,5 +74,13 @@ class VehicleOffer < AdObject has_no_post has_no_delete + has_edge :augmented_realities_metadata do |edge| + edge.get + end + + has_edge :videos_metadata do |edge| + edge.get + end + end end diff --git a/lib/facebook_ads/ad_objects/whats_app_business_account.rb b/lib/facebook_ads/ad_objects/whats_app_business_account.rb index 8ff6b5cb..16aeddd8 100644 --- a/lib/facebook_ads/ad_objects/whats_app_business_account.rb +++ b/lib/facebook_ads/ad_objects/whats_app_business_account.rb @@ -31,6 +31,7 @@ class WhatsAppBusinessAccount < AdObject "MANAGE", "MANAGE_PHONE", "MANAGE_TEMPLATES", + "MESSAGING", "VIEW_COST", ] diff --git a/lib/facebook_ads/ad_objects/friend_list.rb b/lib/facebook_ads/ad_objects/whats_app_business_profile.rb similarity index 91% rename from lib/facebook_ads/ad_objects/friend_list.rb rename to lib/facebook_ads/ad_objects/whats_app_business_profile.rb index d3bffcc5..7dfb6814 100644 --- a/lib/facebook_ads/ad_objects/friend_list.rb +++ b/lib/facebook_ads/ad_objects/whats_app_business_profile.rb @@ -25,13 +25,11 @@ module FacebookAds # on github and we'll fix in our codegen framework. We'll not be able to accept # pull request for this class. - class FriendList < AdObject + class WhatsAppBusinessProfile < AdObject field :id, 'string' - field :list_type, 'string' - field :name, 'string' - field :owner, 'string' - has_no_post + field :name_verification, 'object' + field :whatsapp_business_api_data, 'object' has_no_delete end diff --git a/lib/facebook_ads/edge.rb b/lib/facebook_ads/edge.rb index d7afad8e..477ce8f2 100644 --- a/lib/facebook_ads/edge.rb +++ b/lib/facebook_ads/edge.rb @@ -53,6 +53,7 @@ def each def reload! @collection = Array.new self.has_next_page = true + self.next_page_cursor = nil end private @@ -95,7 +96,7 @@ def create(params) node.post_edge(name, graph_params.merge(params)) do |response| # TODO params check # TODO Add new object to collection? - + field_type = self.class.return_types[:post] obj = field_type.deserialize(response, node.session) diff --git a/lib/facebook_ads/version.rb b/lib/facebook_ads/version.rb index 7561f816..ded42bbc 100644 --- a/lib/facebook_ads/version.rb +++ b/lib/facebook_ads/version.rb @@ -19,6 +19,6 @@ # FB:AUTOGEN module FacebookAds - VERSION = '0.9.0.1' - API_VERSION = '9.0' + VERSION = '0.10.0.1' + API_VERSION = '10.0' end diff --git a/spec/lib/facebook_ads/ad_objects/server_side/event_spec.rb b/spec/lib/facebook_ads/ad_objects/server_side/event_spec.rb new file mode 100644 index 00000000..4e71d065 --- /dev/null +++ b/spec/lib/facebook_ads/ad_objects/server_side/event_spec.rb @@ -0,0 +1,92 @@ +# 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. + +RSpec.describe 'FacebookAds::ServerSide::Event' do + it 'the constructor works' do + event_name = 'event_name-0' + event_time = 1 + event_source_url = 'event_source_url-2' + opt_out = false + event_id = 'event_id-3' + user_data = FacebookAds::ServerSide::UserData.new(email: 'eg@test.com') + custom_data = FacebookAds::ServerSide::CustomData.new(order_id: 123) + data_processing_options = ['1', '2'] + data_processing_options_country = 1 + data_processing_options_state = 2 + action_source = 'website' + event = FacebookAds::ServerSide::Event.new( + event_name: event_name, + event_time: event_time, + event_source_url: event_source_url, + opt_out: opt_out, + event_id: event_id, + user_data: user_data, + custom_data: custom_data, + data_processing_options: data_processing_options, + data_processing_options_country: data_processing_options_country, + data_processing_options_state: data_processing_options_state, + action_source: action_source, + ) + expected_params = { + 'event_name' => event_name, + 'event_time' => event_time, + 'event_source_url' => event_source_url, + 'opt_out' => opt_out, + 'event_id' => event_id, + 'user_data' => user_data.normalize, + 'custom_data' => custom_data.normalize, + 'data_processing_options' => data_processing_options, + 'data_processing_options_country' => data_processing_options_country, + 'data_processing_options_state' => data_processing_options_state, + 'action_source' => action_source, + } + normalized_event = event.normalize + + expect(normalized_event).to eql(expected_params) + end + + it 'build initializes from a hash' do + params = { + 'event_name': 'event_name-0', + 'event_time': 1, + 'event_source_url': 'event_source_url-2', + 'opt_out': false, + 'event_id': 'event_id-3', + 'user_data': FacebookAds::ServerSide::UserData.new(email: 'eg@test.com'), + 'custom_data': FacebookAds::ServerSide::CustomData.new(order_id: 123), + 'data_processing_options': ['1', '2'], + 'data_processing_options_country': 1, + 'data_processing_options_state': 2, + 'action_source': 'website', + } + event = FacebookAds::ServerSide::Event.new + event.build(params) + + params.each do |k, v| + expect(event.send(k.to_sym)).to eql(v) + end + end + + it 'normalize validates the action_source' do + expect{ + FacebookAds::ServerSide::Event.new( + action_source: 'unsupported action source' + ).normalize + }.to raise_error(ArgumentError) + end +end diff --git a/spec/lib/facebook_ads/ad_objects/server_side/user_data_spec.rb b/spec/lib/facebook_ads/ad_objects/server_side/user_data_spec.rb index b550bf06..e7c8613f 100644 --- a/spec/lib/facebook_ads/ad_objects/server_side/user_data_spec.rb +++ b/spec/lib/facebook_ads/ad_objects/server_side/user_data_spec.rb @@ -18,65 +18,86 @@ RSpec.describe 'FacebookAds::ServerSide::UserData' do it 'normalizes fields' do - email = 'email-1' - phone = 'phone-2' - gender = 'gender-3' - date_of_birth = 'dob-4' - first_name = 'first-name-5' - last_name = 'last-name-6' - city = 'city-7' - country_code = 'country-code-8' - state = 'state-9' - zip_code = 'zip-code-10' - f5first = 'f5first-11' - lead_id = 'lead_id-112' - f5last = 'f5last-12' - fi = 'fi-13' - dobd = 'dobd-14' - dobm = 'dobm-15' - doby = 'doby-16' + attrs = { + email: 'email-1', + phone: 'phone-2', + gender: 'gender-3', + date_of_birth: 'dob-4', + first_name: 'first-name-5', + last_name: 'last-name-6', + city: 'city-7', + country_code: 'country-code-8', + state: 'state-9', + zip_code: 'zip-code-10', + external_id: 'external-id-100', + f5first: 'f5first-11', + lead_id: 'lead_id-112', + f5last: 'f5last-12', + fi: 'fi-13', + dobd: 'dobd-14', + dobm: 'dobm-15', + doby: 'doby-16', + } allow(FacebookAds::ServerSide::Util).to receive(:normalize) do |input, field_type| "#{field_type}_#{input}-normalized" end - user_data = FacebookAds::ServerSide::UserData.new( - email: email, - phone: phone, - gender: gender, - date_of_birth: date_of_birth, - last_name: last_name, - first_name: first_name, - city: city, - country_code: country_code, - state: state, - zip_code: zip_code, - lead_id: lead_id, - f5first: f5first, - f5last: f5last, - fi: fi, - dobd: dobd, - dobm: dobm, - doby: doby, + user_data = FacebookAds::ServerSide::UserData.new(attrs) + normalized = user_data.normalize + + expect(normalized).to eq( + 'em' => ["em_#{attrs[:email]}-normalized"], + 'ph' => ["ph_#{attrs[:phone]}-normalized"], + 'ge' => ["ge_#{attrs[:gender]}-normalized"], + 'db' => ["db_#{attrs[:date_of_birth]}-normalized"], + 'ln' => ["ln_#{attrs[:last_name]}-normalized"], + 'fn' => ["fn_#{attrs[:first_name]}-normalized"], + 'ct' => ["ct_#{attrs[:city]}-normalized"], + 'country' => ["country_#{attrs[:country_code]}-normalized"], + 'st' => ["st_#{attrs[:state]}-normalized"], + 'zp' => ["zp_#{attrs[:zip_code]}-normalized"], + 'external_id' => [attrs[:external_id]], + 'lead_id' => attrs[:lead_id], + 'f5first' => "f5first_#{attrs[:f5first]}-normalized", + 'f5last' => "f5last_#{attrs[:f5last]}-normalized", + 'fi' => "fi_#{attrs[:fi]}-normalized", + 'dobd' => "dobd_#{attrs[:dobd]}-normalized", + 'dobm' => "dobm_#{attrs[:dobm]}-normalized", + 'doby' => "doby_#{attrs[:doby]}-normalized", ) + end + + it 'normalizes field arrays' do + attrs = { + emails: ['email-1', 'email-10'], + phones: ['phone-2', 'phone-20'], + genders: ['gender-3', 'gender-30'], + dates_of_birth: ['dob-4', 'dob-40'], + first_names: ['first-name-5', 'first-name-50'], + last_names: ['last-name-6', 'last-name-60'], + cities: ['city-7', 'city-70'], + country_codes: ['country-code-8', 'country-code-80'], + states: ['state-9', 'state-90'], + zip_codes: ['zip-code-10', 'zip-code-100'], + external_ids: ['external-id-11', 'external-id-110'], + } + allow(FacebookAds::ServerSide::Util).to receive(:normalize_array) do |input, field_type| + input + [field_type] + end + user_data = FacebookAds::ServerSide::UserData.new(attrs) normalized = user_data.normalize expect(normalized).to eq( - 'em' => "em_#{email}-normalized", - 'ph' => "ph_#{phone}-normalized", - 'ge' => "ge_#{gender}-normalized", - 'db' => "db_#{date_of_birth}-normalized", - 'ln' => "ln_#{last_name}-normalized", - 'fn' => "fn_#{first_name}-normalized", - 'ct' => "ct_#{city}-normalized", - 'country' => "country_#{country_code}-normalized", - 'st' => "st_#{state}-normalized", - 'zp' => "zp_#{zip_code}-normalized", - 'lead_id' => lead_id, - 'f5first' => "f5first_#{f5first}-normalized", - 'f5last' => "f5last_#{f5last}-normalized", - 'fi' => "fi_#{fi}-normalized", - 'dobd' => "dobd_#{dobd}-normalized", - 'dobm' => "dobm_#{dobm}-normalized", - 'doby' => "doby_#{doby}-normalized", + 'em' => attrs[:emails] + ['em'], + 'ph' => attrs[:phones] + ['ph'], + 'ge' => attrs[:genders] + ['ge'], + 'db' => attrs[:dates_of_birth] + ['db'], + 'ln' => attrs[:last_names] + ['ln'], + 'fn' => attrs[:first_names] + ['fn'], + 'ct' => attrs[:cities] + ['ct'], + 'country' => attrs[:country_codes] + ['country'], + 'st' => attrs[:states] + ['st'], + 'zp' => attrs[:zip_codes] + ['zp'], + 'external_id' => attrs[:external_ids] ) end @@ -175,4 +196,120 @@ expect(user_data1).to_not eq(user_data2) expect(user_data1.hash).to_not eq(user_data2.hash) end + + it 'equals works with value arrays' do + attrs = { + emails: ['email-1', 'email-10'], + phones: ['phone-2', 'phone-20'], + genders: ['gender-3', 'gender-30'], + dates_of_birth: ['dob-4', 'dob-40'], + last_names: ['first-name-5', 'first-name-50'], + first_names: ['last-name-6', 'last-name-60'], + cities: ['city-7', 'city-70'], + country_codes: ['country-code-8', 'country-code-80'], + states: ['state-9', 'state-90'], + zip_codes: ['zip-code-10', 'zip-code-100'], + external_ids: ['external-id-11', 'external-id-110'], + } + user_data1 = FacebookAds::ServerSide::UserData.new() + user_data2 = FacebookAds::ServerSide::UserData.new() + expect(user_data1).to eq(user_data2) + expect(user_data1.hash).to eq(user_data2.hash) + + user_data1 = FacebookAds::ServerSide::UserData.new(attrs) + user_data2 = FacebookAds::ServerSide::UserData.new(attrs) + expect(user_data1).to eq(user_data2) + expect(user_data1.hash).to eq(user_data2.hash) + end + + it 'normalize returns an empty hash when incorrect value arrays are used' do + user_data = FacebookAds::ServerSide::UserData.new( + emails: [1, 2], + phones: [1, 2], + genders: [1, 2], + dates_of_birth: [1, 2], + first_names: [1, 2], + last_names: [1, 2], + cities: [1, 2], + country_codes: [1, 2], + states: [1, 2], + zip_codes: [1, 2], + ) + + expect(user_data.normalize).to eq({}) + end + + it 'setters and getters work' do + user_data = FacebookAds::ServerSide::UserData.new() + user_data.email = 'test@example.com' + expect(user_data.email).to eq('test@example.com') + + user_data.zip_codes = ['10001', '20002'] + expect(user_data.zip_codes).to eq(['10001', '20002']) + end + + it 'build from attributes works' do + user_data = FacebookAds::ServerSide::UserData.new() + attrs = { + state: 'ca', + dates_of_birth: ['19950101', '19970203'], + } + user_data.build(attrs) + + expect(user_data.state).to eq(attrs[:state]) + expect(user_data.dates_of_birth).to eq(attrs[:dates_of_birth]) + end + + it 'build from attributes arrays take assignment precedence' do + user_data = FacebookAds::ServerSide::UserData.new() + attrs = { + city: 'seattle', + cities: ['menlopark', 'paloalto'], + } + user_data.build(attrs) + + expect(user_data.city).to eq(attrs[:cities][0]) + expect(user_data.cities).to eq(attrs[:cities]) + end + + it 'constructor fails validation if both single and multi-values are specified' do + pairs = [ + [:email, :emails], + [:phone, :phones], + [:gender, :genders], + [:date_of_birth, :dates_of_birth], + [:first_name, :first_names], + [:last_name, :last_names], + [:city, :cities], + [:country_code, :country_codes], + [:state, :states], + [:zip_code, :zip_codes], + [:external_id, :external_ids], + ] + + pairs.each do |singular, plural| + expect{ + FacebookAds::ServerSide::UserData.new( + singular => 'test1', + plural => ['test2'], + ) + }.to raise_error(ArgumentError, /.*#{plural}.*#{singular}.*/) + end + end + + it 'constructor works when a single value is used' do + user_data = FacebookAds::ServerSide::UserData.new( + email: 'email-1' + ) + + expect(user_data.emails).to eq(['email-1']) + end + + it 'constructor works when a multi-value is used' do + user_data = FacebookAds::ServerSide::UserData.new( + phones: ['phone-2'] + ) + + expect(user_data.phones).to eq(['phone-2']) + end end diff --git a/spec/lib/facebook_ads/ad_objects/server_side/util_spec.rb b/spec/lib/facebook_ads/ad_objects/server_side/util_spec.rb index 285bd375..2356ebdb 100644 --- a/spec/lib/facebook_ads/ad_objects/server_side/util_spec.rb +++ b/spec/lib/facebook_ads/ad_objects/server_side/util_spec.rb @@ -32,6 +32,8 @@ it 'normalizes email' do expect(FacebookAds::ServerSide::Util.normalize('foo@test.COM', 'em')).to eq(FacebookAds::ServerSide::Util.sha256Hash('foo@test.com')) + + expect{FacebookAds::ServerSide::Util.normalize('test', 'em')}.to raise_error(ArgumentError) end it 'normalizes gender' do @@ -117,6 +119,29 @@ expect(FacebookAds::ServerSide::Util.normalize('CURBSIDE', 'delivery_category')).to eq('curbside') expect{FacebookAds::ServerSide::Util.normalize('INVALID', 'delivery_category')}.to raise_error(ArgumentError) end + + it 'normalize_array normalizes values' do + emails = ['test1@example.com', 'test2@example.com'] + + expect(FacebookAds::ServerSide::Util.normalize_array(emails, 'em')).to eq(emails.map{|x| FacebookAds::ServerSide::Util.sha256Hash(x)}) + end + + it 'normalize_array deduplicates arrays' do + cities1 = ['portland', 'bend', 'portland'] + cities2 = [' portland', 'bend', 'portland '] + expected_cities = ['bend', 'portland'].map{|x| FacebookAds::ServerSide::Util.sha256Hash(x)} + + expect(FacebookAds::ServerSide::Util.normalize_array(cities1, 'ct')).to match_array(expected_cities) + expect(FacebookAds::ServerSide::Util.normalize_array(cities2, 'ct')).to match_array(expected_cities) + end + + it 'normalizes_array returns nil for incorrect inputs' do + expect(FacebookAds::ServerSide::Util.normalize_array(nil, 'em')).to be_nil + expect(FacebookAds::ServerSide::Util.normalize_array([], 'em')).to be_nil + expect(FacebookAds::ServerSide::Util.normalize_array({}, 'em')).to be_nil + expect(FacebookAds::ServerSide::Util.normalize_array({'a' => 'test'}, 'em')).to be_nil + expect(FacebookAds::ServerSide::Util.normalize_array(['a', 5], 'em')).to be_nil + end end context 'sha256Hash' do