Class: EmailDirect::Campaign
- Inherits:
-
Object
- Object
- EmailDirect::Campaign
- Defined in:
- lib/emaildirect/campaign.rb
Overview
Represents a campaign and associated functionality
Instance Attribute Summary collapse
-
#campaign_id ⇒ Object
readonly
Returns the value of attribute campaign_id.
Class Method Summary collapse
- .active(options = {}) ⇒ Object
- .all(options = {}) ⇒ Object
- .create(name, creative_id, subject, from_name, publication_id, options = {}) ⇒ Object
- .drafts(options = {}) ⇒ Object
- .scheduled(options = {}) ⇒ Object
- .sending(options = {}) ⇒ Object
- .sent(options = {}) ⇒ Object
Instance Method Summary collapse
- #cancel ⇒ Object
- #clicks(options = {}) ⇒ Object
- #complaints(options = {}) ⇒ Object
- #delete ⇒ Object
- #details ⇒ Object
- #hard_bounces(options = {}) ⇒ Object
-
#initialize(campaign_id) ⇒ Campaign
constructor
A new instance of Campaign.
- #links ⇒ Object
- #message ⇒ Object
- #opens(options = {}) ⇒ Object
- #recipients(options = {}) ⇒ Object
- #removes(options = {}) ⇒ Object
- #schedule(schedule_date) ⇒ Object
- #soft_bounces(options = {}) ⇒ Object
- #update(name, creative_id, subject, from_name, publication_id, options = {}) ⇒ Object
Constructor Details
#initialize(campaign_id) ⇒ Campaign
47 48 49 |
# File 'lib/emaildirect/campaign.rb', line 47 def initialize(campaign_id) @campaign_id = campaign_id end |
Instance Attribute Details
#campaign_id ⇒ Object (readonly)
Returns the value of attribute campaign_id.
45 46 47 |
# File 'lib/emaildirect/campaign.rb', line 45 def campaign_id @campaign_id end |
Class Method Details
.active(options = {}) ⇒ Object
8 9 10 11 |
# File 'lib/emaildirect/campaign.rb', line 8 def active( = {}) response = EmailDirect.get '/Campaigns', :query => Hashie::Mash.new(response) end |
.all(options = {}) ⇒ Object
33 34 35 36 |
# File 'lib/emaildirect/campaign.rb', line 33 def all( = {}) response = EmailDirect.get '/Campaigns/All', :query => Hashie::Mash.new(response) end |
.create(name, creative_id, subject, from_name, publication_id, options = {}) ⇒ Object
38 39 40 41 42 |
# File 'lib/emaildirect/campaign.rb', line 38 def create(name, creative_id, subject, from_name, publication_id, = {}) .merge! :Name => name, :CreativeID => creative_id, :Subject => subject, :FromName => from_name, :PublicationID => publication_id response = EmailDirect.post '/Campaigns', :body => .to_json Hashie::Mash.new(response) end |
.drafts(options = {}) ⇒ Object
13 14 15 16 |
# File 'lib/emaildirect/campaign.rb', line 13 def drafts( = {}) response = EmailDirect.get '/Campaigns/Drafts', :query => Hashie::Mash.new(response) end |
.scheduled(options = {}) ⇒ Object
28 29 30 31 |
# File 'lib/emaildirect/campaign.rb', line 28 def scheduled( = {}) response = EmailDirect.get '/Campaigns/Scheduled', :query => Hashie::Mash.new(response) end |
.sending(options = {}) ⇒ Object
23 24 25 26 |
# File 'lib/emaildirect/campaign.rb', line 23 def sending( = {}) response = EmailDirect.get '/Campaigns/Sending', :query => Hashie::Mash.new(response) end |
.sent(options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/emaildirect/campaign.rb', line 18 def sent( = {}) response = EmailDirect.get '/Campaigns/Sent', :query => Hashie::Mash.new(response) end |
Instance Method Details
#cancel ⇒ Object
113 114 115 116 |
# File 'lib/emaildirect/campaign.rb', line 113 def cancel response = EmailDirect.post '/Campaigns/Cancel', :body => campaign_id.to_json Hashie::Mash.new(response) end |
#clicks(options = {}) ⇒ Object
76 77 78 79 |
# File 'lib/emaildirect/campaign.rb', line 76 def clicks( = {}) response = get 'Clicks', Hashie::Mash.new(response) end |
#complaints(options = {}) ⇒ Object
86 87 88 89 |
# File 'lib/emaildirect/campaign.rb', line 86 def complaints( = {}) response = get 'Complaints', Hashie::Mash.new(response) end |
#delete ⇒ Object
118 119 120 121 |
# File 'lib/emaildirect/campaign.rb', line 118 def delete response = EmailDirect.delete uri_for, {} Hashie::Mash.new(response) end |
#details ⇒ Object
51 52 53 54 |
# File 'lib/emaildirect/campaign.rb', line 51 def details response = get Hashie::Mash.new(response) end |
#hard_bounces(options = {}) ⇒ Object
96 97 98 99 |
# File 'lib/emaildirect/campaign.rb', line 96 def hard_bounces( = {}) response = get 'HardBounces', Hashie::Mash.new(response) end |
#links ⇒ Object
61 62 63 64 |
# File 'lib/emaildirect/campaign.rb', line 61 def links response = get 'Links' Hashie::Mash.new(response) end |
#message ⇒ Object
56 57 58 59 |
# File 'lib/emaildirect/campaign.rb', line 56 def response = get 'Email' Hashie::Mash.new(response) end |
#opens(options = {}) ⇒ Object
71 72 73 74 |
# File 'lib/emaildirect/campaign.rb', line 71 def opens( = {}) response = get 'Opens', Hashie::Mash.new(response) end |
#recipients(options = {}) ⇒ Object
66 67 68 69 |
# File 'lib/emaildirect/campaign.rb', line 66 def recipients( = {}) response = get 'Recipients', Hashie::Mash.new(response) end |
#removes(options = {}) ⇒ Object
81 82 83 84 |
# File 'lib/emaildirect/campaign.rb', line 81 def removes( = {}) response = get 'Removes', Hashie::Mash.new(response) end |
#schedule(schedule_date) ⇒ Object
107 108 109 110 111 |
# File 'lib/emaildirect/campaign.rb', line 107 def schedule(schedule_date) = { :CampaignID => campaign_id, :ScheduleDate => schedule_date.strftime('%FT%TZ') } response = EmailDirect.post '/Campaigns/Schedule', :body => .to_json Hashie::Mash.new(response) end |
#soft_bounces(options = {}) ⇒ Object
91 92 93 94 |
# File 'lib/emaildirect/campaign.rb', line 91 def soft_bounces( = {}) response = get 'SoftBounces', Hashie::Mash.new(response) end |
#update(name, creative_id, subject, from_name, publication_id, options = {}) ⇒ Object
101 102 103 104 105 |
# File 'lib/emaildirect/campaign.rb', line 101 def update(name, creative_id, subject, from_name, publication_id, = {}) .merge! :Name => name, :CreativeID => creative_id, :Subject => subject, :FromName => from_name, :PublicationID => publication_id response = EmailDirect.put uri_for, :body => .to_json Hashie::Mash.new(response) end |