facebookbusiness 0.3.0.1 → 0.3.0.2
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/README.md +11 -11
- data/lib/facebook_ads/field_types/datetime.rb +4 -4
- data/lib/facebook_ads/field_types/object.rb +1 -6
- data/lib/facebook_ads/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 359da166cfea1ca59718d0bc849bf174fa8843ccb040345893f74e26be5c60f6
|
4
|
+
data.tar.gz: 9504ad8b96c5fbe03b291d335f1b12ed80a13e160e80b2dce9153cf8902fa512
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13ec26ac56bff595a8d83cc70356b7634bae9ba2debb4e50a4009d45c81a50ede08cb002d9d6cd500e7d6597ca682a24af126a85ae8c8e350aef70d4ef223f73
|
7
|
+
data.tar.gz: cfc314a4240511e8d5d7362a047b02c81f25462916de870535446a82621459f4549331082a8379632744c5a8d28cc89ee13d270073703c0f8f874db514416eec
|
data/README.md
CHANGED
@@ -49,25 +49,25 @@ to get an access token.
|
|
49
49
|
The SDK is available as a RubyGem. To use the gem, you can add the following to Gemfile
|
50
50
|
|
51
51
|
```ruby
|
52
|
-
gem '
|
52
|
+
gem 'facebookbusiness'
|
53
53
|
```
|
54
54
|
|
55
55
|
or install it using command line
|
56
56
|
|
57
57
|
```bash
|
58
|
-
gem install
|
58
|
+
gem install facebookbusiness
|
59
59
|
```
|
60
60
|
|
61
61
|
and then in your code
|
62
62
|
|
63
63
|
```ruby
|
64
|
-
require '
|
64
|
+
require 'facebookbusiness'
|
65
65
|
```
|
66
66
|
|
67
67
|
|
68
68
|
## Configuration
|
69
69
|
### Access Token
|
70
|
-
There are several ways to configure access token and app secret. If you only use one access token and app secret (example: an internal app managing only your own assets). You can set a global access token and app secret will
|
70
|
+
There are several ways to configure access token and app secret. If you only use one access token and app secret (example: an internal app managing only your own assets). You can set a global access token and app secret will be used across all requests
|
71
71
|
|
72
72
|
```ruby
|
73
73
|
FacebookAds.configure do |config|
|
@@ -88,10 +88,10 @@ Or you can create a session object for particular object
|
|
88
88
|
```ruby
|
89
89
|
# Create a Session object to be reused
|
90
90
|
session = FacebookAds::Session.new(access_token: <ACCESS_TOKEN>, app_secret: <APP SECRET>)
|
91
|
-
ad_account = FacebookAds::AdAccount.get('
|
91
|
+
ad_account = FacebookAds::AdAccount.get('act_<YOUR_AD_ACCOUNT_ID>', 'name', session)
|
92
92
|
|
93
93
|
# Or a using shortcut during object instantiation
|
94
|
-
ad_account = FacebookAds::AdAccount.get('
|
94
|
+
ad_account = FacebookAds::AdAccount.get('act_<YOUR_AD_ACCOUNT_ID>', 'name', {
|
95
95
|
access_token: <ACCESS_TOKEN>, app_secret: <APP SECRET>
|
96
96
|
})
|
97
97
|
```
|
@@ -102,7 +102,7 @@ ad_account = FacebookAds::AdAccount.get('act_12334', 'name', {
|
|
102
102
|
The SDK contains ad object files auto generated from our API metadata, each node type has its own corresponding Ruby class under the `FacebookAds` module. For example, to fetch an AdAccount
|
103
103
|
|
104
104
|
```ruby
|
105
|
-
ad_account = FacebookAds::AdAccount.get('
|
105
|
+
ad_account = FacebookAds::AdAccount.get('act_<YOUR_AD_ACCOUNT_ID>', 'name')
|
106
106
|
puts "Ad Account Name: #{ad_account.name}"
|
107
107
|
```
|
108
108
|
|
@@ -112,7 +112,7 @@ The `#get` method doesn't trigger the `GET` request immediately. The API request
|
|
112
112
|
To update a node, you can use the `#save` method of ad object classes.
|
113
113
|
|
114
114
|
```ruby
|
115
|
-
ad_account = FacebookAds::AdAccount.get('
|
115
|
+
ad_account = FacebookAds::AdAccount.get('act_<YOUR_AD_ACCOUNT_ID>', 'name')
|
116
116
|
ad_account.name = "New Ad Account"
|
117
117
|
ad_account.save
|
118
118
|
|
@@ -142,7 +142,7 @@ To interact with an edge, you first need to instantiate the parent node. Since,
|
|
142
142
|
Iterating edges is easy, instantiate the parent nodes and then simply iterate with `#each`. The edge is an `Enumerable` so a bunch of handy methods such as `#map`, `#select`, `#find` etc. come for free!
|
143
143
|
|
144
144
|
```ruby
|
145
|
-
ad_account = FacebookAds::AdAccount.get('
|
145
|
+
ad_account = FacebookAds::AdAccount.get('act_<YOUR_AD_ACCOUNT_ID>', 'name')
|
146
146
|
|
147
147
|
# Printing all campaign names
|
148
148
|
ad_account.campaigns(fields: 'name').each do |campaign|
|
@@ -200,7 +200,7 @@ ad_account.advideos.create({
|
|
200
200
|
[Batch API](https://developers.facebook.com/docs/marketing-api/asyncrequests) allows you to make API calls in a batch. You can collect a bunch of API requests and fire them all at once to reduce wait time. To create a batch, just wrap operations with a block to `FacebookAds::Batch#with_batch`
|
201
201
|
|
202
202
|
```ruby
|
203
|
-
ad_account = FacebookAds::AdAccount.get('act_<
|
203
|
+
ad_account = FacebookAds::AdAccount.get('act_<YOUR_AD_ACCOUNT_ID>')
|
204
204
|
|
205
205
|
batch = FacebookAds::Batch.with_batch do
|
206
206
|
10.times.map do |n|
|
@@ -219,7 +219,7 @@ batch.execute
|
|
219
219
|
Dependencies between requests is supported, the SDK simplifies the use of JSONPath references between batched operations.
|
220
220
|
|
221
221
|
```ruby
|
222
|
-
ad_account = FacebookAds::AdAccount.get('
|
222
|
+
ad_account = FacebookAds::AdAccount.get('act_<YOUR_AD_ACCOUNT_ID>')
|
223
223
|
|
224
224
|
batch = FacebookAds::Batch.with_batch do
|
225
225
|
# This won't be sent out immediately!
|
@@ -26,17 +26,17 @@ module FacebookAds
|
|
26
26
|
def deserialize(value, session = nil)
|
27
27
|
case value
|
28
28
|
when String
|
29
|
-
DateTime.strptime(value, '%FT%T%:z')
|
29
|
+
::DateTime.strptime(value, '%FT%T%:z')
|
30
30
|
else
|
31
|
-
Time.at(value).to_datetime
|
31
|
+
::Time.at(value).to_datetime
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def serialize(value)
|
36
36
|
case value
|
37
|
-
when DateTime, Time
|
37
|
+
when ::DateTime, ::Time
|
38
38
|
value.to_time.to_i
|
39
|
-
when String
|
39
|
+
when ::String
|
40
40
|
DateTime.parse(value).to_time.to_i
|
41
41
|
else
|
42
42
|
value
|
@@ -22,12 +22,7 @@ module FacebookAds
|
|
22
22
|
register 'hash', 'map', 'object'
|
23
23
|
|
24
24
|
def deserialize(value, session = nil)
|
25
|
-
|
26
|
-
when String
|
27
|
-
JSON.parse(value)
|
28
|
-
else
|
29
|
-
value
|
30
|
-
end
|
25
|
+
value.is_a?(String) ? JSON.parse(value) : value
|
31
26
|
end
|
32
27
|
|
33
28
|
def serialize(value)
|
data/lib/facebook_ads/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facebookbusiness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0.
|
4
|
+
version: 0.3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Facebook
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|