Sha256: 9a01d448e1642fd42ab58a09734177ebe68c379e53d3b550e86b3d85ebb3d13a

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

module Blurb
  class SuggestedKeyword < BaseResource
    URL_PARAMS = ['maxNumSuggestions', 'adStateFilter', 'suggestBids']

    def ad_group_suggestions(params = {}, opts = {})
      # required argument checks
      raise ArgumentError.new("params hash must contain an adGroupId") unless params["adGroupId"]

      get_request("/v2/adGroups/#{params["adGroupId"]}/suggested/keywords?#{setup_url_params(params, URL_PARAMS)}")
    end

    def ad_group_extended_suggestions(params = {}, opts = {})
      # required argument checks
      raise ArgumentError.new("params hash must contain an adGroupId") unless params["adGroupId"]

      get_request("/v2/adGroups/#{params["adGroupId"]}/suggested/keywords/extended?#{setup_url_params(params, URL_PARAMS)}")
    end

    def asin_suggestions(params = {}, opts = {})
      # required argument checks
      raise ArgumentError.new("params hash must contain an asinValue") unless params["asinValue"]

      get_request("/v2/asins/#{params["asinValue"]}/suggested/keywords?#{setup_url_params(params, URL_PARAMS)}")
    end

    def bulk_asin_suggestions(params = {}, opts = {})
      # required argument checks
      raise ArgumentError.new("params hash must contain an asins array") unless params["asins"]

      maxNumSuggestions = 100
      maxNumSuggestions = params["maxNumSuggestions"] if params["maxNumSuggestions"]

      post_request("/v2/asins/suggested/keywords", {
        "asins" => params["asins"],
        "maxNumSuggestions" => maxNumSuggestions
      })
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blurb-0.3.2 lib/blurb/suggested_keyword.rb
blurb-0.3.1 lib/blurb/suggested_keyword.rb