Class: Adparlor::Facebook::GraphApi::AdAccount
Constant Summary
Fields::AdAccount::CREATE_FIELDS, Fields::AdAccount::FIELDS, Fields::AdAccount::UPDATE_FIELDS
Fields::FieldDecorator::GLOBAL_FIELDS
Instance Attribute Summary
Attributes inherited from GraphObject
#access_token
Class Method Summary
collapse
Instance Method Summary
collapse
#create, #destroy, included, #update
Methods inherited from GraphObject
#batch, create, #create, data_pass_through, destroy, #destroy, #initialize, read, respond_for_data, #to_hash, #to_json, update, #update
Methods included from Api
#base_uri, #conn, #conn_multi, #delete, #get, #post, #proxy_api_key
included
Class Method Details
.get(path_or_account_id, options = {}) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 11
def get(path_or_account_id, options = {})
path = path_or_account_id
begin
account_id = Integer(path_or_account_id)
path = "/#{normalize_account_id(account_id)}"
rescue
STDERR.puts 'Invalid account id passed to get'
end
super(path, options)
end
|
.normalize_account_id(account_id) ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 24
def normalize_account_id(account_id)
account_id = account_id.to_s.downcase
if account_id.include?('act_')
account_id = account_id
else
account_id = "act_#{account_id}"
end
account_id
end
|
.parse_data_for_collection(response) ⇒ Object
34
35
36
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 34
def parse_data_for_collection(response)
response['data'].first.last
end
|
Instance Method Details
#activities ⇒ Object
43
44
45
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 43
def activities
@activities ||= CollectionProxy.new Activity, endpoint('activities'), access_token
end
|
#adcreatives ⇒ Object
47
48
49
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 47
def adcreatives
@adcreatives ||= CollectionProxy.new AdCreative, endpoint('adcreatives'), access_token
end
|
#adimages ⇒ Object
51
52
53
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 51
def adimages
@adimages ||= CollectionProxy.new AdImage, endpoint('adimages'), access_token
end
|
#adlabels ⇒ Object
55
56
57
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 55
def adlabels
@adlabels ||= CollectionProxy.new AdLabel, endpoint('adlabels'), access_token
end
|
#ads ⇒ Object
59
60
61
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 59
def ads
@ads ||= CollectionProxy.new Ad, endpoint('ads'), access_token
end
|
#adsets ⇒ Object
63
64
65
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 63
def adsets
@adsets ||= CollectionProxy.new AdSet, endpoint('adsets'), access_token
end
|
#adspixels ⇒ Object
67
68
69
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 67
def adspixels
@adspixels ||= CollectionProxy.new AdsPixel, endpoint('adspixels'), access_token
end
|
#advertisable_applications ⇒ Object
71
72
73
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 71
def advertisable_applications
@advertisable_applications ||= CollectionProxy.new AdvertisableApplication, endpoint('advertisable_applications'), access_token
end
|
#advideos ⇒ Object
75
76
77
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 75
def advideos
@advideos ||= CollectionProxy.new AdVideo, endpoint('advideos'), access_token
end
|
#applications ⇒ Object
79
80
81
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 79
def applications
@applications ||= CollectionProxy.new Application, endpoint('applications'), access_token
end
|
#broadtargetingcategories ⇒ Object
83
84
85
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 83
def broadtargetingcategories
@broadtargetingcategories ||= CollectionProxy.new BroadTargetingCategory, endpoint('broadtargetingcategories'), access_token
end
|
#campaigns ⇒ Object
92
93
94
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 92
def campaigns
@campaigns ||= CollectionProxy.new Campaign, endpoint('campaigns'), access_token
end
|
#connectionobjects ⇒ Object
Deprecated in v2.6. Please Use advertisable_applications, pages, places endpoint instead
88
89
90
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 88
def connectionobjects
Kernel::fail("connectionobjects is deprecated in v2.6. Use advertisable_applications, pages, places endpoint instead")
end
|
#customaudiences ⇒ Object
96
97
98
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 96
def customaudiences
@customaudiences ||= CollectionProxy.new CustomAudience, endpoint('customaudiences'), access_token
end
|
#customaudiencestos ⇒ Object
100
101
102
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 100
def customaudiencestos
@customaudiencestos ||= CollectionProxy.new CustomAudienceTos, endpoint('customaudiencestos'), access_token
end
|
#customconversions ⇒ Object
104
105
106
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 104
def customconversions
@customconversions ||= CollectionProxy.new CustomConversion, endpoint('customconversions'), access_token
end
|
#delivery_estimate ⇒ Object
108
109
110
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 108
def delivery_estimate
@delivery_estimate ||= CollectionProxy.new DeliveryEstimate, endpoint('delivery_estimate'), access_token
end
|
#generatepreviews ⇒ Object
112
113
114
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 112
def generatepreviews
@generatepreviews ||= CollectionProxy.new AdPreview, endpoint('generatepreviews'), access_token
end
|
#insights ⇒ Object
116
117
118
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 116
def insights
@insights ||= CollectionProxy.new Insight, endpoint('insights'), access_token
end
|
#instagram_accounts ⇒ Object
120
121
122
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 120
def instagram_accounts
@instagram_accounts ||= CollectionProxy.new InstagramAccount, endpoint('instagram_accounts'), access_token
end
|
#normalized_account_id(account_id) ⇒ Object
39
40
41
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 39
def normalized_account_id(account_id)
"act_#{account_id}"
end
|
#offsitepixels ⇒ Object
124
125
126
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 124
def offsitepixels
Kernel::fail("offsite_pixels is deprecated in v2.7 and above.")
end
|
#pages ⇒ Object
128
129
130
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 128
def pages
@pages ||= CollectionProxy.new PageAndPlace, 'me/accounts', access_token
end
|
#partnercategories ⇒ Object
136
137
138
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 136
def partnercategories
@partnercategories ||= CollectionProxy.new PartnerCategory, endpoint('partnercategories'), access_token
end
|
#places ⇒ Object
132
133
134
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 132
def places
@places ||= CollectionProxy.new PageAndPlace, 'me/accounts', access_token, nil, is_place: true
end
|
#reachestimate ⇒ Object
140
141
142
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 140
def reachestimate
@reachestimate ||= CollectionProxy.new ReachEstimate, endpoint('reachestimate'), access_token
end
|
#reachfrequencypredictions ⇒ Object
144
145
146
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 144
def reachfrequencypredictions
@reachfrequencypredictions ||= CollectionProxy.new ReachFrequencyPrediction, endpoint('reachfrequencypredictions'), access_token
end
|
#targetingsentencelines ⇒ Object
148
149
150
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 148
def targetingsentencelines
@targetingsentencelines ||= CollectionProxy.new TargetingSentenceLine, endpoint('targetingsentencelines'), access_token
end
|
#targetingsuggestions ⇒ Object
152
153
154
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 152
def targetingsuggestions
@targetingsuggestions ||= CollectionProxy.new TargetingSuggestion, endpoint('targetingsuggestions'), access_token
end
|
#targetingvalidation ⇒ Object
156
157
158
|
# File 'lib/adparlor/facebook/graph_api/ad_account.rb', line 156
def targetingvalidation
@targetingvalidation ||= CollectionProxy.new TargetingValidation, endpoint('targetingvalidation'), access_token
end
|