Sha256: 35253e55dfb4dd356ce24d94e70bd15f0c8f41b392f50c98eb739b9b160e2152

Contents?: true

Size: 883 Bytes

Versions: 3

Compression:

Stored size: 883 Bytes

Contents

module Blurb
  class Snapshot < BaseResource
    CAMPAIGNS = "campaigns"
    AD_GROUPS = "adGroups"
    KEYWORDS = "keywords"
    NEGATIVE_KEYWORDS = "negativeKeywords"
    CAMPAIGN_NEGATIVE_KEYWORDS = "campaignNegativeKeywords"
    PRODUCT_ADS = "productAds"

    def self.create(params = {}, opts = {})
      # required argument checks
      raise ArgumentError.new("params hash must contain a recordType") unless params["recordType"]

      post_request("/v2/#{params["recordType"]}/snapshot", {
        "campaignType" => "sponsoredProducts",
        "stateFilter" => params["stateFilter"]
      })
    end

    def self.status(snapshot_id, opts = {})
      get_request("/v2/snapshots/#{snapshot_id}")
    end

    def self.download(location, opts = {})
      opts.merge!({:full_path => true, :gzip => true, :no_token => true})
      get_request(location, opts)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blurb-0.2.2 lib/blurb/snapshot.rb
blurb-0.2.1 lib/blurb/snapshot.rb
blurb-0.2.0 lib/blurb/snapshot.rb