Class: AmazonAds::LocationIndexes

Inherits:
API
  • Object
show all
Defined in:
lib/amazon_ads/apis/location_indexes.rb

Constant Summary

Constants inherited from API

API::ENDPOINTS

Instance Attribute Summary

Attributes inherited from API

#access_token, #account_id, #profile_id, #region, #retries

Instance Method Summary collapse

Methods inherited from API

#endpoint, #http, #initialize

Constructor Details

This class inherits a constructor from AmazonAds::API

Instance Method Details

#create_location_index(location_indexes:) ⇒ Object

Create a Smart Location Index. A Smart Location Index is a named dataset that maps postal codes to index values representing relative audience quality or sales potential for a given advertiser. Index data is processed asynchronously; the index status will transition from PENDING to ENABLED once processing is complete.

Signature:

  • (location_indexes: Array[untyped]) -> HTTP::Response



7
8
9
# File 'lib/amazon_ads/apis/location_indexes.rb', line 7

def create_location_index(location_indexes:)
  request(:post, "/adsApi/v1/create/locationIndexes", json: { "locationIndexes" => location_indexes }.compact)
end

#list_location_index(next_token: nil, max_results: nil) ⇒ Object

List all Smart Location Indexes for the authenticated advertiser. Returns a paginated collection of indexes including their current processing status. Use the nextToken from the response to retrieve subsequent pages.

Signature:

  • (?next_token: String?, ?max_results: Integer?) -> HTTP::Response



13
14
15
# File 'lib/amazon_ads/apis/location_indexes.rb', line 13

def list_location_index(next_token: nil, max_results: nil)
  request(:get, "/adsApi/v1/locationIndexes", params: { "nextToken" => next_token, "maxResults" => max_results }.compact)
end

#retrieve_location_index(index_ids:) ⇒ Object

Retrieve one or more Smart Location Indexes by ID. Returns the current metadata and processing status for each requested index. An index with status PENDING is still being processed and is not yet available for use in smart location targeting.

Signature:

  • (index_ids: Array[untyped]) -> HTTP::Response



19
20
21
# File 'lib/amazon_ads/apis/location_indexes.rb', line 19

def retrieve_location_index(index_ids:)
  request(:post, "/adsApi/v1/retrieve/locationIndexes", json: { "indexIds" => index_ids }.compact)
end

#update_location_index(location_indexes:) ⇒ Object

Update the data for an existing Smart Location Index. Replaces the index's postal code values with the provided dataset. The update is processed asynchronously; the index status will return to PENDING until the new data has been fully processed.

Signature:

  • (location_indexes: Array[untyped]) -> HTTP::Response



25
26
27
# File 'lib/amazon_ads/apis/location_indexes.rb', line 25

def update_location_index(location_indexes:)
  request(:post, "/adsApi/v1/update/locationIndexes", json: { "locationIndexes" => location_indexes }.compact)
end