lib/blurb/report_requests.rb in blurb-0.5.1 vs lib/blurb/report_requests.rb in blurb-0.5.2

- old
+ new

@@ -15,11 +15,11 @@ report_date: Date.today, metrics: nil, segment: nil ) # create payload - metrics = get_default_metrics(record_type.to_s.underscore.to_sym) if metrics.nil? + metrics = get_default_metrics(record_type.to_s.underscore.to_sym, segment) if metrics.nil? payload = { metrics: metrics.map{ |m| m.to_s.camelize(:lower) }.join(","), report_date: report_date } payload[:segment] = segment if segment @@ -46,11 +46,11 @@ ) end private - def get_default_metrics(record_type) + def get_default_metrics(record_type, segment = nil) if @campaign_type == CAMPAIGN_TYPE_CODES[:sb] return [ "campaignId", "impressions", "clicks", @@ -80,10 +80,19 @@ "cost", "attributedSales14d", "attributedSales14dSameSKU", "attributedConversions14d", "attributedConversions14dSameSKU" - ] if record_type == :keywords + ] if record_type == :keywords && segment.nil? + return [ + "adGroupId", + "campaignId", + "impressions", + "clicks", + "cost", + "attributedSales14d", + "attributedConversions14d", + ] if record_type == :keywords && segment.present? elsif @campaign_type == CAMPAIGN_TYPE_CODES[:sp] return [ "campaignId", "impressions", "clicks",