Class: MaropostApi::AbTestCampaigns
- Inherits:
-
Object
- Object
- MaropostApi::AbTestCampaigns
- Defined in:
- lib/maropost_api/ab_test_campaigns.rb
Instance Method Summary collapse
- #create_ab_test(name:, from_email:, address:, language:, campaign_groups_attributes:, commit:, sendAt:, brand_id: nil, suppressed_list_ids: [], suppressed_journey_ids: [], suppressed_segment_ids: [], email_preview_link: nil, decided_by: nil, lists: [], ctags: [], segments: []) ⇒ Object
-
#initialize(account = ENV["ACCOUNT"], api_key = ENV["API_KEY"]) ⇒ AbTestCampaigns
constructor
A new instance of AbTestCampaigns.
Constructor Details
#initialize(account = ENV["ACCOUNT"], api_key = ENV["API_KEY"]) ⇒ AbTestCampaigns
Returns a new instance of AbTestCampaigns.
5 6 7 8 |
# File 'lib/maropost_api/ab_test_campaigns.rb', line 5 def initialize(account = ENV["ACCOUNT"], api_key = ENV["API_KEY"]) MaropostApi.instance_variable_set(:@api_key, api_key) MaropostApi.instance_variable_set(:@account, account) end |
Instance Method Details
#create_ab_test(name:, from_email:, address:, language:, campaign_groups_attributes:, commit:, sendAt:, brand_id: nil, suppressed_list_ids: [], suppressed_journey_ids: [], suppressed_segment_ids: [], email_preview_link: nil, decided_by: nil, lists: [], ctags: [], segments: []) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/maropost_api/ab_test_campaigns.rb', line 10 def create_ab_test( name:, from_email:, address:, language:, campaign_groups_attributes:, commit:, sendAt:, brand_id: nil, suppressed_list_ids: [], suppressed_journey_ids: [], suppressed_segment_ids: [], email_preview_link: nil, decided_by: nil, lists: [], ctags: [], segments: [] ) args = method(__method__).parameters body = {:ab_test => {}} args.each do |arg| k = arg[1].to_s v = eval(k) body[:ab_test][k] = v unless v.nil? end full_path = full_resource_path('/ab_test') MaropostApi.post_result(full_path, :body => {campaign: body[:ab_test]}) end |