Sha256: d5c3aa2fbecf1de4f022f54d06efe78d9931ddaa05b97ffa08dea1148d3b9a2c

Contents?: true

Size: 712 Bytes

Versions: 8

Compression:

Stored size: 712 Bytes

Contents

require 'blurb/request_collection_with_campaign_type'

class Blurb
  class CampaignRequests < RequestCollectionWithCampaignType
    def create_bulk(create_array)
      create_array = map_campaign_payload(create_array)
      super(create_array)
    end

    def update_bulk(update_array)
      update_array = map_campaign_payload(update_array)
      super(update_array)
    end

    private

      def map_campaign_payload(payload)
        campaign_type_string = "sponsoredProducts" if @campaign_type == CAMPAIGN_TYPE_CODES[:sp]
        campaign_type_string = "sponsoredBrands" if @campaign_type == CAMPAIGN_TYPE_CODES[:sb]
        payload.each{ |p| p[:campaign_type] = campaign_type_string }
      end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
blurb-0.4.12 lib/blurb/campaign_requests.rb
blurb-0.4.7 lib/blurb/campaign_requests.rb
blurb-0.4.6 lib/blurb/campaign_requests.rb
blurb-0.4.5 lib/blurb/campaign_requests.rb
blurb-0.4.4 lib/blurb/campaign_requests.rb
blurb-0.4.2 lib/blurb/campaign_requests.rb
blurb-0.4.1 lib/blurb/campaign_requests.rb
blurb-0.4.0 lib/blurb/campaign_requests.rb