Class: Adparlor::Facebook::GraphApi::Campaign
- Inherits:
-
GraphObject
- Object
- GraphObject
- Adparlor::Facebook::GraphApi::Campaign
- Includes:
- Fields::Campaign, Traits::Methods
- Defined in:
- lib/adparlor/facebook/graph_api/campaign.rb
Constant Summary
Constants included from Fields::Campaign
Fields::Campaign::CREATE_FIELDS, Fields::Campaign::FIELDS, Fields::Campaign::UPDATE_FIELDS
Constants included from Fields::FieldDecorator
Fields::FieldDecorator::GLOBAL_FIELDS
Instance Attribute Summary
Attributes inherited from GraphObject
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Traits::Methods
#create, #destroy, included, #update
Methods inherited from GraphObject
#batch, create, #create, data_pass_through, #destroy, get, #initialize, parse_data_for_collection, read, respond_for_data, #to_hash, #to_json, update, #update
Methods included from Api
#base_uri, #conn, #conn_multi, #get, #post, #proxy_api_key
Methods included from Fields::FieldDecorator
Constructor Details
This class inherits a constructor from Adparlor::Facebook::GraphApi::GraphObject
Class Method Details
.destroy(attributes = {}, options = {}) ⇒ Object
13 14 15 16 |
# File 'lib/adparlor/facebook/graph_api/campaign.rb', line 13 def destroy(attributes = {}, = {}) obj = new(attributes.merge(status: 'DELETED')) obj.post(obj.update_path, , 'DELETE') end |
Instance Method Details
#ads ⇒ Object
33 34 35 |
# File 'lib/adparlor/facebook/graph_api/campaign.rb', line 33 def ads @ads ||= CollectionProxy.new(Ad, "/#{id}/ads", access_token) end |
#adsets ⇒ Object
37 38 39 |
# File 'lib/adparlor/facebook/graph_api/campaign.rb', line 37 def adsets @adsets ||= CollectionProxy.new(AdSet, "/#{id}/adsets", access_token) end |
#delete ⇒ Object
29 30 31 |
# File 'lib/adparlor/facebook/graph_api/campaign.rb', line 29 def delete raise FbError.new('delete not available, use soft delete update', 500) end |
#path ⇒ Object
19 20 21 22 |
# File 'lib/adparlor/facebook/graph_api/campaign.rb', line 19 def path raise FbError.new('required parameter account_id missing', 500) unless account_id "/act_#{account_id}/campaigns" end |
#update_path ⇒ Object
24 25 26 27 |
# File 'lib/adparlor/facebook/graph_api/campaign.rb', line 24 def update_path raise FbError.new('required parameter id missing', 500) unless id "/#{id}" end |