Sha256: 28d5d2236b06322d0df873da8658773233f8db0de823ba8e7a43417449df9246

Contents?: true

Size: 790 Bytes

Versions: 5

Compression:

Stored size: 790 Bytes

Contents

# -*- encoding: utf-8 -*-
$LOAD_PATH.unshift File.dirname(__FILE__)

module SendGrid4r
  module Factory
    #
    # SendGrid Web API v3 Campaign Factory Class implementation
    #
    class CampaignFactory
      def create(title: nil, subject: nil, sender_id: nil, list_ids: nil,
        segment_ids: nil, categories: nil, suppression_group_id: nil,
        html_content: nil, plain_content: nil)
        segment = SendGrid4r::REST::Campaigns::Campaigns::Campaign.new(
          nil, title, subject, sender_id, list_ids, segment_ids, categories,
          suppression_group_id, html_content, plain_content, nil, nil
        )
        hash = segment.to_h
        segment.to_h.each do |key, value|
          hash.delete(key) if value.nil?
        end
        hash
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sendgrid4r-1.5.0 lib/sendgrid4r/factory/campaign_factory.rb
sendgrid4r-1.4.0 lib/sendgrid4r/factory/campaign_factory.rb
sendgrid4r-1.3.0 lib/sendgrid4r/factory/campaign_factory.rb
sendgrid4r-1.2.1 lib/sendgrid4r/factory/campaign_factory.rb
sendgrid4r-1.2.0 lib/sendgrid4r/factory/campaign_factory.rb