Class: EngagingNetworks::Campaign
- Inherits:
-
Base
- Object
- Vertebrae::Model
- Base
- EngagingNetworks::Campaign
show all
- Defined in:
- lib/engaging_networks/campaign.rb
Instance Method Summary
collapse
Methods inherited from Base
#action_path, #data_path, #export_path, #import_path, #scrape
Instance Method Details
#create(name:, description:, ajax_enabled: true) ⇒ Object
11
12
13
|
# File 'lib/engaging_networks/campaign.rb', line 11
def create(name:, description:, ajax_enabled: true)
scrape.create_campaign(name: name, description: description, ajax_enabled: ajax_enabled)
end
|
#duplicate(a) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/engaging_networks/campaign.rb', line 16
def duplicate(a)
action = if a.is_a?(Hash)
DuplicateCampaignAction.new(a)
else
a
end
action.token = client.connection.configuration.options[:private_token] if action.token.blank?
if action.valid?
response = client.request_with_options(:post, import_path, action.to_params, content_type: 'multipart/form-data')
if response.body =~ /uploaded successfully/
action.job_id = /# is (\d*)/.match(response.body)[1]
else
raise CampaignDuplicationError.new("error while duplicating campaign: #{response.body}")
end
end
action
end
|
#get(campaignId) ⇒ Object
#search(campaign_name) ⇒ Object