amazon-ads 0.1.0 → 0.2.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 +49 -16
- data/lib/amazon_ads/api.rb +47 -97
- data/lib/amazon_ads/apis/ad_associations.rb +30 -0
- data/lib/amazon_ads/apis/ad_extensions.rb +24 -0
- data/lib/amazon_ads/apis/ad_groups.rb +30 -0
- data/lib/amazon_ads/apis/ads.rb +30 -0
- data/lib/amazon_ads/apis/advertising_deal_targets.rb +24 -0
- data/lib/amazon_ads/apis/advertising_deals.rb +30 -0
- data/lib/amazon_ads/apis/brand_store_edition_publish_versions.rb +18 -0
- data/lib/amazon_ads/apis/brand_store_editions.rb +12 -0
- data/lib/amazon_ads/apis/brand_store_pages.rb +12 -0
- data/lib/amazon_ads/apis/brand_stores.rb +12 -0
- data/lib/amazon_ads/apis/branded_keywords_pricings.rb +12 -0
- data/lib/amazon_ads/apis/campaign_forecasts.rb +12 -0
- data/lib/amazon_ads/apis/campaigns.rb +30 -0
- data/lib/amazon_ads/apis/commitment_spends.rb +12 -0
- data/lib/amazon_ads/apis/commitments.rb +30 -0
- data/lib/amazon_ads/apis/keyword_reservation_validations.rb +12 -0
- data/lib/amazon_ads/apis/marketing_stream.rb +73 -0
- data/lib/amazon_ads/apis/profiles.rb +15 -14
- data/lib/amazon_ads/apis/recommendation_types.rb +12 -0
- data/lib/amazon_ads/apis/recommendations.rb +12 -0
- data/lib/amazon_ads/apis/reporting.rb +30 -0
- data/lib/amazon_ads/apis/targets.rb +30 -0
- data/lib/amazon_ads/lwa.rb +36 -57
- data/lib/amazon_ads/version.rb +1 -1
- data/lib/amazon_ads.rb +28 -15
- data/sig/generated/amazon_ads/api.rbs +20 -38
- data/sig/generated/amazon_ads/apis/ad_associations.rbs +21 -0
- data/sig/generated/amazon_ads/apis/ad_extensions.rbs +17 -0
- data/sig/generated/amazon_ads/apis/ad_groups.rbs +21 -0
- data/sig/generated/amazon_ads/apis/ads.rbs +21 -0
- data/sig/generated/amazon_ads/apis/advertising_deal_targets.rbs +17 -0
- data/sig/generated/amazon_ads/apis/advertising_deals.rbs +21 -0
- data/sig/generated/amazon_ads/apis/brand_store_edition_publish_versions.rbs +13 -0
- data/sig/generated/amazon_ads/apis/brand_store_editions.rbs +9 -0
- data/sig/generated/amazon_ads/apis/brand_store_pages.rbs +9 -0
- data/sig/generated/amazon_ads/apis/brand_stores.rbs +9 -0
- data/sig/generated/amazon_ads/apis/branded_keywords_pricings.rbs +9 -0
- data/sig/generated/amazon_ads/apis/campaign_forecasts.rbs +9 -0
- data/sig/generated/amazon_ads/apis/campaigns.rbs +21 -0
- data/sig/generated/amazon_ads/apis/commitment_spends.rbs +9 -0
- data/sig/generated/amazon_ads/apis/commitments.rbs +21 -0
- data/sig/generated/amazon_ads/apis/keyword_reservation_validations.rbs +9 -0
- data/sig/generated/amazon_ads/apis/marketing_stream.rbs +56 -0
- data/sig/generated/amazon_ads/apis/profiles.rbs +12 -10
- data/sig/generated/amazon_ads/apis/recommendation_types.rbs +9 -0
- data/sig/generated/amazon_ads/apis/recommendations.rbs +9 -0
- data/sig/generated/amazon_ads/apis/reporting.rbs +23 -0
- data/sig/generated/amazon_ads/apis/streams.rbs +40 -0
- data/sig/generated/amazon_ads/apis/targets.rbs +21 -0
- data/sig/generated/amazon_ads/lwa.rbs +21 -23
- data/sig/generated/amazon_ads.rbs +23 -9
- metadata +59 -9
- 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/client.rbs +0 -28
- data/sig/generated/amazon_ads/configuration.rbs +0 -24
- data/sig/generated/amazon_ads/errors.rbs +0 -35
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 576fb2a70351a890db1f8792fb65fca433b06f9aa33ce4b037b674b2bcc8beff
|
|
4
|
+
data.tar.gz: 4326197b234cd8917b176645c7732a9ab77e66fc1fe79173907b7ff2c1640381
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dac34993c1d5100be01ded6aedaf59bc6819bae76fb18817eff7839a43723468e1d54419f9ae4ba0b7cf8bb4cd53bd85a5a98cc6891b8804c9350728d167fc0c
|
|
7
|
+
data.tar.gz: 2f2de968113e103e2422b61687b1e01b10962c628c188d60e3c0dabc69895814bb216013e35744a8f17551b515f832179ed1a6e5c563ecbc5b74dd7ec66aa592
|
data/README.md
CHANGED
|
@@ -1,39 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Amazon Ads
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sponsor`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
3
|
+
A Ruby client for the [Amazon Ads API](https://advertising.amazon.com/API/docs/en-us).
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
Add to your Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem "amazon-ads"
|
|
11
|
+
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Or install directly:
|
|
12
14
|
|
|
13
15
|
```bash
|
|
14
|
-
|
|
16
|
+
gem install amazon-ads
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
## Configuration
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
Set your app credentials at the module level or via environment variables:
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
AmazonAds.client_id = "your_client_id"
|
|
25
|
+
AmazonAds.client_secret = "your_client_secret"
|
|
21
26
|
```
|
|
22
27
|
|
|
28
|
+
Or set `AMAZON_ADS_CLIENT_ID` and `AMAZON_ADS_CLIENT_SECRET`.
|
|
29
|
+
|
|
23
30
|
## Usage
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
Request an access token via Login with Amazon (LWA):
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
```ruby
|
|
35
|
+
data = AmazonAds::LWA.request(refresh_token: "your_refresh_token")
|
|
36
|
+
access_token = data.fetch("access_token")
|
|
37
|
+
```
|
|
28
38
|
|
|
29
|
-
|
|
39
|
+
The caller owns token caching. Store and reuse the token until it expires.
|
|
30
40
|
|
|
31
|
-
|
|
41
|
+
Make requests:
|
|
42
|
+
|
|
43
|
+
```ruby
|
|
44
|
+
# List advertising profiles
|
|
45
|
+
profiles = AmazonAds::Profiles.new(region: :na, access_token: access_token)
|
|
46
|
+
profiles.list_profiles
|
|
47
|
+
|
|
48
|
+
# List campaigns under a profile
|
|
49
|
+
campaigns = AmazonAds::Campaigns.new(
|
|
50
|
+
region: :na,
|
|
51
|
+
access_token: access_token,
|
|
52
|
+
profile_id: "123456789",
|
|
53
|
+
)
|
|
54
|
+
campaigns.list_campaigns
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Development
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
bin/setup # Install dependencies
|
|
61
|
+
rake test # Run tests
|
|
62
|
+
rake rubocop # Lint
|
|
63
|
+
rake steep # Type check
|
|
64
|
+
```
|
|
32
65
|
|
|
33
66
|
## Contributing
|
|
34
67
|
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub
|
|
68
|
+
Bug reports and pull requests are welcome on [GitHub](https://github.com/lineofflight/amazon-ads-ruby).
|
|
36
69
|
|
|
37
70
|
## License
|
|
38
71
|
|
|
39
|
-
|
|
72
|
+
MIT
|
data/lib/amazon_ads/api.rb
CHANGED
|
@@ -5,46 +5,68 @@
|
|
|
5
5
|
require "http"
|
|
6
6
|
|
|
7
7
|
module AmazonAds
|
|
8
|
-
# Base class for Amazon Ads API
|
|
9
|
-
# Handles authentication, response parsing, error mapping, and retry logic.
|
|
8
|
+
# Base class for Amazon Ads API endpoints
|
|
10
9
|
class API
|
|
11
10
|
ENDPOINTS = { #: Hash[Symbol, String]
|
|
12
|
-
na: "
|
|
13
|
-
eu: "
|
|
14
|
-
fe: "
|
|
11
|
+
na: "advertising-api.amazon.com",
|
|
12
|
+
eu: "advertising-api-eu.amazon.com",
|
|
13
|
+
fe: "advertising-api-fe.amazon.com",
|
|
15
14
|
}.freeze
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
BASE_RETRY_DELAY = 1 #: Integer
|
|
19
|
-
|
|
16
|
+
# API endpoint region
|
|
20
17
|
attr_reader :region #: Symbol
|
|
18
|
+
|
|
19
|
+
# LWA access token
|
|
20
|
+
attr_reader :access_token #: String
|
|
21
|
+
|
|
22
|
+
# Advertiser profile, scopes requests to a marketplace
|
|
21
23
|
attr_reader :profile_id #: String?
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
# Advertiser account
|
|
26
|
+
attr_reader :account_id #: String?
|
|
27
|
+
|
|
28
|
+
# Number of retries when throttled (default: 0)
|
|
29
|
+
attr_reader :retries #: Integer
|
|
30
|
+
|
|
31
|
+
#: (region: Symbol | String, access_token: String, ?profile_id: String?, ?account_id: String?, ?retries: Integer, ?http: untyped) -> void
|
|
32
|
+
def initialize(region:, access_token:, profile_id: nil, account_id: nil, retries: 0, http: HTTP)
|
|
33
|
+
@region = region.to_s.downcase.to_sym
|
|
26
34
|
@access_token = access_token
|
|
27
|
-
@lwa = lwa
|
|
28
35
|
@profile_id = profile_id
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
36
|
+
@account_id = account_id
|
|
37
|
+
@retries = retries
|
|
38
|
+
@http = http
|
|
33
39
|
end
|
|
34
40
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
@lwa ? @lwa.access_token : @access_token or raise AmazonAds::AuthenticationError, "No access token"
|
|
41
|
+
#: () -> URI::HTTPS
|
|
42
|
+
def endpoint
|
|
43
|
+
URI::HTTPS.build(host: ENDPOINTS.fetch(region) do
|
|
44
|
+
raise ArgumentError, "Unknown region: #{region}"
|
|
45
|
+
end)
|
|
41
46
|
end
|
|
42
47
|
|
|
43
48
|
#: () -> HTTP::Client
|
|
44
49
|
def http
|
|
45
|
-
|
|
50
|
+
client = @http
|
|
46
51
|
.headers(default_headers)
|
|
47
52
|
.use(:auto_inflate)
|
|
53
|
+
|
|
54
|
+
if retries.zero?
|
|
55
|
+
client.use(:raise_error)
|
|
56
|
+
else
|
|
57
|
+
client
|
|
58
|
+
.use(raise_error: { ignore: [429] })
|
|
59
|
+
.retriable(tries: retries + 1, retry_statuses: [429])
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
#: (Symbol, String, **untyped) -> HTTP::Response
|
|
66
|
+
def request(method, path, **options)
|
|
67
|
+
url = endpoint
|
|
68
|
+
url.path = path
|
|
69
|
+
http.request(method, url, **options)
|
|
48
70
|
end
|
|
49
71
|
|
|
50
72
|
#: () -> Hash[String, String]
|
|
@@ -56,86 +78,14 @@ module AmazonAds
|
|
|
56
78
|
"Accept" => "application/json",
|
|
57
79
|
}
|
|
58
80
|
headers["Amazon-Advertising-API-Scope"] = profile_id if profile_id
|
|
81
|
+
headers["Amazon-Ads-AccountId"] = account_id if account_id
|
|
59
82
|
|
|
60
83
|
headers
|
|
61
84
|
end
|
|
62
85
|
|
|
63
86
|
#: () -> String
|
|
64
87
|
def client_id
|
|
65
|
-
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
#: () -> String
|
|
69
|
-
def endpoint
|
|
70
|
-
ENDPOINTS.fetch(region) do
|
|
71
|
-
raise ArgumentError, "Unknown region: #{region}"
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
# Handles HTTP response, raising appropriate errors or parsing success responses.
|
|
76
|
-
#: (HTTP::Response) -> untyped
|
|
77
|
-
def handle_response(response)
|
|
78
|
-
case response.status.code
|
|
79
|
-
when 200..299
|
|
80
|
-
return if response.body.to_s.empty?
|
|
81
|
-
|
|
82
|
-
response.parse
|
|
83
|
-
when 400
|
|
84
|
-
raise AmazonAds::BadRequestError.new("Bad request", response: response)
|
|
85
|
-
when 401
|
|
86
|
-
raise AmazonAds::AuthenticationError.new("Unauthorized", response: response)
|
|
87
|
-
when 404
|
|
88
|
-
raise AmazonAds::NotFoundError.new("Not found", response: response)
|
|
89
|
-
when 429
|
|
90
|
-
retry_after = response.headers["Retry-After"]&.to_i
|
|
91
|
-
raise AmazonAds::RateLimitError.new("Rate limited", response: response, retry_after: retry_after)
|
|
92
|
-
when 500..599
|
|
93
|
-
raise AmazonAds::ServerError.new("Server error", response: response)
|
|
94
|
-
else
|
|
95
|
-
raise AmazonAds::Error.new("Request failed with status #{response.status.code}", response: response)
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
# Executes request with retry logic for rate limiting.
|
|
100
|
-
#: () { () -> HTTP::Response } -> untyped
|
|
101
|
-
def with_retry(&block)
|
|
102
|
-
retries = 0
|
|
103
|
-
|
|
104
|
-
loop do
|
|
105
|
-
response = yield
|
|
106
|
-
return handle_response(response)
|
|
107
|
-
rescue AmazonAds::RateLimitError => e
|
|
108
|
-
retries += 1
|
|
109
|
-
raise if retries > MAX_RETRIES
|
|
110
|
-
|
|
111
|
-
delay = e.retry_after || (BASE_RETRY_DELAY * (2**(retries - 1)))
|
|
112
|
-
sleep(delay)
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
#: (String, ?params: Hash[String, untyped]) -> untyped
|
|
117
|
-
def get(path, params: {})
|
|
118
|
-
with_retry { http.get("#{endpoint}#{path}", params: params) }
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
#: (String, ?body: Hash[String, untyped]) -> untyped
|
|
122
|
-
def post(path, body: {})
|
|
123
|
-
with_retry { http.post("#{endpoint}#{path}", json: body) }
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
#: (String, ?body: Hash[String, untyped]) -> untyped
|
|
127
|
-
def put(path, body: {})
|
|
128
|
-
with_retry { http.put("#{endpoint}#{path}", json: body) }
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
#: (String, ?body: Hash[String, untyped]) -> untyped
|
|
132
|
-
def patch(path, body: {})
|
|
133
|
-
with_retry { http.patch("#{endpoint}#{path}", json: body) }
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
#: (String) -> untyped
|
|
137
|
-
def delete(path)
|
|
138
|
-
with_retry { http.delete("#{endpoint}#{path}") }
|
|
88
|
+
AmazonAds.client_id!
|
|
139
89
|
end
|
|
140
90
|
end
|
|
141
91
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class AdAssociations < API
|
|
6
|
+
# Create Ad Association
|
|
7
|
+
#: (?ad_associations: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def create_ad_association(ad_associations: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/create/adAssociations", json: { "adAssociations" => ad_associations }.compact)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Delete Ad Association
|
|
13
|
+
#: (?ad_association_ids: Array[untyped]?) -> HTTP::Response
|
|
14
|
+
def delete_ad_association(ad_association_ids: nil)
|
|
15
|
+
request(:post, "/adsApi/v1/delete/adAssociations", json: { "adAssociationIds" => ad_association_ids }.compact)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Query Ad Association
|
|
19
|
+
#: (?ad_association_id_filter: String?, ?ad_group_id_filter: String?, ?ad_id_filter: String?, ?max_results: Integer?, ?next_token: String?) -> HTTP::Response
|
|
20
|
+
def query_ad_association(ad_association_id_filter: nil, ad_group_id_filter: nil, ad_id_filter: nil, max_results: nil, next_token: nil)
|
|
21
|
+
request(:post, "/adsApi/v1/query/adAssociations", json: { "adAssociationIdFilter" => ad_association_id_filter, "adGroupIdFilter" => ad_group_id_filter, "adIdFilter" => ad_id_filter, "maxResults" => max_results, "nextToken" => next_token }.compact)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Update Ad Association
|
|
25
|
+
#: (?ad_associations: Array[untyped]?) -> HTTP::Response
|
|
26
|
+
def update_ad_association(ad_associations: nil)
|
|
27
|
+
request(:post, "/adsApi/v1/update/adAssociations", json: { "adAssociations" => ad_associations }.compact)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class AdExtensions < API
|
|
6
|
+
# Create ad extensions - API is in open beta
|
|
7
|
+
#: (?ad_extensions: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def create_ad_extension(ad_extensions: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/create/adExtensions", json: { "adExtensions" => ad_extensions }.compact)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Query ad_extension - API is in open beta
|
|
13
|
+
#: (?ad_extension_id_filter: String?, ?ad_extension_status_filter: String?, ?ad_extension_type_filter: String?, ?ad_group_id_filter: String?, ?ad_id_filter: String?, ?ad_product_filter: String?, ?max_results: Integer?, ?next_token: String?, ?state_filter: String?) -> HTTP::Response
|
|
14
|
+
def query_ad_extension(ad_extension_id_filter: nil, ad_extension_status_filter: nil, ad_extension_type_filter: nil, ad_group_id_filter: nil, ad_id_filter: nil, ad_product_filter: nil, max_results: nil, next_token: nil, state_filter: nil)
|
|
15
|
+
request(:post, "/adsApi/v1/query/adExtensions", json: { "adExtensionIdFilter" => ad_extension_id_filter, "adExtensionStatusFilter" => ad_extension_status_filter, "adExtensionTypeFilter" => ad_extension_type_filter, "adGroupIdFilter" => ad_group_id_filter, "adIdFilter" => ad_id_filter, "adProductFilter" => ad_product_filter, "maxResults" => max_results, "nextToken" => next_token, "stateFilter" => state_filter }.compact)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Update ad_extension - API is in open beta
|
|
19
|
+
#: (?ad_extensions: Array[untyped]?) -> HTTP::Response
|
|
20
|
+
def update_ad_extension(ad_extensions: nil)
|
|
21
|
+
request(:post, "/adsApi/v1/update/adExtensions", json: { "adExtensions" => ad_extensions }.compact)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class AdGroups < API
|
|
6
|
+
# Create ad groups
|
|
7
|
+
#: (?ad_groups: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def create_ad_group(ad_groups: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/create/adGroups", json: { "adGroups" => ad_groups }.compact)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Delete ad groups
|
|
13
|
+
#: (?ad_group_ids: Array[untyped]?) -> HTTP::Response
|
|
14
|
+
def delete_ad_group(ad_group_ids: nil)
|
|
15
|
+
request(:post, "/adsApi/v1/delete/adGroups", json: { "adGroupIds" => ad_group_ids }.compact)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# List ad groups
|
|
19
|
+
#: (ad_product_filter: String, ?ad_group_id_filter: String?, ?campaign_id_filter: String?, ?marketplace_scope_filter: String?, ?max_results: Integer?, ?name_filter: String?, ?next_token: String?, ?state_filter: String?) -> HTTP::Response
|
|
20
|
+
def query_ad_group(ad_product_filter:, ad_group_id_filter: nil, campaign_id_filter: nil, marketplace_scope_filter: nil, max_results: nil, name_filter: nil, next_token: nil, state_filter: nil)
|
|
21
|
+
request(:post, "/adsApi/v1/query/adGroups", json: { "adGroupIdFilter" => ad_group_id_filter, "adProductFilter" => ad_product_filter, "campaignIdFilter" => campaign_id_filter, "marketplaceScopeFilter" => marketplace_scope_filter, "maxResults" => max_results, "nameFilter" => name_filter, "nextToken" => next_token, "stateFilter" => state_filter }.compact)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Update ad groups
|
|
25
|
+
#: (?ad_groups: Array[untyped]?) -> HTTP::Response
|
|
26
|
+
def update_ad_group(ad_groups: nil)
|
|
27
|
+
request(:post, "/adsApi/v1/update/adGroups", json: { "adGroups" => ad_groups }.compact)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class Ads < API
|
|
6
|
+
# Create ads
|
|
7
|
+
#: (?ads: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def create_ad(ads: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/create/ads", json: { "ads" => ads }.compact)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Delete ads
|
|
13
|
+
#: (?ad_ids: Array[untyped]?) -> HTTP::Response
|
|
14
|
+
def delete_ad(ad_ids: nil)
|
|
15
|
+
request(:post, "/adsApi/v1/delete/ads", json: { "adIds" => ad_ids }.compact)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# List ads
|
|
19
|
+
#: (ad_product_filter: String, ?ad_group_id_filter: String?, ?ad_id_filter: String?, ?campaign_id_filter: String?, ?marketplace_scope_filter: String?, ?max_results: Integer?, ?name_filter: String?, ?next_token: String?, ?state_filter: String?) -> HTTP::Response
|
|
20
|
+
def query_ad(ad_product_filter:, ad_group_id_filter: nil, ad_id_filter: nil, campaign_id_filter: nil, marketplace_scope_filter: nil, max_results: nil, name_filter: nil, next_token: nil, state_filter: nil)
|
|
21
|
+
request(:post, "/adsApi/v1/query/ads", json: { "adGroupIdFilter" => ad_group_id_filter, "adIdFilter" => ad_id_filter, "adProductFilter" => ad_product_filter, "campaignIdFilter" => campaign_id_filter, "marketplaceScopeFilter" => marketplace_scope_filter, "maxResults" => max_results, "nameFilter" => name_filter, "nextToken" => next_token, "stateFilter" => state_filter }.compact)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Update ads
|
|
25
|
+
#: (?ads: Array[untyped]?) -> HTTP::Response
|
|
26
|
+
def update_ad(ads: nil)
|
|
27
|
+
request(:post, "/adsApi/v1/update/ads", json: { "ads" => ads }.compact)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class AdvertisingDealTargets < API
|
|
6
|
+
# Create advertisingDealTarget
|
|
7
|
+
#: (?advertising_deal_targets: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def sb_create_advertising_deal_target(advertising_deal_targets: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/create/advertisingDealTargets/sb", json: { "advertisingDealTargets" => advertising_deal_targets }.compact)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Delete advertisingDealTarget
|
|
13
|
+
#: (?advertising_deal_target_ids: Array[untyped]?) -> HTTP::Response
|
|
14
|
+
def sb_delete_advertising_deal_target(advertising_deal_target_ids: nil)
|
|
15
|
+
request(:post, "/adsApi/v1/delete/advertisingDealTargets/sb", json: { "advertisingDealTargetIds" => advertising_deal_target_ids }.compact)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Query advertisingDealTarget
|
|
19
|
+
#: (advertising_deal_id_filter: String, ?max_results: Integer?, ?next_token: String?) -> HTTP::Response
|
|
20
|
+
def sb_query_advertising_deal_target(advertising_deal_id_filter:, max_results: nil, next_token: nil)
|
|
21
|
+
request(:post, "/adsApi/v1/query/advertisingDealTargets/sb", json: { "advertisingDealIdFilter" => advertising_deal_id_filter, "maxResults" => max_results, "nextToken" => next_token }.compact)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class AdvertisingDeals < API
|
|
6
|
+
# Create advertisingDeal
|
|
7
|
+
#: (?advertising_deals: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def sb_create_advertising_deal(advertising_deals: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/create/advertisingDeals/sb", json: { "advertisingDeals" => advertising_deals }.compact)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Delete advertisingDeal
|
|
13
|
+
#: (?advertising_deal_ids: Array[untyped]?) -> HTTP::Response
|
|
14
|
+
def sb_delete_advertising_deal(advertising_deal_ids: nil)
|
|
15
|
+
request(:post, "/adsApi/v1/delete/advertisingDeals/sb", json: { "advertisingDealIds" => advertising_deal_ids }.compact)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Query advertisingDeal
|
|
19
|
+
#: (?advertising_deal_id_filter: String?, ?max_results: Integer?, ?name_filter: String?, ?next_token: String?) -> HTTP::Response
|
|
20
|
+
def sb_query_advertising_deal(advertising_deal_id_filter: nil, max_results: nil, name_filter: nil, next_token: nil)
|
|
21
|
+
request(:post, "/adsApi/v1/query/advertisingDeals/sb", json: { "advertisingDealIdFilter" => advertising_deal_id_filter, "maxResults" => max_results, "nameFilter" => name_filter, "nextToken" => next_token }.compact)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Update advertisingDeal
|
|
25
|
+
#: (?advertising_deals: Array[untyped]?) -> HTTP::Response
|
|
26
|
+
def sb_update_advertising_deal(advertising_deals: nil)
|
|
27
|
+
request(:post, "/adsApi/v1/update/advertisingDeals/sb", json: { "advertisingDeals" => advertising_deals }.compact)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class BrandStoreEditionPublishVersions < API
|
|
6
|
+
# Query store edition publish versions
|
|
7
|
+
#: (edition_id_filter: String, publish_status_filter: String, store_id_filter: String, ?max_results: Integer?, ?next_token: String?) -> HTTP::Response
|
|
8
|
+
def query_brand_store_edition_publish_version(edition_id_filter:, publish_status_filter:, store_id_filter:, max_results: nil, next_token: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/query/brandStoreEditionPublishVersions", json: { "editionIdFilter" => edition_id_filter, "maxResults" => max_results, "nextToken" => next_token, "publishStatusFilter" => publish_status_filter, "storeIdFilter" => store_id_filter }.compact)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Update store edition publish versions
|
|
13
|
+
#: (?brand_store_edition_publish_versions: Array[untyped]?) -> HTTP::Response
|
|
14
|
+
def update_brand_store_edition_publish_version(brand_store_edition_publish_versions: nil)
|
|
15
|
+
request(:post, "/adsApi/v1/update/brandStoreEditionPublishVersions", json: { "brandStoreEditionPublishVersions" => brand_store_edition_publish_versions }.compact)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class BrandStoreEditions < API
|
|
6
|
+
# Retrieve brand store page content
|
|
7
|
+
#: (brand_store_id: String, ?next_token: String?, ?max_results: Integer?) -> HTTP::Response
|
|
8
|
+
def list_brand_store_edition(brand_store_id:, next_token: nil, max_results: nil)
|
|
9
|
+
request(:get, "/adsApi/v1/brandStoreEditions", params: { "brandStoreId" => brand_store_id, "nextToken" => next_token, "maxResults" => max_results }.compact)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class BrandStorePages < API
|
|
6
|
+
# Retrieve brand store page content
|
|
7
|
+
#: (edition_id_filter: String, page_id_filter: String, store_id_filter: String, ?max_results: Integer?, ?next_token: String?, ?store_edition_publish_id_filter: String?) -> HTTP::Response
|
|
8
|
+
def query_brand_store_page(edition_id_filter:, page_id_filter:, store_id_filter:, max_results: nil, next_token: nil, store_edition_publish_id_filter: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/query/brandStorePages", json: { "editionIdFilter" => edition_id_filter, "maxResults" => max_results, "nextToken" => next_token, "pageIdFilter" => page_id_filter, "storeEditionPublishIdFilter" => store_edition_publish_id_filter, "storeIdFilter" => store_id_filter }.compact)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class BrandStores < API
|
|
6
|
+
# Query brand store content
|
|
7
|
+
#: (store_name_filter: String, ?max_results: Integer?, ?next_token: String?, ?sort: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def query_brand_store(store_name_filter:, max_results: nil, next_token: nil, sort: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/query/brandStores", json: { "maxResults" => max_results, "nextToken" => next_token, "sort" => sort, "storeNameFilter" => store_name_filter }.compact)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class BrandedKeywordsPricings < API
|
|
6
|
+
# Create brandedKeywords pricing
|
|
7
|
+
#: (?branded_keywords_pricings: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def sb_create_branded_keywords_pricing(branded_keywords_pricings: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/create/brandedKeywordsPricings/sb", json: { "brandedKeywordsPricings" => branded_keywords_pricings }.compact)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class CampaignForecasts < API
|
|
6
|
+
# Retrieve campaign forecast
|
|
7
|
+
#: (?campaign_forecast_descriptions: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def dsp_retrieve_campaign_forecast(campaign_forecast_descriptions: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/retrieve/campaignForecasts/dsp", json: { "campaignForecastDescriptions" => campaign_forecast_descriptions }.compact)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class Campaigns < API
|
|
6
|
+
# Create campaigns
|
|
7
|
+
#: (?campaigns: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def create_campaign(campaigns: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/create/campaigns", json: { "campaigns" => campaigns }.compact)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Delete campaigns
|
|
13
|
+
#: (?campaign_ids: Array[untyped]?) -> HTTP::Response
|
|
14
|
+
def delete_campaign(campaign_ids: nil)
|
|
15
|
+
request(:post, "/adsApi/v1/delete/campaigns", json: { "campaignIds" => campaign_ids }.compact)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Query campaign
|
|
19
|
+
#: (ad_product_filter: String, ?campaign_id_filter: String?, ?goal_filter: String?, ?marketplace_scope_filter: String?, ?max_results: Integer?, ?name_filter: String?, ?next_token: String?, ?portfolio_id_filter: String?, ?state_filter: String?) -> HTTP::Response
|
|
20
|
+
def query_campaign(ad_product_filter:, campaign_id_filter: nil, goal_filter: nil, marketplace_scope_filter: nil, max_results: nil, name_filter: nil, next_token: nil, portfolio_id_filter: nil, state_filter: nil)
|
|
21
|
+
request(:post, "/adsApi/v1/query/campaigns", json: { "adProductFilter" => ad_product_filter, "campaignIdFilter" => campaign_id_filter, "goalFilter" => goal_filter, "marketplaceScopeFilter" => marketplace_scope_filter, "maxResults" => max_results, "nameFilter" => name_filter, "nextToken" => next_token, "portfolioIdFilter" => portfolio_id_filter, "stateFilter" => state_filter }.compact)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Update campaign
|
|
25
|
+
#: (?campaigns: Array[untyped]?) -> HTTP::Response
|
|
26
|
+
def update_campaign(campaigns: nil)
|
|
27
|
+
request(:post, "/adsApi/v1/update/campaigns", json: { "campaigns" => campaigns }.compact)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class CommitmentSpends < API
|
|
6
|
+
# Retrieve commitment spend
|
|
7
|
+
#: (?commitment_ids: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def dsp_retrieve_commitment_spend(commitment_ids: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/retrieve/commitmentSpends/dsp", json: { "commitmentIds" => commitment_ids }.compact)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class Commitments < API
|
|
6
|
+
# Create commitments
|
|
7
|
+
#: (?commitments: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def dsp_create_commitment(commitments: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/create/commitments/dsp", json: { "commitments" => commitments }.compact)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# List commitments
|
|
13
|
+
#: (?next_token: String?, ?max_results: Integer?) -> HTTP::Response
|
|
14
|
+
def dsp_list_commitment(next_token: nil, max_results: nil)
|
|
15
|
+
request(:get, "/adsApi/v1/commitments/dsp", params: { "nextToken" => next_token, "maxResults" => max_results }.compact)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Get Commitments
|
|
19
|
+
#: (?commitment_ids: Array[untyped]?) -> HTTP::Response
|
|
20
|
+
def dsp_retrieve_commitment(commitment_ids: nil)
|
|
21
|
+
request(:post, "/adsApi/v1/retrieve/commitments/dsp", json: { "commitmentIds" => commitment_ids }.compact)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Update commitments
|
|
25
|
+
#: (?commitments: Array[untyped]?) -> HTTP::Response
|
|
26
|
+
def dsp_update_commitment(commitments: nil)
|
|
27
|
+
request(:post, "/adsApi/v1/update/commitments/dsp", json: { "commitments" => commitments }.compact)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module AmazonAds
|
|
5
|
+
class KeywordReservationValidations < API
|
|
6
|
+
# Validate keyword reservation
|
|
7
|
+
#: (?keyword_reservation_validations: Array[untyped]?) -> HTTP::Response
|
|
8
|
+
def sb_create_keyword_reservation_validation(keyword_reservation_validations: nil)
|
|
9
|
+
request(:post, "/adsApi/v1/create/keywordReservationValidations/sb", json: { "keywordReservationValidations" => keyword_reservation_validations }.compact)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|