facebookads 0.0.1 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.txt +17 -0
- data/README.md +222 -0
- data/lib/facebook_ads/ad_object.rb +177 -0
- data/lib/facebook_ads/ad_objects/ad.rb +215 -0
- data/lib/facebook_ads/ad_objects/ad_account.rb +665 -0
- data/lib/facebook_ads/ad_objects/ad_account_roas.rb +97 -0
- data/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb +136 -0
- data/lib/facebook_ads/ad_objects/ad_account_user.rb +39 -0
- data/lib/facebook_ads/ad_objects/ad_activity.rb +123 -0
- data/lib/facebook_ads/ad_objects/ad_async_request.rb +66 -0
- data/lib/facebook_ads/ad_objects/ad_async_request_set.rb +68 -0
- data/lib/facebook_ads/ad_objects/ad_async_request_set_notification_result.rb +38 -0
- data/lib/facebook_ads/ad_objects/ad_creative.rb +163 -0
- data/lib/facebook_ads/ad_objects/ad_creative_link_data.rb +62 -0
- data/lib/facebook_ads/ad_objects/ad_creative_link_data_app_link_spec.rb +40 -0
- data/lib/facebook_ads/ad_objects/ad_creative_link_data_call_to_action.rb +75 -0
- data/lib/facebook_ads/ad_objects/ad_creative_link_data_call_to_action_value.rb +46 -0
- data/lib/facebook_ads/ad_objects/ad_creative_link_data_child_attachment.rb +47 -0
- data/lib/facebook_ads/ad_objects/ad_creative_object_story_spec.rb +43 -0
- data/lib/facebook_ads/ad_objects/ad_creative_offer_data.rb +44 -0
- data/lib/facebook_ads/ad_objects/ad_creative_photo_data.rb +42 -0
- data/lib/facebook_ads/ad_objects/ad_creative_place_data.rb +41 -0
- data/lib/facebook_ads/ad_objects/ad_creative_text_data.rb +37 -0
- data/lib/facebook_ads/ad_objects/ad_creative_video_data.rb +48 -0
- data/lib/facebook_ads/ad_objects/ad_image.rb +58 -0
- data/lib/facebook_ads/ad_objects/ad_keyword_stats.rb +55 -0
- data/lib/facebook_ads/ad_objects/ad_label.rb +57 -0
- data/lib/facebook_ads/ad_objects/ad_place_page_set.rb +44 -0
- data/lib/facebook_ads/ad_objects/ad_preview.rb +54 -0
- data/lib/facebook_ads/ad_objects/ad_promoted_object.rb +64 -0
- data/lib/facebook_ads/ad_objects/ad_recommendation.rb +55 -0
- data/lib/facebook_ads/ad_objects/ad_recommendation_data.rb +37 -0
- data/lib/facebook_ads/ad_objects/ad_report_run.rb +70 -0
- data/lib/facebook_ads/ad_objects/ad_set.rb +267 -0
- data/lib/facebook_ads/ad_objects/ad_study.rb +69 -0
- data/lib/facebook_ads/ad_objects/ad_study_cell.rb +39 -0
- data/lib/facebook_ads/ad_objects/ad_study_objective.rb +59 -0
- data/lib/facebook_ads/ad_objects/ad_video.rb +25 -0
- data/lib/facebook_ads/ad_objects/adgroup_placement_specific_review_feedback.rb +43 -0
- data/lib/facebook_ads/ad_objects/adgroup_relevance_score.rb +40 -0
- data/lib/facebook_ads/ad_objects/adgroup_review_feedback.rb +38 -0
- data/lib/facebook_ads/ad_objects/ads_action_stats.rb +53 -0
- data/lib/facebook_ads/ad_objects/ads_data_partner.rb +37 -0
- data/lib/facebook_ads/ad_objects/ads_image_crops.rb +42 -0
- data/lib/facebook_ads/ad_objects/ads_insights.rb +225 -0
- data/lib/facebook_ads/ad_objects/ads_pixel.rb +64 -0
- data/lib/facebook_ads/ad_objects/ads_pixel_stats.rb +39 -0
- data/lib/facebook_ads/ad_objects/ads_pixel_stats_result.rb +50 -0
- data/lib/facebook_ads/ad_objects/agency_client_declaration.rb +48 -0
- data/lib/facebook_ads/ad_objects/android_app_link.rb +40 -0
- data/lib/facebook_ads/ad_objects/app_links.rb +43 -0
- data/lib/facebook_ads/ad_objects/broad_targeting_categories.rb +46 -0
- data/lib/facebook_ads/ad_objects/business.rb +242 -0
- data/lib/facebook_ads/ad_objects/business_ad_account_request.rb +37 -0
- data/lib/facebook_ads/ad_objects/business_page_request.rb +37 -0
- data/lib/facebook_ads/ad_objects/campaign.rb +211 -0
- data/lib/facebook_ads/ad_objects/conversion_action_query.rb +63 -0
- data/lib/facebook_ads/ad_objects/custom_audience.rb +166 -0
- data/lib/facebook_ads/ad_objects/custom_audience_ad_account.rb +36 -0
- data/lib/facebook_ads/ad_objects/custom_audience_data_source.rb +94 -0
- data/lib/facebook_ads/ad_objects/custom_audience_permission.rb +41 -0
- data/lib/facebook_ads/ad_objects/custom_audience_prefill_state.rb +39 -0
- data/lib/facebook_ads/ad_objects/custom_audience_session.rb +44 -0
- data/lib/facebook_ads/ad_objects/custom_audience_status.rb +38 -0
- data/lib/facebook_ads/ad_objects/custom_audiences_tos.rb +38 -0
- data/lib/facebook_ads/ad_objects/custom_conversion.rb +78 -0
- data/lib/facebook_ads/ad_objects/custom_conversion_stats_result.rb +50 -0
- data/lib/facebook_ads/ad_objects/day_part.rb +40 -0
- data/lib/facebook_ads/ad_objects/delivery_check.rb +40 -0
- data/lib/facebook_ads/ad_objects/delivery_check_extra_info.rb +39 -0
- data/lib/facebook_ads/ad_objects/delivery_estimate.rb +41 -0
- data/lib/facebook_ads/ad_objects/domain.rb +37 -0
- data/lib/facebook_ads/ad_objects/event.rb +74 -0
- data/lib/facebook_ads/ad_objects/event_source_group.rb +43 -0
- data/lib/facebook_ads/ad_objects/external_event_source.rb +38 -0
- data/lib/facebook_ads/ad_objects/flexible_targeting.rb +64 -0
- data/lib/facebook_ads/ad_objects/funding_source_details.rb +39 -0
- data/lib/facebook_ads/ad_objects/funding_source_details_coupon.rb +40 -0
- data/lib/facebook_ads/ad_objects/helpers/custom_audience_helpers.rb +170 -0
- data/lib/facebook_ads/ad_objects/hotel.rb +61 -0
- data/lib/facebook_ads/ad_objects/hotel_room.rb +44 -0
- data/lib/facebook_ads/ad_objects/id_name.rb +37 -0
- data/lib/facebook_ads/ad_objects/ios_app_link.rb +39 -0
- data/lib/facebook_ads/ad_objects/lead.rb +47 -0
- data/lib/facebook_ads/ad_objects/lead_gen_qualifier.rb +40 -0
- data/lib/facebook_ads/ad_objects/lead_gen_question.rb +40 -0
- data/lib/facebook_ads/ad_objects/lead_gen_question_option.rb +38 -0
- data/lib/facebook_ads/ad_objects/leadgen_form.rb +70 -0
- data/lib/facebook_ads/ad_objects/legacy_business_ad_account_request.rb +38 -0
- data/lib/facebook_ads/ad_objects/lookalike_spec.rb +43 -0
- data/lib/facebook_ads/ad_objects/minimum_budget.rb +41 -0
- data/lib/facebook_ads/ad_objects/offsite_pixel.rb +57 -0
- data/lib/facebook_ads/ad_objects/outcome_prediction_point.rb +40 -0
- data/lib/facebook_ads/ad_objects/partner_category.rb +51 -0
- data/lib/facebook_ads/ad_objects/product_catalog.rb +257 -0
- data/lib/facebook_ads/ad_objects/product_catalog_hotel_rooms_batch.rb +50 -0
- data/lib/facebook_ads/ad_objects/product_catalog_image_settings.rb +38 -0
- data/lib/facebook_ads/ad_objects/product_catalog_image_settings_operation.rb +37 -0
- data/lib/facebook_ads/ad_objects/product_catalog_pricing_variables_batch.rb +50 -0
- data/lib/facebook_ads/ad_objects/product_feed.rb +88 -0
- data/lib/facebook_ads/ad_objects/product_feed_schedule.rb +61 -0
- data/lib/facebook_ads/ad_objects/product_feed_upload.rb +48 -0
- data/lib/facebook_ads/ad_objects/product_feed_upload_error.rb +49 -0
- data/lib/facebook_ads/ad_objects/product_feed_upload_error_sample.rb +37 -0
- data/lib/facebook_ads/ad_objects/product_group.rb +98 -0
- data/lib/facebook_ads/ad_objects/product_item.rb +147 -0
- data/lib/facebook_ads/ad_objects/product_item_commerce_insights.rb +39 -0
- data/lib/facebook_ads/ad_objects/product_set.rb +49 -0
- data/lib/facebook_ads/ad_objects/product_variant.rb +39 -0
- data/lib/facebook_ads/ad_objects/profile_picture_source.rb +52 -0
- data/lib/facebook_ads/ad_objects/rate_card.rb +39 -0
- data/lib/facebook_ads/ad_objects/reach_estimate.rb +60 -0
- data/lib/facebook_ads/ad_objects/reach_frequency_prediction.rb +89 -0
- data/lib/facebook_ads/ad_objects/reach_frequency_spec.rb +42 -0
- data/lib/facebook_ads/ad_objects/rev_share_policy.rb +38 -0
- data/lib/facebook_ads/ad_objects/roas_cohorts_data.rb +41 -0
- data/lib/facebook_ads/ad_objects/roas_cohorts_per_cohort_interval_unit.rb +38 -0
- data/lib/facebook_ads/ad_objects/targeting.rb +133 -0
- data/lib/facebook_ads/ad_objects/targeting_dynamic_rule.rb +44 -0
- data/lib/facebook_ads/ad_objects/targeting_geo_location.rb +47 -0
- data/lib/facebook_ads/ad_objects/targeting_geo_location_city.rb +43 -0
- data/lib/facebook_ads/ad_objects/targeting_geo_location_custom_location.rb +50 -0
- data/lib/facebook_ads/ad_objects/targeting_geo_location_electoral_district.rb +40 -0
- data/lib/facebook_ads/ad_objects/targeting_geo_location_market.rb +40 -0
- data/lib/facebook_ads/ad_objects/targeting_geo_location_place.rb +45 -0
- data/lib/facebook_ads/ad_objects/targeting_geo_location_political_district.rb +40 -0
- data/lib/facebook_ads/ad_objects/targeting_geo_location_region.rb +39 -0
- data/lib/facebook_ads/ad_objects/targeting_geo_location_zip.rb +41 -0
- data/lib/facebook_ads/ad_objects/targeting_product_audience_spec.rb +39 -0
- data/lib/facebook_ads/ad_objects/targeting_product_audience_sub_spec.rb +38 -0
- data/lib/facebook_ads/ad_objects/targeting_sentence_line.rb +38 -0
- data/lib/facebook_ads/ad_objects/transaction.rb +56 -0
- data/lib/facebook_ads/ad_objects/transaction_currency_amount.rb +39 -0
- data/lib/facebook_ads/ad_objects/user.rb +127 -0
- data/lib/facebook_ads/ad_objects/user_lead_gen_disclaimer_response.rb +38 -0
- data/lib/facebook_ads/ad_objects/user_lead_gen_field_data.rb +38 -0
- data/lib/facebook_ads/ad_objects/video_thumbnail.rb +42 -0
- data/lib/facebook_ads/ad_objects/web_app_link.rb +38 -0
- data/lib/facebook_ads/ad_objects/windows_app_link.rb +40 -0
- data/lib/facebook_ads/ad_objects/windows_phone_app_link.rb +39 -0
- data/lib/facebook_ads/api_request.rb +123 -0
- data/lib/facebook_ads/api_response.rb +47 -0
- data/lib/facebook_ads/batch_api/batch.rb +86 -0
- data/lib/facebook_ads/batch_api/batch_proxy.rb +67 -0
- data/lib/facebook_ads/config.rb +43 -0
- data/lib/facebook_ads/edge.rb +184 -0
- data/lib/facebook_ads/errors.rb +55 -0
- data/lib/facebook_ads/field_types/ad_object.rb +37 -0
- data/lib/facebook_ads/field_types/base.rb +33 -0
- data/lib/facebook_ads/field_types/boolean.rb +25 -0
- data/lib/facebook_ads/field_types/datetime.rb +47 -0
- data/lib/facebook_ads/field_types/double.rb +29 -0
- data/lib/facebook_ads/field_types/enum.rb +31 -0
- data/lib/facebook_ads/field_types/integer.rb +33 -0
- data/lib/facebook_ads/field_types/list.rb +57 -0
- data/lib/facebook_ads/field_types/object.rb +33 -0
- data/lib/facebook_ads/field_types/string_type.rb +34 -0
- data/lib/facebook_ads/field_types/upload_file.rb +121 -0
- data/lib/facebook_ads/field_types.rb +65 -0
- data/lib/facebook_ads/fields.rb +66 -0
- data/lib/facebook_ads/helpers/edge_helpers.rb +57 -0
- data/lib/facebook_ads/helpers/node_helpers.rb +80 -0
- data/lib/facebook_ads/helpers/shortcuts.rb +34 -0
- data/lib/facebook_ads/param_set.rb +74 -0
- data/lib/facebook_ads/ruby2patch.rb +27 -0
- data/lib/facebook_ads/session.rb +99 -0
- data/lib/facebook_ads/utils/utils.rb +29 -0
- data/lib/facebook_ads/version.rb +24 -0
- data/lib/facebook_ads/videos/video_io.rb +25 -0
- data/lib/facebook_ads/videos/video_request.rb +42 -0
- data/lib/facebook_ads.rb +72 -0
- metadata +337 -13
- data/lib/facebookads.rb +0 -5
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
4
|
+
# copy, modify, and distribute this software in source code or binary form for use
|
5
|
+
# in connection with the web services and APIs provided by Facebook.
|
6
|
+
#
|
7
|
+
# As with any software that integrates with the Facebook platform, your use of
|
8
|
+
# this software is subject to the Facebook Platform Policy
|
9
|
+
# [http://developers.facebook.com/policy/]. This copyright notice shall be
|
10
|
+
# included in all copies or substantial portions of the software.
|
11
|
+
#
|
12
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
14
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
15
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
16
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
17
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
|
+
|
19
|
+
# FB:AUTOGEN
|
20
|
+
|
21
|
+
module FacebookAds
|
22
|
+
# This class is auto-genereated.
|
23
|
+
|
24
|
+
# For any issues or feature requests related to this class, please let us know
|
25
|
+
# on github and we'll fix in our codegen framework. We'll not be able to accept
|
26
|
+
# pull request for this class.
|
27
|
+
|
28
|
+
class EventSourceGroup < AdObject
|
29
|
+
|
30
|
+
field :business, 'Business'
|
31
|
+
field :event_sources, { list: 'ExternalEventSource' }
|
32
|
+
field :id, 'string'
|
33
|
+
field :name, 'string'
|
34
|
+
has_no_delete
|
35
|
+
|
36
|
+
has_edge :shared_accounts do |edge|
|
37
|
+
edge.post 'EventSourceGroup' do |api|
|
38
|
+
api.has_param :accounts, { list: 'string' }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
4
|
+
# copy, modify, and distribute this software in source code or binary form for use
|
5
|
+
# in connection with the web services and APIs provided by Facebook.
|
6
|
+
#
|
7
|
+
# As with any software that integrates with the Facebook platform, your use of
|
8
|
+
# this software is subject to the Facebook Platform Policy
|
9
|
+
# [http://developers.facebook.com/policy/]. This copyright notice shall be
|
10
|
+
# included in all copies or substantial portions of the software.
|
11
|
+
#
|
12
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
14
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
15
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
16
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
17
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
|
+
|
19
|
+
# FB:AUTOGEN
|
20
|
+
|
21
|
+
module FacebookAds
|
22
|
+
# This class is auto-genereated.
|
23
|
+
|
24
|
+
# For any issues or feature requests related to this class, please let us know
|
25
|
+
# on github and we'll fix in our codegen framework. We'll not be able to accept
|
26
|
+
# pull request for this class.
|
27
|
+
|
28
|
+
class ExternalEventSource < AdObject
|
29
|
+
|
30
|
+
field :id, 'string'
|
31
|
+
field :name, 'string'
|
32
|
+
field :source_type, 'string'
|
33
|
+
field :external_event_sources, { list: 'string' }
|
34
|
+
has_no_post
|
35
|
+
has_no_delete
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
4
|
+
# copy, modify, and distribute this software in source code or binary form for use
|
5
|
+
# in connection with the web services and APIs provided by Facebook.
|
6
|
+
#
|
7
|
+
# As with any software that integrates with the Facebook platform, your use of
|
8
|
+
# this software is subject to the Facebook Platform Policy
|
9
|
+
# [http://developers.facebook.com/policy/]. This copyright notice shall be
|
10
|
+
# included in all copies or substantial portions of the software.
|
11
|
+
#
|
12
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
14
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
15
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
16
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
17
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
|
+
|
19
|
+
# FB:AUTOGEN
|
20
|
+
|
21
|
+
module FacebookAds
|
22
|
+
# This class is auto-genereated.
|
23
|
+
|
24
|
+
# For any issues or feature requests related to this class, please let us know
|
25
|
+
# on github and we'll fix in our codegen framework. We'll not be able to accept
|
26
|
+
# pull request for this class.
|
27
|
+
|
28
|
+
class FlexibleTargeting < AdObject
|
29
|
+
|
30
|
+
field :behaviors, { list: 'IDName' }
|
31
|
+
field :college_years, { list: 'int' }
|
32
|
+
field :connections, { list: 'IDName' }
|
33
|
+
field :custom_audiences, { list: 'IDName' }
|
34
|
+
field :education_majors, { list: 'IDName' }
|
35
|
+
field :education_schools, { list: 'IDName' }
|
36
|
+
field :education_statuses, { list: 'int' }
|
37
|
+
field :ethnic_affinity, { list: 'IDName' }
|
38
|
+
field :family_statuses, { list: 'IDName' }
|
39
|
+
field :friends_of_connections, { list: 'IDName' }
|
40
|
+
field :generation, { list: 'IDName' }
|
41
|
+
field :home_ownership, { list: 'IDName' }
|
42
|
+
field :home_type, { list: 'IDName' }
|
43
|
+
field :home_value, { list: 'IDName' }
|
44
|
+
field :household_composition, { list: 'IDName' }
|
45
|
+
field :income, { list: 'IDName' }
|
46
|
+
field :industries, { list: 'IDName' }
|
47
|
+
field :interested_in, { list: 'int' }
|
48
|
+
field :interests, { list: 'IDName' }
|
49
|
+
field :life_events, { list: 'IDName' }
|
50
|
+
field :moms, { list: 'IDName' }
|
51
|
+
field :net_worth, { list: 'IDName' }
|
52
|
+
field :office_type, { list: 'IDName' }
|
53
|
+
field :politics, { list: 'IDName' }
|
54
|
+
field :relationship_statuses, { list: 'int' }
|
55
|
+
field :user_adclusters, { list: 'IDName' }
|
56
|
+
field :work_employers, { list: 'IDName' }
|
57
|
+
field :work_positions, { list: 'IDName' }
|
58
|
+
has_no_id
|
59
|
+
has_no_get
|
60
|
+
has_no_post
|
61
|
+
has_no_delete
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
4
|
+
# copy, modify, and distribute this software in source code or binary form for use
|
5
|
+
# in connection with the web services and APIs provided by Facebook.
|
6
|
+
#
|
7
|
+
# As with any software that integrates with the Facebook platform, your use of
|
8
|
+
# this software is subject to the Facebook Platform Policy
|
9
|
+
# [http://developers.facebook.com/policy/]. This copyright notice shall be
|
10
|
+
# included in all copies or substantial portions of the software.
|
11
|
+
#
|
12
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
14
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
15
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
16
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
17
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
|
+
|
19
|
+
# FB:AUTOGEN
|
20
|
+
|
21
|
+
module FacebookAds
|
22
|
+
# This class is auto-genereated.
|
23
|
+
|
24
|
+
# For any issues or feature requests related to this class, please let us know
|
25
|
+
# on github and we'll fix in our codegen framework. We'll not be able to accept
|
26
|
+
# pull request for this class.
|
27
|
+
|
28
|
+
class FundingSourceDetails < AdObject
|
29
|
+
|
30
|
+
field :coupon, 'FundingSourceDetailsCoupon'
|
31
|
+
field :display_string, 'string'
|
32
|
+
field :id, 'string'
|
33
|
+
field :type, 'int'
|
34
|
+
has_no_get
|
35
|
+
has_no_post
|
36
|
+
has_no_delete
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
4
|
+
# copy, modify, and distribute this software in source code or binary form for use
|
5
|
+
# in connection with the web services and APIs provided by Facebook.
|
6
|
+
#
|
7
|
+
# As with any software that integrates with the Facebook platform, your use of
|
8
|
+
# this software is subject to the Facebook Platform Policy
|
9
|
+
# [http://developers.facebook.com/policy/]. This copyright notice shall be
|
10
|
+
# included in all copies or substantial portions of the software.
|
11
|
+
#
|
12
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
14
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
15
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
16
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
17
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
|
+
|
19
|
+
# FB:AUTOGEN
|
20
|
+
|
21
|
+
module FacebookAds
|
22
|
+
# This class is auto-genereated.
|
23
|
+
|
24
|
+
# For any issues or feature requests related to this class, please let us know
|
25
|
+
# on github and we'll fix in our codegen framework. We'll not be able to accept
|
26
|
+
# pull request for this class.
|
27
|
+
|
28
|
+
class FundingSourceDetailsCoupon < AdObject
|
29
|
+
|
30
|
+
field :amount, 'int'
|
31
|
+
field :currency, 'string'
|
32
|
+
field :display_amount, 'string'
|
33
|
+
field :expiration, 'datetime'
|
34
|
+
has_no_id
|
35
|
+
has_no_get
|
36
|
+
has_no_post
|
37
|
+
has_no_delete
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,170 @@
|
|
1
|
+
# Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
4
|
+
# copy, modify, and distribute this software in source code or binary form for use
|
5
|
+
# in connection with the web services and APIs provided by Facebook.
|
6
|
+
#
|
7
|
+
# As with any software that integrates with the Facebook platform, your use of
|
8
|
+
# this software is subject to the Facebook Platform Policy
|
9
|
+
# [http://developers.facebook.com/policy/]. This copyright notice shall be
|
10
|
+
# included in all copies or substantial portions of the software.
|
11
|
+
#
|
12
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
14
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
15
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
16
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
17
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
|
+
|
19
|
+
require 'digest'
|
20
|
+
|
21
|
+
module FacebookAds
|
22
|
+
module CustomAudienceHelpers
|
23
|
+
SCHEMAS = %w{
|
24
|
+
UID
|
25
|
+
EMAIL_SHA256
|
26
|
+
PHONE_SHA256
|
27
|
+
MOBILE_ADVERTISER_ID
|
28
|
+
}
|
29
|
+
|
30
|
+
MULTIKEY_SCHEMAS = %w{
|
31
|
+
EXTERN_ID
|
32
|
+
EMAIL
|
33
|
+
PHONE
|
34
|
+
GEN
|
35
|
+
DOBY
|
36
|
+
DOBM
|
37
|
+
DOBD
|
38
|
+
LN
|
39
|
+
FN
|
40
|
+
FI
|
41
|
+
CT
|
42
|
+
ST
|
43
|
+
ZIP
|
44
|
+
MADID
|
45
|
+
COUNTRY
|
46
|
+
}
|
47
|
+
|
48
|
+
SCHEMAS_WITHOUT_HASH = %w{
|
49
|
+
EXTERN_ID
|
50
|
+
MOBILE_ADVERTISER_ID
|
51
|
+
}
|
52
|
+
|
53
|
+
def add_user(data, schema, options = {})
|
54
|
+
self.users.create(prepare_params(data, schema, options))
|
55
|
+
end
|
56
|
+
|
57
|
+
def remove_user(data, schema, options = {})
|
58
|
+
self.users.destroy(prepare_params(data, schema, options))
|
59
|
+
end
|
60
|
+
|
61
|
+
def prepare_params(data,
|
62
|
+
schema,
|
63
|
+
app_ids: nil,
|
64
|
+
page_ids: nil,
|
65
|
+
pre_hashed: false,
|
66
|
+
namespace: nil,
|
67
|
+
session: nil,
|
68
|
+
data_source: nil)
|
69
|
+
|
70
|
+
unless schema.is_a?(Array) || schema.split(',').length > 1
|
71
|
+
# single key
|
72
|
+
schema = schema.upcase
|
73
|
+
unless is_valid_single_key?(schema) || is_combinational_key?(schema)
|
74
|
+
raise InvalidParameterError, "#{schema} is not a valid schema"
|
75
|
+
end
|
76
|
+
|
77
|
+
data = pre_hashed ? data : data.map { |entry| generate_hash(entry, schema)}
|
78
|
+
is_raw = !is_combinational_key?(schema)
|
79
|
+
else
|
80
|
+
# multi key
|
81
|
+
schema = schema.split(',') unless schema.is_a?(Array)
|
82
|
+
|
83
|
+
data = data.map do |row|
|
84
|
+
raise 'Schema size and data size mismatch' if row.length != schema.length
|
85
|
+
|
86
|
+
row.each_with_index.map do |val, idx|
|
87
|
+
pre_hashed ? val : generate_hash(val, schema[idx])
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
is_raw = !(schema.map { |s| is_combinational_key?(s) }.any?)
|
92
|
+
end
|
93
|
+
|
94
|
+
{
|
95
|
+
payload: {
|
96
|
+
schema: schema,
|
97
|
+
data: data,
|
98
|
+
is_raw: is_raw,
|
99
|
+
app_ids: app_ids,
|
100
|
+
page_ids: page_ids,
|
101
|
+
data_source: data_source,
|
102
|
+
}.compact,
|
103
|
+
namespace: namespace,
|
104
|
+
session: session,
|
105
|
+
}.compact
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
def is_valid_single_key?(schema)
|
110
|
+
SCHEMAS.include?(schema)
|
111
|
+
end
|
112
|
+
|
113
|
+
def is_raw_schema?(schemas)
|
114
|
+
(schemas - MULTIKEY_SCHEMAS).empty?
|
115
|
+
end
|
116
|
+
|
117
|
+
def generate_hash(data, schema)
|
118
|
+
SCHEMAS_WITHOUT_HASH.include?(schema) ? normalize(data, schema) : hash_sha256(normalize(data, schema))
|
119
|
+
end
|
120
|
+
|
121
|
+
def is_combinational_key?(schema)
|
122
|
+
schema_parts = schema.split('_').map(&:upcase)
|
123
|
+
return false if schema == 'EXTERN_ID' || schema_parts.count <= 1
|
124
|
+
# EXTERN_ID will be safe here since it's can be used as combination key
|
125
|
+
|
126
|
+
(schema_parts - MULTIKEY_SCHEMAS).empty?
|
127
|
+
end
|
128
|
+
|
129
|
+
def normalize(data, schema)
|
130
|
+
schema = schema.gsub(/_SHA256$/,'') # remove hash suffix
|
131
|
+
# Data normalization
|
132
|
+
# Refer to https://developers.facebook.com/docs/marketing-api/audiences-api for rules
|
133
|
+
|
134
|
+
case schema
|
135
|
+
when 'EMAIL'
|
136
|
+
data.to_s.strip.downcase
|
137
|
+
when 'PHONE'
|
138
|
+
data.to_s.gsub(/[^0-9]/,'')
|
139
|
+
when 'GEN'
|
140
|
+
# Match the first F or M character
|
141
|
+
data.to_s[/[mfMF]/] || (raise InvalidParameterError, "Invalid value: #{data} for Gender")
|
142
|
+
when 'DOBY'
|
143
|
+
data.to_s.strip.gsub(/[^0-9]/,'')
|
144
|
+
when 'DOBM','DOBD'
|
145
|
+
data.to_s.strip.gsub(/[^0-9]/,'').rjust(2,'0')
|
146
|
+
when 'LN', 'FN'
|
147
|
+
data.to_s.strip.gsub(/[^[:alpha:]]/,'').downcase # using [:alpha] here to include also Unicode
|
148
|
+
when 'FI'
|
149
|
+
data.to_s.strip[0].downcase
|
150
|
+
when 'ST', 'CT'
|
151
|
+
data.to_s.strip.downcase.gsub(/[^a-z]+/,'')
|
152
|
+
when 'ZIP'
|
153
|
+
data.to_s.split('-').first.strip.gsub(/[:blank:]+/,'').downcase
|
154
|
+
when 'MADID'
|
155
|
+
data.to_s.downcase
|
156
|
+
when 'COUNTRY'
|
157
|
+
if data.strip.length != 2
|
158
|
+
raise InvalidParameterError, "Only 2-letter country codes is accepted for COUNTRY"
|
159
|
+
end
|
160
|
+
data.strip.downcase
|
161
|
+
else # UID, EXTERN_ID, MOBILE_ADVERTISER_ID
|
162
|
+
data
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def hash_sha256(data)
|
167
|
+
Digest::SHA256.hexdigest(data)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
4
|
+
# copy, modify, and distribute this software in source code or binary form for use
|
5
|
+
# in connection with the web services and APIs provided by Facebook.
|
6
|
+
#
|
7
|
+
# As with any software that integrates with the Facebook platform, your use of
|
8
|
+
# this software is subject to the Facebook Platform Policy
|
9
|
+
# [http://developers.facebook.com/policy/]. This copyright notice shall be
|
10
|
+
# included in all copies or substantial portions of the software.
|
11
|
+
#
|
12
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
14
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
15
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
16
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
17
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
|
+
|
19
|
+
# FB:AUTOGEN
|
20
|
+
|
21
|
+
module FacebookAds
|
22
|
+
# This class is auto-genereated.
|
23
|
+
|
24
|
+
# For any issues or feature requests related to this class, please let us know
|
25
|
+
# on github and we'll fix in our codegen framework. We'll not be able to accept
|
26
|
+
# pull request for this class.
|
27
|
+
|
28
|
+
class Hotel < AdObject
|
29
|
+
|
30
|
+
field :address, 'string'
|
31
|
+
field :applinks, 'AppLinks'
|
32
|
+
field :brand, 'string'
|
33
|
+
field :description, 'string'
|
34
|
+
field :guest_ratings, 'string'
|
35
|
+
field :hotel_id, 'string'
|
36
|
+
field :id, 'string'
|
37
|
+
field :images, { list: 'string' }
|
38
|
+
field :lowest_base_price, 'string'
|
39
|
+
field :name, 'string'
|
40
|
+
field :phone, 'string'
|
41
|
+
field :star_rating, 'string'
|
42
|
+
field :url, 'string'
|
43
|
+
|
44
|
+
has_edge :hotel_rooms do |edge|
|
45
|
+
edge.post 'HotelRoom' do |api|
|
46
|
+
api.has_param :applinks, 'object'
|
47
|
+
api.has_param :base_price, 'double'
|
48
|
+
api.has_param :currency, 'string'
|
49
|
+
api.has_param :description, 'string'
|
50
|
+
api.has_param :images, { list: 'object' }
|
51
|
+
api.has_param :margin_level, 'int'
|
52
|
+
api.has_param :name, 'string'
|
53
|
+
api.has_param :pricing_variables, { list: 'object' }
|
54
|
+
api.has_param :room_id, 'string'
|
55
|
+
api.has_param :sale_price, 'double'
|
56
|
+
api.has_param :url, 'string'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|