facebook_ads 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/facebook_ads.gemspec +1 -1
- data/lib/facebook_ads/ad_account.rb +12 -2
- data/lib/facebook_ads/ad_creative.rb +17 -0
- data/lib/facebook_ads/ad_product_catalog.rb +13 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70fa12a0d54cd517252ce2bbcd562b951f698279
|
4
|
+
data.tar.gz: f296ab2e5a3d8ee496f8f51afb94cd1b0307fae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8afed8760dc4ef008eba4d5ae8ce4ae31754bd980edcc4f35312e739d165a73bc84ae57ce93947d0642a3c3a3ac94d42893fd236536b6d01788852fa39ddc61e
|
7
|
+
data.tar.gz: 2dedaafa25aabbbcb7e9e080949198a80db26df3ae41d5ff3a0b6dbfd8a6b0a8e5414d4605713b984170f18bfba836a6aef5a6fe4b1e8bc187005d86c2898c14
|
data/Gemfile.lock
CHANGED
data/facebook_ads.gemspec
CHANGED
@@ -32,6 +32,13 @@ module FacebookAds
|
|
32
32
|
AdCampaign.find(result['id'])
|
33
33
|
end
|
34
34
|
|
35
|
+
def create_dynamic_ad_campaign(name:, product_catalog_id:, status: 'ACTIVE')
|
36
|
+
raise Exception, "Status must be one of: #{AdCampaign::STATUSES.to_sentence}" unless AdCampaign::STATUSES.include?(status)
|
37
|
+
query = { name: name, objective: 'PRODUCT_CATALOG_SALES', status: status, promoted_object: { product_catalog_id: product_catalog_id } }
|
38
|
+
result = AdCampaign.post("/#{id}/campaigns", query: query)
|
39
|
+
AdCampaign.find(result['id'])
|
40
|
+
end
|
41
|
+
|
35
42
|
# has_many ad_images
|
36
43
|
|
37
44
|
def ad_images(hashes: nil, limit: 100)
|
@@ -99,13 +106,16 @@ module FacebookAds
|
|
99
106
|
|
100
107
|
def create_carousel_ad_creative(creative)
|
101
108
|
required = %i(name page_id link message assets call_to_action_type multi_share_optimized multi_share_end_card)
|
102
|
-
|
103
109
|
unless (keys = required - creative.keys).length.zero?
|
104
110
|
raise Exception, "Creative is missing the following: #{keys.to_sentence}"
|
105
111
|
end
|
106
112
|
|
107
113
|
raise Exception, "Creative call_to_action_type must be one of: #{AdCreative::CALL_TO_ACTION_TYPES.to_sentence}" unless AdCreative::CALL_TO_ACTION_TYPES.include?(creative[:call_to_action_type])
|
108
|
-
query =
|
114
|
+
query = if creative[:product_set_id].present?
|
115
|
+
AdCreative.product_set(name: creative[:name], page_id: creative[:page_id], link: creative[:link], message: creative[:message], headline: creative[:headline], description: creative[:description], product_set_id: creative[:product_set_id])
|
116
|
+
else
|
117
|
+
AdCreative.carousel(creative)
|
118
|
+
end
|
109
119
|
result = AdCreative.post("/#{id}/adcreatives", query: query)
|
110
120
|
AdCreative.find(result['id'])
|
111
121
|
end
|
@@ -54,11 +54,28 @@ module FacebookAds
|
|
54
54
|
}
|
55
55
|
}
|
56
56
|
|
57
|
+
|
57
58
|
{
|
58
59
|
name: name,
|
59
60
|
object_story_spec: object_story_spec.to_json
|
60
61
|
}
|
61
62
|
end
|
63
|
+
|
64
|
+
def product_set(name:, page_id:, link:, message:, headline:, description:, product_set_id:)
|
65
|
+
{ name: name,
|
66
|
+
object_story_spec: {
|
67
|
+
page_id: page_id,
|
68
|
+
template_data: {
|
69
|
+
description: description,
|
70
|
+
link: link,
|
71
|
+
message: message,
|
72
|
+
name: headline
|
73
|
+
}
|
74
|
+
},
|
75
|
+
template_url: link,
|
76
|
+
product_set_id: product_set_id
|
77
|
+
}
|
78
|
+
end
|
62
79
|
end
|
63
80
|
end
|
64
81
|
end
|
@@ -36,17 +36,24 @@ module FacebookAds
|
|
36
36
|
AdProductFeed.find(result['id'])
|
37
37
|
end
|
38
38
|
|
39
|
+
# catalog.create_ad_product_set(name: 'Ring Set', filter: {"category":{"i_contains":"Apparel & Accessories > Jewelry > Earrings"}})
|
40
|
+
def create_ad_product_set(name:, filter:)
|
41
|
+
query = { name: name, filter: filter.to_json }
|
42
|
+
result = AdProductSet.post("/#{id}/product_sets", query: query)
|
43
|
+
AdProductSet.find(result['id'])
|
44
|
+
end
|
45
|
+
|
39
46
|
# has_many product_groups
|
40
47
|
|
41
|
-
|
42
|
-
|
43
|
-
|
48
|
+
def ad_product_groups
|
49
|
+
AdProductGroup.paginate("/#{id}/product_groups")
|
50
|
+
end
|
44
51
|
|
45
52
|
# has_many product_sets
|
46
53
|
|
47
|
-
|
48
|
-
|
49
|
-
|
54
|
+
def ad_product_sets
|
55
|
+
AdProductSet.paginate("/#{id}/product_sets")
|
56
|
+
end
|
50
57
|
|
51
58
|
# has_many ad_products
|
52
59
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facebook_ads
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Estreich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.4.8
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Facebook Marketing API SDK for Ruby.
|