lib/blurb/report.rb in blurb-0.2.2 vs lib/blurb/report.rb in blurb-0.2.3

- old
+ new

@@ -3,10 +3,11 @@ CAMPAIGNS = "campaigns" AD_GROUPS = "adGroups" KEYWORDS = "keywords" PRODUCT_ADS = "productAds" ASINS = "asins" + TARGETS = "targets" SPONSORED_PRODUCTS = "sp" SPONSORED_BRANDS = "hsa" def self.create(params = {}, opts = {}) # required argument checks @@ -27,11 +28,11 @@ api_params["campaignType"] = 'sponsoredProducts' if params["campaignType"] == SPONSORED_PRODUCTS raise ArgumentError.new("ASIN report is not supported for Sponsored Brands") if params["campaignType"] == SPONSORED_BRANDS else request_url = "/v2/#{params["campaignType"]}/#{params["recordType"]}/report" end - + post_request(request_url, api_params) end def self.status(report_id, opts = {}) get_request("/v2/reports/#{report_id}") @@ -235,9 +236,72 @@ "attributedSales1dSameSKU", "attributedSales7dSameSKU", "attributedSales14dSameSKU", "attributedSales30dSameSKU" ].join(",") if record_type == PRODUCT_ADS + return [ + "campaignName", + "campaignId", + "targetId", + "targetingExpression", + "targetingText", + "targetingType", + "impressions", + "clicks", + "cost", + "attributedConversions1d", + "attributedConversions7d", + "attributedConversions14d", + "attributedConversions30d", + "attributedConversions1dSameSKU", + "attributedConversions7dSameSKU", + "attributedConversions14dSameSKU", + "attributedConversions30dSameSKU", + "attributedUnitsOrdered1d", + "attributedUnitsOrdered7d", + "attributedUnitsOrdered14d", + "attributedUnitsOrdered30d", + "attributedSales1d", + "attributedSales7d", + "attributedSales14d", + "attributedSales30d", + "attributedSales1dSameSKU", + "attributedSales7dSameSKU", + "attributedSales14dSameSKU", + "attributedSales30dSameSKU" + ].join(",") if record_type == TARGETS + return [ + "campaignName", + "campaignId", + "adGroupName", + "adGroupId", + "impressions", + "clicks", + "cost", + "currency", + "asin", + "sku", + "attributedConversions1d", + "attributedConversions7d", + "attributedConversions14d", + "attributedConversions30d", + "attributedConversions1dSameSKU", + "attributedConversions7dSameSKU", + "attributedConversions14dSameSKU", + "attributedConversions30dSameSKU", + "attributedUnitsOrdered1d", + "attributedUnitsOrdered7d", + "attributedUnitsOrdered14d", + "attributedUnitsOrdered30d", + "attributedSales1d", + "attributedSales7d", + "attributedSales14d", + "attributedSales30d", + "attributedSales1dSameSKU", + "attributedSales7dSameSKU", + "attributedSales14dSameSKU", + "attributedSales30dSameSKU" + ].join(",") if record_type == PORTFOLIOS end end end end