amazon-ads 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +38 -18
- data/lib/amazon_ads/api.rb +52 -100
- data/lib/amazon_ads/apis/ad_associations.rb +29 -0
- data/lib/amazon_ads/apis/ad_extensions.rb +23 -0
- data/lib/amazon_ads/apis/ad_groups.rb +29 -0
- data/lib/amazon_ads/apis/ads.rb +29 -0
- data/lib/amazon_ads/apis/advertising_deal_targets.rb +23 -0
- data/lib/amazon_ads/apis/advertising_deals.rb +29 -0
- data/lib/amazon_ads/apis/brand_store_edition_publish_versions.rb +17 -0
- data/lib/amazon_ads/apis/brand_store_editions.rb +11 -0
- data/lib/amazon_ads/apis/brand_store_pages.rb +11 -0
- data/lib/amazon_ads/apis/brand_stores.rb +11 -0
- data/lib/amazon_ads/apis/branded_keywords_pricings.rb +11 -0
- data/lib/amazon_ads/apis/campaign_forecasts.rb +11 -0
- data/lib/amazon_ads/apis/campaigns.rb +29 -0
- data/lib/amazon_ads/apis/commitment_spends.rb +11 -0
- data/lib/amazon_ads/apis/commitments.rb +29 -0
- data/lib/amazon_ads/apis/keyword_reservation_validations.rb +11 -0
- data/lib/amazon_ads/apis/marketing_stream.rb +72 -0
- data/lib/amazon_ads/apis/profiles.rb +15 -15
- data/lib/amazon_ads/apis/recommendation_types.rb +11 -0
- data/lib/amazon_ads/apis/recommendations.rb +11 -0
- data/lib/amazon_ads/apis/reporting.rb +29 -0
- data/lib/amazon_ads/apis/targets.rb +29 -0
- data/lib/amazon_ads/lwa.rb +35 -60
- data/lib/amazon_ads/version.rb +1 -1
- data/lib/amazon_ads.rb +31 -22
- metadata +41 -18
- data/lib/amazon_ads/apis/sponsored_products.rb +0 -76
- data/lib/amazon_ads/client.rb +0 -38
- data/lib/amazon_ads/configuration.rb +0 -34
- data/lib/amazon_ads/errors.rb +0 -43
- data/sig/generated/amazon_ads/api.rbs +0 -61
- data/sig/generated/amazon_ads/apis/profiles.rbs +0 -20
- data/sig/generated/amazon_ads/apis/sponsored_products.rbs +0 -52
- data/sig/generated/amazon_ads/client.rbs +0 -28
- data/sig/generated/amazon_ads/configuration.rbs +0 -24
- data/sig/generated/amazon_ads/errors.rbs +0 -35
- data/sig/generated/amazon_ads/lwa.rbs +0 -39
- data/sig/generated/amazon_ads.rbs +0 -16
data/lib/amazon_ads/errors.rb
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# rbs_inline: enabled
|
|
4
|
-
|
|
5
|
-
module AmazonAds
|
|
6
|
-
# Base error class for AmazonAds API errors
|
|
7
|
-
class Error < StandardError
|
|
8
|
-
attr_reader :response #: HTTP::Response?
|
|
9
|
-
|
|
10
|
-
#: (?String?, ?response: HTTP::Response?) -> void
|
|
11
|
-
def initialize(message = nil, response: nil)
|
|
12
|
-
@response = response
|
|
13
|
-
super(message)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# Raised when authentication fails (401 Unauthorized)
|
|
18
|
-
class AuthenticationError < Error
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# Raised when rate limited (429 Too Many Requests)
|
|
22
|
-
class RateLimitError < Error
|
|
23
|
-
attr_reader :retry_after #: Integer?
|
|
24
|
-
|
|
25
|
-
#: (?String?, ?response: HTTP::Response?, ?retry_after: Integer?) -> void
|
|
26
|
-
def initialize(message = nil, response: nil, retry_after: nil)
|
|
27
|
-
@retry_after = retry_after
|
|
28
|
-
super(message, response: response)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# Raised when resource not found (404 Not Found)
|
|
33
|
-
class NotFoundError < Error
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# Raised when request is invalid (400 Bad Request)
|
|
37
|
-
class BadRequestError < Error
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Raised when server error occurs (5xx)
|
|
41
|
-
class ServerError < Error
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# Generated from lib/amazon_ads/api.rb with RBS::Inline
|
|
2
|
-
|
|
3
|
-
module AmazonAds
|
|
4
|
-
# Base class for Amazon Ads API clients.
|
|
5
|
-
# Handles authentication, response parsing, error mapping, and retry logic.
|
|
6
|
-
class API
|
|
7
|
-
ENDPOINTS: untyped
|
|
8
|
-
|
|
9
|
-
MAX_RETRIES: Integer
|
|
10
|
-
|
|
11
|
-
BASE_RETRY_DELAY: Integer
|
|
12
|
-
|
|
13
|
-
attr_reader region: Symbol
|
|
14
|
-
|
|
15
|
-
attr_reader profile_id: String?
|
|
16
|
-
|
|
17
|
-
# : (region: Symbol, ?access_token: String?, ?lwa: LWA?, ?profile_id: String?) -> void
|
|
18
|
-
def initialize: (region: Symbol, ?access_token: String?, ?lwa: LWA?, ?profile_id: String?) -> void
|
|
19
|
-
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
-
# Returns the current access token, refreshing via LWA if needed.
|
|
23
|
-
# : () -> String
|
|
24
|
-
def access_token: () -> String
|
|
25
|
-
|
|
26
|
-
# : () -> HTTP::Client
|
|
27
|
-
def http: () -> HTTP::Client
|
|
28
|
-
|
|
29
|
-
# : () -> Hash[String, String]
|
|
30
|
-
def default_headers: () -> Hash[String, String]
|
|
31
|
-
|
|
32
|
-
# : () -> String
|
|
33
|
-
def client_id: () -> String
|
|
34
|
-
|
|
35
|
-
# : () -> String
|
|
36
|
-
def endpoint: () -> String
|
|
37
|
-
|
|
38
|
-
# Handles HTTP response, raising appropriate errors or parsing success responses.
|
|
39
|
-
# : (HTTP::Response) -> untyped
|
|
40
|
-
def handle_response: (HTTP::Response) -> untyped
|
|
41
|
-
|
|
42
|
-
# Executes request with retry logic for rate limiting.
|
|
43
|
-
# : () { () -> HTTP::Response } -> untyped
|
|
44
|
-
def with_retry: () { () -> HTTP::Response } -> untyped
|
|
45
|
-
|
|
46
|
-
# : (String, ?params: Hash[String, untyped]) -> untyped
|
|
47
|
-
def get: (String, ?params: Hash[String, untyped]) -> untyped
|
|
48
|
-
|
|
49
|
-
# : (String, ?body: Hash[String, untyped]) -> untyped
|
|
50
|
-
def post: (String, ?body: Hash[String, untyped]) -> untyped
|
|
51
|
-
|
|
52
|
-
# : (String, ?body: Hash[String, untyped]) -> untyped
|
|
53
|
-
def put: (String, ?body: Hash[String, untyped]) -> untyped
|
|
54
|
-
|
|
55
|
-
# : (String, ?body: Hash[String, untyped]) -> untyped
|
|
56
|
-
def patch: (String, ?body: Hash[String, untyped]) -> untyped
|
|
57
|
-
|
|
58
|
-
# : (String) -> untyped
|
|
59
|
-
def delete: (String) -> untyped
|
|
60
|
-
end
|
|
61
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Generated from lib/amazon_ads/apis/profiles.rb with RBS::Inline
|
|
2
|
-
|
|
3
|
-
module AmazonAds
|
|
4
|
-
# Amazon Ads API - Profiles
|
|
5
|
-
#
|
|
6
|
-
# @see https://advertising.amazon.com/API/docs/en-us/reference/profiles
|
|
7
|
-
class Profiles < API
|
|
8
|
-
# Gets a list of profiles.
|
|
9
|
-
# : (?api_program: String?, ?access_level: String?, ?profile_type_filter: String?, ?valid_payment_method_filter: String?) -> untyped
|
|
10
|
-
def list_profiles: (?api_program: String?, ?access_level: String?, ?profile_type_filter: String?, ?valid_payment_method_filter: String?) -> untyped
|
|
11
|
-
|
|
12
|
-
# Update the daily budget for one or more profiles.
|
|
13
|
-
# : (?body: Hash[String, untyped]) -> untyped
|
|
14
|
-
def update_profiles: (?body: Hash[String, untyped]) -> untyped
|
|
15
|
-
|
|
16
|
-
# Gets a profile specified by identifier.
|
|
17
|
-
# : (Integer) -> untyped
|
|
18
|
-
def get_profile_by_id: (Integer) -> untyped
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Generated from lib/amazon_ads/apis/sponsored_products.rb with RBS::Inline
|
|
2
|
-
|
|
3
|
-
module AmazonAds
|
|
4
|
-
# Amazon Ads API - Sponsored Products
|
|
5
|
-
#
|
|
6
|
-
# @see https://advertising.amazon.com/API/docs/en-us/sponsored-products
|
|
7
|
-
class SponsoredProducts < API
|
|
8
|
-
# Gets a bid recommendation for an ad group. [PLANNED DEPRECATION 3/27/2024]
|
|
9
|
-
# : (Numeric) -> untyped
|
|
10
|
-
def get_ad_group_bid_recommendations: (Numeric) -> untyped
|
|
11
|
-
|
|
12
|
-
# Gets a bid recommendation for a keyword. [PLANNED DEPRECATION 3/27/2024]
|
|
13
|
-
# : (Numeric) -> untyped
|
|
14
|
-
def get_keyword_bid_recommendations: (Numeric) -> untyped
|
|
15
|
-
|
|
16
|
-
# Gets bid recommendations for keywords. [PLANNED DEPRECATION 3/27/2024]
|
|
17
|
-
# : (?body: Hash[String, untyped]) -> untyped
|
|
18
|
-
def create_keyword_bid_recommendations: (?body: Hash[String, untyped]) -> untyped
|
|
19
|
-
|
|
20
|
-
# Gets suggested keywords for the specified ad group.
|
|
21
|
-
# : (Numeric, ?max_num_suggestions: Integer?, ?ad_state_filter: String?) -> untyped
|
|
22
|
-
def get_ad_group_suggested_keywords: (Numeric, ?max_num_suggestions: Integer?, ?ad_state_filter: String?) -> untyped
|
|
23
|
-
|
|
24
|
-
# Gets suggested keywords with extended data for the specified ad group.
|
|
25
|
-
# : (Numeric, ?max_num_suggestions: Integer?, ?suggest_bids: String?, ?ad_state_filter: String?) -> untyped
|
|
26
|
-
def get_ad_group_suggested_keywords_ex: (Numeric, ?max_num_suggestions: Integer?, ?suggest_bids: String?, ?ad_state_filter: String?) -> untyped
|
|
27
|
-
|
|
28
|
-
# Gets suggested keywords for the specified ASIN.
|
|
29
|
-
# : (String, ?max_num_suggestions: Integer?) -> untyped
|
|
30
|
-
def get_asin_suggested_keywords: (String, ?max_num_suggestions: Integer?) -> untyped
|
|
31
|
-
|
|
32
|
-
# Gets suggested keyword for a specified list of ASINs.
|
|
33
|
-
# : (?body: Hash[String, untyped]) -> untyped
|
|
34
|
-
def bulk_get_asin_suggested_keywords: (?body: Hash[String, untyped]) -> untyped
|
|
35
|
-
|
|
36
|
-
# Gets a list of bid recommendations for keyword, product, or auto targeting expressions.
|
|
37
|
-
# : (?body: Hash[String, untyped]) -> untyped
|
|
38
|
-
def get_bid_recommendations: (?body: Hash[String, untyped]) -> untyped
|
|
39
|
-
|
|
40
|
-
# Request a snapshot
|
|
41
|
-
# : (String, ?body: Hash[String, untyped]) -> untyped
|
|
42
|
-
def request_snapshot: (String, ?body: Hash[String, untyped]) -> untyped
|
|
43
|
-
|
|
44
|
-
# Get the status of a requested snapshot
|
|
45
|
-
# : (Numeric) -> untyped
|
|
46
|
-
def get_snapshot_status: (Numeric) -> untyped
|
|
47
|
-
|
|
48
|
-
# Download requested snapshot
|
|
49
|
-
# : (Numeric) -> untyped
|
|
50
|
-
def download_snapshot: (Numeric) -> untyped
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Generated from lib/amazon_ads/client.rb with RBS::Inline
|
|
2
|
-
|
|
3
|
-
module AmazonAds
|
|
4
|
-
# High-level client for Amazon Ads API.
|
|
5
|
-
# Provides convenient access to all API endpoints with automatic authentication.
|
|
6
|
-
class Client
|
|
7
|
-
attr_reader lwa: LWA
|
|
8
|
-
|
|
9
|
-
attr_reader region: Symbol
|
|
10
|
-
|
|
11
|
-
attr_reader profile_id: String?
|
|
12
|
-
|
|
13
|
-
# : (?region: Symbol, ?profile_id: String?, ?lwa: LWA?) -> void
|
|
14
|
-
def initialize: (?region: Symbol, ?profile_id: String?, ?lwa: LWA?) -> void
|
|
15
|
-
|
|
16
|
-
# Access Profiles API
|
|
17
|
-
# : () -> Profiles
|
|
18
|
-
def profiles: () -> Profiles
|
|
19
|
-
|
|
20
|
-
# Access Sponsored Products API
|
|
21
|
-
# : () -> SponsoredProducts
|
|
22
|
-
def sponsored_products: () -> SponsoredProducts
|
|
23
|
-
|
|
24
|
-
# Creates a new client with a different profile ID
|
|
25
|
-
# : (String) -> Client
|
|
26
|
-
def with_profile: (String) -> Client
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Generated from lib/amazon_ads/configuration.rb with RBS::Inline
|
|
2
|
-
|
|
3
|
-
module AmazonAds
|
|
4
|
-
# Configuration for the AmazonAds library.
|
|
5
|
-
# Centralizes settings for authentication and API access.
|
|
6
|
-
class Configuration
|
|
7
|
-
attr_accessor client_id: String?
|
|
8
|
-
|
|
9
|
-
attr_accessor client_secret: String?
|
|
10
|
-
|
|
11
|
-
attr_accessor refresh_token: String?
|
|
12
|
-
|
|
13
|
-
attr_accessor region: Symbol
|
|
14
|
-
|
|
15
|
-
attr_accessor profile_id: String?
|
|
16
|
-
|
|
17
|
-
# : () -> void
|
|
18
|
-
def initialize: () -> void
|
|
19
|
-
|
|
20
|
-
# Builds an LWA instance from the configuration.
|
|
21
|
-
# : () -> LWA
|
|
22
|
-
def lwa: () -> LWA
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Generated from lib/amazon_ads/errors.rb with RBS::Inline
|
|
2
|
-
|
|
3
|
-
module AmazonAds
|
|
4
|
-
# Base error class for AmazonAds API errors
|
|
5
|
-
class Error < StandardError
|
|
6
|
-
attr_reader response: HTTP::Response?
|
|
7
|
-
|
|
8
|
-
# : (?String?, ?response: HTTP::Response?) -> void
|
|
9
|
-
def initialize: (?String?, ?response: HTTP::Response?) -> void
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# Raised when authentication fails (401 Unauthorized)
|
|
13
|
-
class AuthenticationError < Error
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Raised when rate limited (429 Too Many Requests)
|
|
17
|
-
class RateLimitError < Error
|
|
18
|
-
attr_reader retry_after: Integer?
|
|
19
|
-
|
|
20
|
-
# : (?String?, ?response: HTTP::Response?, ?retry_after: Integer?) -> void
|
|
21
|
-
def initialize: (?String?, ?response: HTTP::Response?, ?retry_after: Integer?) -> void
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Raised when resource not found (404 Not Found)
|
|
25
|
-
class NotFoundError < Error
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Raised when request is invalid (400 Bad Request)
|
|
29
|
-
class BadRequestError < Error
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# Raised when server error occurs (5xx)
|
|
33
|
-
class ServerError < Error
|
|
34
|
-
end
|
|
35
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Generated from lib/amazon_ads/lwa.rb with RBS::Inline
|
|
2
|
-
|
|
3
|
-
module AmazonAds
|
|
4
|
-
# Requests Login with Amazon (LWA) access tokens for the Amazon Ads API.
|
|
5
|
-
# Handles token caching and automatic refresh when tokens expire.
|
|
6
|
-
#
|
|
7
|
-
# @see https://advertising.amazon.com/API/docs/en-us/info/api-overview
|
|
8
|
-
class LWA
|
|
9
|
-
URL: String
|
|
10
|
-
|
|
11
|
-
TOKEN_EXPIRY_BUFFER: Integer
|
|
12
|
-
|
|
13
|
-
attr_reader client_id: String
|
|
14
|
-
|
|
15
|
-
attr_reader client_secret: String
|
|
16
|
-
|
|
17
|
-
attr_reader refresh_token: String
|
|
18
|
-
|
|
19
|
-
# : (?client_id: String, ?client_secret: String, ?refresh_token: String) -> void
|
|
20
|
-
def initialize: (?client_id: String, ?client_secret: String, ?refresh_token: String) -> void
|
|
21
|
-
|
|
22
|
-
# Returns a valid access token, refreshing if necessary.
|
|
23
|
-
# : () -> String
|
|
24
|
-
def access_token: () -> String
|
|
25
|
-
|
|
26
|
-
# Forces a token refresh regardless of expiry.
|
|
27
|
-
# : () -> String
|
|
28
|
-
def refresh!: () -> String
|
|
29
|
-
|
|
30
|
-
# Returns true if the token is expired or not yet fetched.
|
|
31
|
-
# : () -> bool
|
|
32
|
-
def token_expired?: () -> bool
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
# : () -> Hash[String, String]
|
|
37
|
-
def params: () -> Hash[String, String]
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Generated from lib/amazon_ads.rb with RBS::Inline
|
|
2
|
-
|
|
3
|
-
# Amazon Ads API client for Ruby
|
|
4
|
-
module AmazonAds
|
|
5
|
-
# Returns the global configuration object.
|
|
6
|
-
# : () -> Configuration
|
|
7
|
-
def self.configuration: () -> Configuration
|
|
8
|
-
|
|
9
|
-
# Configures the AmazonAds library.
|
|
10
|
-
# : () { (Configuration) -> void } -> void
|
|
11
|
-
def self.configure: () { (Configuration) -> void } -> void
|
|
12
|
-
|
|
13
|
-
# Resets the configuration to defaults.
|
|
14
|
-
# : () -> void
|
|
15
|
-
def self.reset_configuration!: () -> void
|
|
16
|
-
end
|