adparlor-facebook 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.gitlab-ci.yml +5 -0
- data/.rspec +2 -0
- data/.rubocop.yml +28 -0
- data/.ruby-version +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +136 -0
- data/Guardfile +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +164 -0
- data/Rakefile +3 -0
- data/adparlor-facebook.gemspec +38 -0
- data/bin/console +18 -0
- data/bin/gitlab_runner_specs.sh +22 -0
- data/bin/setup +7 -0
- data/lib/adparlor/facebook/api.rb +106 -0
- data/lib/adparlor/facebook/config.rb +24 -0
- data/lib/adparlor/facebook/error.rb +13 -0
- data/lib/adparlor/facebook/graph_api/activity.rb +11 -0
- data/lib/adparlor/facebook/graph_api/ad.rb +43 -0
- data/lib/adparlor/facebook/graph_api/ad_account.rb +168 -0
- data/lib/adparlor/facebook/graph_api/ad_creative.rb +22 -0
- data/lib/adparlor/facebook/graph_api/ad_image.rb +87 -0
- data/lib/adparlor/facebook/graph_api/ad_label.rb +12 -0
- data/lib/adparlor/facebook/graph_api/ad_preview.rb +15 -0
- data/lib/adparlor/facebook/graph_api/ad_set.rb +39 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_search.rb +64 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_education_major.rb +11 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_education_school.rb +11 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_geolocation.rb +19 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_geolocation_meta.rb +16 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_geolocations/ad_city.rb +13 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_geolocations/ad_country.rb +13 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_geolocations/ad_geo_market.rb +13 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_geolocations/ad_region.rb +13 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_geolocations/ad_zip_code.rb +13 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_interest.rb +11 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_interest_suggestion.rb +12 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_interest_validation.rb +18 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_locale.rb +11 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_radius_suggestion.rb +11 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_targeting_category.rb +18 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_work_employer.rb +11 -0
- data/lib/adparlor/facebook/graph_api/ad_targeting_types/ad_work_position.rb +11 -0
- data/lib/adparlor/facebook/graph_api/ad_video.rb +124 -0
- data/lib/adparlor/facebook/graph_api/ads_pixel.rb +22 -0
- data/lib/adparlor/facebook/graph_api/ads_pixel_stat.rb +25 -0
- data/lib/adparlor/facebook/graph_api/advertisable_application.rb +11 -0
- data/lib/adparlor/facebook/graph_api/app_event_type.rb +11 -0
- data/lib/adparlor/facebook/graph_api/application.rb +15 -0
- data/lib/adparlor/facebook/graph_api/batch_object.rb +147 -0
- data/lib/adparlor/facebook/graph_api/broad_targeting_category.rb +11 -0
- data/lib/adparlor/facebook/graph_api/business.rb +18 -0
- data/lib/adparlor/facebook/graph_api/campaign.rb +43 -0
- data/lib/adparlor/facebook/graph_api/collection_proxy.rb +36 -0
- data/lib/adparlor/facebook/graph_api/connection_object.rb +11 -0
- data/lib/adparlor/facebook/graph_api/custom_audience.rb +31 -0
- data/lib/adparlor/facebook/graph_api/custom_audience_tos.rb +11 -0
- data/lib/adparlor/facebook/graph_api/custom_audience_user.rb +85 -0
- data/lib/adparlor/facebook/graph_api/custom_conversion.rb +22 -0
- data/lib/adparlor/facebook/graph_api/delivery_estimate.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/activity.rb +12 -0
- data/lib/adparlor/facebook/graph_api/fields/ad.rb +60 -0
- data/lib/adparlor/facebook/graph_api/fields/ad_account.rb +21 -0
- data/lib/adparlor/facebook/graph_api/fields/ad_creative.rb +23 -0
- data/lib/adparlor/facebook/graph_api/fields/ad_image.rb +14 -0
- data/lib/adparlor/facebook/graph_api/fields/ad_label.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/ad_preview.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/ad_set.rb +100 -0
- data/lib/adparlor/facebook/graph_api/fields/ad_video.rb +22 -0
- data/lib/adparlor/facebook/graph_api/fields/ads_pixel.rb +12 -0
- data/lib/adparlor/facebook/graph_api/fields/ads_pixel_stat.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/advertisable_application.rb +17 -0
- data/lib/adparlor/facebook/graph_api/fields/app_event_type.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/application.rb +31 -0
- data/lib/adparlor/facebook/graph_api/fields/broad_targeting_category.rb +12 -0
- data/lib/adparlor/facebook/graph_api/fields/business.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/campaign.rb +17 -0
- data/lib/adparlor/facebook/graph_api/fields/connection_object.rb +16 -0
- data/lib/adparlor/facebook/graph_api/fields/custom_audience.rb +22 -0
- data/lib/adparlor/facebook/graph_api/fields/custom_audience_tos.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/custom_audience_user.rb +14 -0
- data/lib/adparlor/facebook/graph_api/fields/custom_conversion.rb +14 -0
- data/lib/adparlor/facebook/graph_api/fields/delivery_estimate.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/field_decorator.rb +51 -0
- data/lib/adparlor/facebook/graph_api/fields/insight.rb +16 -0
- data/lib/adparlor/facebook/graph_api/fields/instagram_account.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/leadgen_form.rb +23 -0
- data/lib/adparlor/facebook/graph_api/fields/page.rb +121 -0
- data/lib/adparlor/facebook/graph_api/fields/page_and_place.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/partner_category.rb +12 -0
- data/lib/adparlor/facebook/graph_api/fields/picture.rb +17 -0
- data/lib/adparlor/facebook/graph_api/fields/post.rb +17 -0
- data/lib/adparlor/facebook/graph_api/fields/product_audience.rb +12 -0
- data/lib/adparlor/facebook/graph_api/fields/product_catalog.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/product_feed.rb +12 -0
- data/lib/adparlor/facebook/graph_api/fields/product_group.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/product_item.rb +18 -0
- data/lib/adparlor/facebook/graph_api/fields/product_set.rb +13 -0
- data/lib/adparlor/facebook/graph_api/fields/reach_estimate.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/reach_frequency_prediction.rb +24 -0
- data/lib/adparlor/facebook/graph_api/fields/targeting_sentence_line.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/targeting_suggestion.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/targeting_validation.rb +11 -0
- data/lib/adparlor/facebook/graph_api/fields/user_lead_gen_info.rb +18 -0
- data/lib/adparlor/facebook/graph_api/fields/video_thumbnail.rb +11 -0
- data/lib/adparlor/facebook/graph_api/graph_object.rb +140 -0
- data/lib/adparlor/facebook/graph_api/insight.rb +18 -0
- data/lib/adparlor/facebook/graph_api/instagram_account.rb +12 -0
- data/lib/adparlor/facebook/graph_api/leadgen_form.rb +10 -0
- data/lib/adparlor/facebook/graph_api/page.rb +27 -0
- data/lib/adparlor/facebook/graph_api/page_and_place.rb +11 -0
- data/lib/adparlor/facebook/graph_api/partner_category.rb +11 -0
- data/lib/adparlor/facebook/graph_api/picture.rb +15 -0
- data/lib/adparlor/facebook/graph_api/post.rb +17 -0
- data/lib/adparlor/facebook/graph_api/product_audience.rb +17 -0
- data/lib/adparlor/facebook/graph_api/product_catalog.rb +27 -0
- data/lib/adparlor/facebook/graph_api/product_feed.rb +11 -0
- data/lib/adparlor/facebook/graph_api/product_group.rb +11 -0
- data/lib/adparlor/facebook/graph_api/product_item.rb +11 -0
- data/lib/adparlor/facebook/graph_api/product_set.rb +26 -0
- data/lib/adparlor/facebook/graph_api/reach_estimate.rb +17 -0
- data/lib/adparlor/facebook/graph_api/reach_frequency_prediction.rb +18 -0
- data/lib/adparlor/facebook/graph_api/targeting_sentence_line.rb +11 -0
- data/lib/adparlor/facebook/graph_api/targeting_suggestion.rb +16 -0
- data/lib/adparlor/facebook/graph_api/targeting_validation.rb +16 -0
- data/lib/adparlor/facebook/graph_api/traits/methods.rb +64 -0
- data/lib/adparlor/facebook/graph_api/user_lead_gen_info.rb +11 -0
- data/lib/adparlor/facebook/graph_api/video_thumbnail.rb +11 -0
- data/lib/adparlor/facebook/graph_api.rb +9 -0
- data/lib/adparlor/facebook/version.rb +5 -0
- data/lib/adparlor/facebook.rb +9 -0
- data/solano.yml +15 -0
- metadata +391 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module Ad
|
6
|
+
FIELDS = [
|
7
|
+
:id,
|
8
|
+
:account_id,
|
9
|
+
:adset,
|
10
|
+
:campaign_id,
|
11
|
+
:campaign,
|
12
|
+
:adlabels,
|
13
|
+
:adset_id,
|
14
|
+
:ad_review_feedback,
|
15
|
+
:bid_amount,
|
16
|
+
:bid_info,
|
17
|
+
:bid_type,
|
18
|
+
:configured_status,
|
19
|
+
:conversion_specs,
|
20
|
+
:created_time,
|
21
|
+
:creative,
|
22
|
+
:effective_status,
|
23
|
+
:last_updated_by_app_id,
|
24
|
+
:name,
|
25
|
+
:tracking_specs,
|
26
|
+
:updated_time
|
27
|
+
]
|
28
|
+
|
29
|
+
CREATE_FIELDS = [
|
30
|
+
:adset_id,
|
31
|
+
:date_format,
|
32
|
+
:creative,
|
33
|
+
:name,
|
34
|
+
:status,
|
35
|
+
:tracking_specs,
|
36
|
+
:display_sequence,
|
37
|
+
:execution_options,
|
38
|
+
:ad_labels,
|
39
|
+
:bid_amount,
|
40
|
+
:redownload,
|
41
|
+
:object_story_spec
|
42
|
+
]
|
43
|
+
|
44
|
+
UPDATE_FIELDS = [
|
45
|
+
:adset_id,
|
46
|
+
:creative,
|
47
|
+
:name,
|
48
|
+
:status,
|
49
|
+
:tracking_specs,
|
50
|
+
:display_sequence,
|
51
|
+
:execution_options,
|
52
|
+
:adlabels,
|
53
|
+
:bid_amount,
|
54
|
+
:redownload
|
55
|
+
]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module AdAccount
|
6
|
+
FIELDS = [:id, :account_id, :account_status, :age,
|
7
|
+
:agency_client_declaration, :amount_spent, :balance, :business,
|
8
|
+
:business_city, :business_country_code, :business_name,
|
9
|
+
:business_state, :business_street2, :business_street, :business_zip,
|
10
|
+
:created_time, :end_advertiser, :media_agency, :partner, :capabilities,
|
11
|
+
:currency, :is_personal, :name, :offsite_pixels_tos_accepted,
|
12
|
+
:spend_cap, :funding_source, :funding_source_details,
|
13
|
+
:timezone_id, :timezone_name, :timezone_offset_hours_utc, :tos_accepted,
|
14
|
+
:users, :tax_id_status, :min_daily_budget, :min_campaign_group_spend_cap]
|
15
|
+
CREATE_FIELDS = [:adaccounts, :replace]
|
16
|
+
UPDATE_FIELDS = [:adaccounts, :replace]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module AdCreative
|
6
|
+
FIELDS = [:actor_id, :adlabels, :applink_treatment,
|
7
|
+
:body, :call_to_action_type, :dynamic_ad_voice, :effective_instagram_story_id,
|
8
|
+
:effective_object_story_id, :id, :image_hash, :image_url, :image_crops,
|
9
|
+
:instagram_actor_id, :instagram_permalink_url, :link_deep_link_url,
|
10
|
+
:link_url, :name, :object_id, :object_story_id, :object_story_spec,
|
11
|
+
:object_store_url, :object_type, :object_url, :product_set_id,
|
12
|
+
:template_url, :thumbnail_url, :title, :url_tags, :video_id]
|
13
|
+
CREATE_FIELDS = [:actor_id, :adlabels, :applink_treatment, :body, :call_to_action,
|
14
|
+
:dynamic_ad_voice, :follow_redirect, :image_crops, :image_file,
|
15
|
+
:image_hash, :image_url, :instagram_actor_id, :instagram_permalink_url,
|
16
|
+
:link_og_id, :link_url, :name, :object_id, :object_story_id,
|
17
|
+
:object_type, :object_url, :product_set_id, :template_url, :thumbnail_url,
|
18
|
+
:title, :url_tags, :video_id, :object_story_spec, :id]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module AdImage
|
6
|
+
FIELDS = [:id, :account_id, :hash, :url, :creatives, :filename, :width, :height,
|
7
|
+
:original_width, :original_height, :name, :status,
|
8
|
+
:created_time, :updated_time, :permalink_url, :url_128]
|
9
|
+
CREATE_FIELDS = [:account_id, :copy_from, :source]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module AdSet
|
6
|
+
FIELDS = [
|
7
|
+
:id,
|
8
|
+
:account_id,
|
9
|
+
:adlabels,
|
10
|
+
:adset_schedule,
|
11
|
+
:attribution_spec,
|
12
|
+
:bid_amount,
|
13
|
+
:bid_info,
|
14
|
+
:billing_event,
|
15
|
+
:campaign,
|
16
|
+
:campaign_id,
|
17
|
+
:configured_status,
|
18
|
+
:created_time,
|
19
|
+
:creative_sequence,
|
20
|
+
:effective_status,
|
21
|
+
:end_time,
|
22
|
+
:frequency_control_specs,
|
23
|
+
:lifetime_imps,
|
24
|
+
:name,
|
25
|
+
:optimization_goal,
|
26
|
+
:promoted_object,
|
27
|
+
:rf_prediction_id,
|
28
|
+
:start_time,
|
29
|
+
:targeting,
|
30
|
+
:updated_time,
|
31
|
+
:use_new_app_click,
|
32
|
+
:pacing_type,
|
33
|
+
:budget_remaining,
|
34
|
+
:daily_budget,
|
35
|
+
:lifetime_budget,
|
36
|
+
:bid_strategy
|
37
|
+
]
|
38
|
+
|
39
|
+
CREATE_FIELDS = [
|
40
|
+
:account_id,
|
41
|
+
:adlabels,
|
42
|
+
:attribution_spec,
|
43
|
+
:bid_amount,
|
44
|
+
:billing_event,
|
45
|
+
:campaign_id,
|
46
|
+
:adset_schedule,
|
47
|
+
:status,
|
48
|
+
:creative_sequence,
|
49
|
+
:daily_budget,
|
50
|
+
:daily_imps,
|
51
|
+
:end_time,
|
52
|
+
:execution_options,
|
53
|
+
:frequency_control_specs,
|
54
|
+
:lifetime_budget,
|
55
|
+
:lifetime_imps,
|
56
|
+
:name,
|
57
|
+
:optimization_goal,
|
58
|
+
:pacing_type,
|
59
|
+
:product_ad_behavior,
|
60
|
+
:promoted_object,
|
61
|
+
:redownload,
|
62
|
+
:rf_prediction_id,
|
63
|
+
:start_time,
|
64
|
+
:targeting,
|
65
|
+
:bid_strategy
|
66
|
+
]
|
67
|
+
|
68
|
+
UPDATE_FIELDS = [
|
69
|
+
:id,
|
70
|
+
:account_id,
|
71
|
+
:adlabels,
|
72
|
+
:attribution_spec,
|
73
|
+
:bid_amount,
|
74
|
+
:billing_event,
|
75
|
+
:campaign_id,
|
76
|
+
:adset_schedule,
|
77
|
+
:status,
|
78
|
+
:creative_sequence,
|
79
|
+
:daily_budget,
|
80
|
+
:daily_imps,
|
81
|
+
:end_time,
|
82
|
+
:execution_options,
|
83
|
+
:lifetime_budget,
|
84
|
+
:lifetime_imps,
|
85
|
+
:name,
|
86
|
+
:optimization_goal,
|
87
|
+
:pacing_type,
|
88
|
+
:product_ad_behavior,
|
89
|
+
:promoted_object,
|
90
|
+
:redownload,
|
91
|
+
:rf_prediction_id,
|
92
|
+
:start_time,
|
93
|
+
:targeting,
|
94
|
+
:bid_strategy
|
95
|
+
]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module AdVideo
|
6
|
+
FIELDS = [:id, :created_time, :description, :embed_html, :format, :from,
|
7
|
+
:icon, :is_instagram_eligible, :length, :title, :status, :source,
|
8
|
+
:updated_time, :privacy, :published, :scheduled_publish_time,
|
9
|
+
:embeddable, :content_category, :permalink_url, :event, :place,
|
10
|
+
:backdated_time, :backdated_time_granularity, :picture]
|
11
|
+
CREATE_FIELDS = [:account_id, :user_id, :event_id, :page_id, :group_id,
|
12
|
+
:id, :title, :description, :source, :unpublished_content_type,
|
13
|
+
:file_url, :thumb, :upload_phase, :file_size, :start_offset,
|
14
|
+
:video_file_chunk, :upload_session_id, :content_category,
|
15
|
+
:ebeddable, :slideshow_spec, :backdated_post, :call_to_action,
|
16
|
+
:feed_targeting, :published, :scheduled_publish_time, :targeting,
|
17
|
+
:no_story, :secret, :social_actions]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module Application
|
6
|
+
FIELDS = [:id, :android_key_hash, :android_sdk_error_categories,
|
7
|
+
:app_domains, :app_events_feature_bitmask, :app_install_tracked, :app_name,
|
8
|
+
:app_type, :auth_dialog_data_help_url, :auth_dialog_headline,
|
9
|
+
:auth_dialog_perms_explanation, :auth_referral_default_activity_privacy,
|
10
|
+
:auth_referral_enabled, :auth_referral_extended_perms, :auth_referral_friend_perms,
|
11
|
+
:auth_referral_response_type, :auth_referral_user_perms, :canvas_fluid_height,
|
12
|
+
:canvas_fluid_width, :canvas_url, :category, :client_config, :company,
|
13
|
+
:configured_ios_sso, :contact_email, :context, :created_time, :creator_uid,
|
14
|
+
:deauth_callback_url,
|
15
|
+
:default_share_mode, :description, :hosting_url, :icon_url, :ios_bundle_id,
|
16
|
+
:ios_sdk_error_categories, :ios_supports_system_auth,
|
17
|
+
:ios_supports_native_proxy_auth_flow, :ios_sdk_dialog_flows, :ipad_app_store_id,
|
18
|
+
:iphone_app_store_id, :link, :logo_url, :migrations, :mobile_profile_section_url,
|
19
|
+
:mobile_web_url, :name,
|
20
|
+
:namespace, :object_store_urls, :page_tab_default_name, :page_tab_url,
|
21
|
+
:privacy_policy_url, :profile_section_url, :restrictions, :secure_canvas_url,
|
22
|
+
:secure_page_tab_url, :server_ip_whitelist, :social_discovery, :subcategory,
|
23
|
+
:supports_apprequests_fast_app_switch, :supported_platforms, :supports_attribution,
|
24
|
+
:supports_implicit_sdk_logging, :suppress_native_ios_gdp, :terms_of_service_url,
|
25
|
+
:url_scheme_suffix, :user_support_email, :user_support_url, :website_url,
|
26
|
+
:gdpv4_enabled, :gdpv4_nux_enabled, :gdpv4_nux_content]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module BroadTargetingCategory
|
6
|
+
FIELDS = [:id, :name, :category_description, :parent_category, :path,
|
7
|
+
:size, :type, :type_name, :untranslated_name, :untranslated_parent_name]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module Campaign
|
6
|
+
FIELDS = [:id, :adlabels, :account_id, :buying_type, :can_use_spend_cap,
|
7
|
+
:configured_status, :created_time, :effective_status, :name,
|
8
|
+
:objective, :start_time, :stop_time, :updated_time, :spend_cap]
|
9
|
+
CREATE_FIELDS = [:name, :objective, :status, :buying_type, :promoted_object,
|
10
|
+
:spend_cap, :execution_options, :adlabels, :budget_rebalance_flag]
|
11
|
+
UPDATE_FIELDS = [:name, :objective, :status, :spend_cap, :execution_options,
|
12
|
+
:adlabels, :budget_rebalance_flag]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module ConnectionObject
|
6
|
+
FIELDS = [:id, :name, :name_with_location_descriptor, :url, :type, :checkin_capable,
|
7
|
+
:picture, :tabs, :is_game, :supported_platforms, :native_app_store_ids,
|
8
|
+
:object_store_urls, :app_installs_tracked, :native_app_targeting_ids,
|
9
|
+
:og_namespace, :og_actions, :og_objects, :website, :logo_url, :icon_url,
|
10
|
+
:event_parent_page_id, :event_parent_page_name, :event_start_timestamp,
|
11
|
+
:event_is_viewer_admin, :cpa_access, :engagement_score]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module CustomAudience
|
6
|
+
FIELDS = [:id, :account_id, :approximate_count, :data_source, :delivery_status,
|
7
|
+
:description, :excluded_custom_audiences, :included_custom_audiences,
|
8
|
+
:external_event_source, :lookalike_audience_ids, :lookalike_spec,
|
9
|
+
:name, :operation_status, :opt_out_link, :permission_for_actions,
|
10
|
+
:pixel_id, :rule, :retention_days, :subtype, :time_created,
|
11
|
+
:time_updated, :time_content_updated, :customer_file_source]
|
12
|
+
CREATE_FIELDS = [:creation_params, :description, :id, :name, :opt_out_link,
|
13
|
+
:subtype, :lookalike_spec, :retention_days, :rule, :prefill,
|
14
|
+
:pixel_id, :inclusions, :exclusions, :origin_audience_id, :customer_file_source]
|
15
|
+
UPDATE_FIELDS = [:description, :name, :opt_out_link, :parent_audience_id,
|
16
|
+
:lookalike_spec, :retention_days, :rule, :inclusions,
|
17
|
+
:exclusions, :customer_file_source]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module CustomAudienceUser
|
6
|
+
FIELDS = [:cities, :emails, :facebook_uids, :first_names, :genders, :last_names,
|
7
|
+
:mobile_adversiter_ids, :mobile_device_ids, :payload, :phone_numbers,
|
8
|
+
:states, :zip_codes]
|
9
|
+
UPDATE_FIELDS = [:payload, :other, :account_id]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module CustomConversion
|
6
|
+
FIELDS = [:id, :account_id, :creation_time, :custom_event_type, :default_conversion_value, :description,
|
7
|
+
:first_fired_time, :is_archived, :last_fired_time, :name, :pixel, :rule]
|
8
|
+
CREATE_FIELDS = [:custom_event_type, :description, :default_conversion_value, :name, :event_source_id, :rule]
|
9
|
+
UPDATE_FIELDS = [:default_conversion_value, :description, :name]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module FieldDecorator
|
6
|
+
GLOBAL_FIELDS = [:account_id, :conn, :files, :message, :source]
|
7
|
+
|
8
|
+
def self.included(base)
|
9
|
+
base.extend(ClassMethods)
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
def fields(*args)
|
14
|
+
if args.first == :all
|
15
|
+
@fields.map(&:to_s).join(',')
|
16
|
+
else
|
17
|
+
invalid_fields = args.map(&:to_s) - @fields.map(&:to_s)
|
18
|
+
invalid_fields_error(invalid_fields) if invalid_fields.any?
|
19
|
+
(@fields & args).map(&:to_s).join(',')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def validate_initialize_fields(*args)
|
24
|
+
create_fields = self.const_defined?('CREATE_FIELDS') ? const_get('CREATE_FIELDS') : []
|
25
|
+
invalid_fields = args.map(&:to_s) - ((@fields || []) + GLOBAL_FIELDS + create_fields).map(&:to_s)
|
26
|
+
invalid_fields_error(invalid_fields) if invalid_fields.any?
|
27
|
+
end
|
28
|
+
|
29
|
+
def validate_post_fields(*args, method)
|
30
|
+
valid_fields = self.const_defined?('CREATE_FIELDS') ? const_get('CREATE_FIELDS') : [] if method == 'CREATE'
|
31
|
+
valid_fields = self.const_defined?('UPDATE_FIELDS') ? const_get('UPDATE_FIELDS') : [] if method == 'UPDATE' || method == 'DELETE'
|
32
|
+
invalid_fields = args.map(&:to_s) - (@fields + GLOBAL_FIELDS + valid_fields).map(&:to_s)
|
33
|
+
invalid_fields_error(invalid_fields) if invalid_fields.any?
|
34
|
+
end
|
35
|
+
|
36
|
+
def field_attrs(fields)
|
37
|
+
@fields = fields
|
38
|
+
@fields.each { |field| attr_accessor field }
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def invalid_fields_error(invalid_fields)
|
44
|
+
raise Adparlor::Facebook::Error.new("Invalid field#{invalid_fields.length > 1 ? 's' : ''} #{invalid_fields.join(', ')} passed", 500)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module Insight
|
6
|
+
FIELDS = [:account_id, :action_attribution_windows, :action_breakdowns, :action_report_time,
|
7
|
+
:breakdowns, :date_preset, :default_summary, :export_columns, :export_format,
|
8
|
+
:export_name, :fields, :filtering, :level, :product_id_limit, :sort,
|
9
|
+
:summary, :summary_action_breakdowns, :time_increment, :time_range, :time_ranges,
|
10
|
+
:date_start, :date_stop, :campaign_id, :account_id, :adset_id, :ad_id,
|
11
|
+
:reach, :frequency, :estimated_ad_recallers, :estimated_ad_recall_rate]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Adparlor
|
2
|
+
module Facebook
|
3
|
+
module GraphApi
|
4
|
+
module Fields
|
5
|
+
module LeadgenForm
|
6
|
+
FIELDS = [
|
7
|
+
:id,
|
8
|
+
:follow_up_action_text,
|
9
|
+
:follow_up_action_url,
|
10
|
+
:form_url,
|
11
|
+
:is_tcpa_compliant,
|
12
|
+
:leadgen_export_csv_url,
|
13
|
+
:locale,
|
14
|
+
:name,
|
15
|
+
:page_id,
|
16
|
+
:privacy_policy_url,
|
17
|
+
:status
|
18
|
+
]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|