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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -18
  3. data/lib/amazon_ads/api.rb +52 -100
  4. data/lib/amazon_ads/apis/ad_associations.rb +29 -0
  5. data/lib/amazon_ads/apis/ad_extensions.rb +23 -0
  6. data/lib/amazon_ads/apis/ad_groups.rb +29 -0
  7. data/lib/amazon_ads/apis/ads.rb +29 -0
  8. data/lib/amazon_ads/apis/advertising_deal_targets.rb +23 -0
  9. data/lib/amazon_ads/apis/advertising_deals.rb +29 -0
  10. data/lib/amazon_ads/apis/brand_store_edition_publish_versions.rb +17 -0
  11. data/lib/amazon_ads/apis/brand_store_editions.rb +11 -0
  12. data/lib/amazon_ads/apis/brand_store_pages.rb +11 -0
  13. data/lib/amazon_ads/apis/brand_stores.rb +11 -0
  14. data/lib/amazon_ads/apis/branded_keywords_pricings.rb +11 -0
  15. data/lib/amazon_ads/apis/campaign_forecasts.rb +11 -0
  16. data/lib/amazon_ads/apis/campaigns.rb +29 -0
  17. data/lib/amazon_ads/apis/commitment_spends.rb +11 -0
  18. data/lib/amazon_ads/apis/commitments.rb +29 -0
  19. data/lib/amazon_ads/apis/keyword_reservation_validations.rb +11 -0
  20. data/lib/amazon_ads/apis/marketing_stream.rb +72 -0
  21. data/lib/amazon_ads/apis/profiles.rb +15 -15
  22. data/lib/amazon_ads/apis/recommendation_types.rb +11 -0
  23. data/lib/amazon_ads/apis/recommendations.rb +11 -0
  24. data/lib/amazon_ads/apis/reporting.rb +29 -0
  25. data/lib/amazon_ads/apis/targets.rb +29 -0
  26. data/lib/amazon_ads/lwa.rb +35 -60
  27. data/lib/amazon_ads/version.rb +1 -1
  28. data/lib/amazon_ads.rb +31 -22
  29. metadata +41 -18
  30. data/lib/amazon_ads/apis/sponsored_products.rb +0 -76
  31. data/lib/amazon_ads/client.rb +0 -38
  32. data/lib/amazon_ads/configuration.rb +0 -34
  33. data/lib/amazon_ads/errors.rb +0 -43
  34. data/sig/generated/amazon_ads/api.rbs +0 -61
  35. data/sig/generated/amazon_ads/apis/profiles.rbs +0 -20
  36. data/sig/generated/amazon_ads/apis/sponsored_products.rbs +0 -52
  37. data/sig/generated/amazon_ads/client.rbs +0 -28
  38. data/sig/generated/amazon_ads/configuration.rbs +0 -24
  39. data/sig/generated/amazon_ads/errors.rbs +0 -35
  40. data/sig/generated/amazon_ads/lwa.rbs +0 -39
  41. data/sig/generated/amazon_ads.rbs +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4e68acc1d736bb5c7f6a59b10163bce7a2622065a291fcebfe3aafd7e028fa2
4
- data.tar.gz: 3f33dd9eeae73cfb943bf548efbb842393aea4b42d6b8f87fb79e8faad4f9d49
3
+ metadata.gz: 01b624dd728e5d50d55c9d199671a1730ce61c260210d0d13c2173241edc297e
4
+ data.tar.gz: 6a8cc4aa441d12b1c12905fbec987935c82807b2495a520e0d304830c36ceadc
5
5
  SHA512:
6
- metadata.gz: ef4d4bf550a0c1cbee2ca11b469906d576e35a1db35978e52896572ad202a0905d32087810e1ee750b358ee9409bb073b1f863485847588bfd1f2cfce7f901bf
7
- data.tar.gz: 6755c1f89af12711d7dd3970e1ac37e9e3ac1872c944f497030bfa74a84e5cbbd825af087719cf68104e6be019302f7639138c0dcbe6006b2294dcf490448080
6
+ metadata.gz: 8afd9e71ec2e8006cf99de7f66bc202cbc8589fbe9809a591d42a7948ed032dfad3d7b1d2d9c536548643de93a15824e6fa94724424e2d0c76c5ace11610387e
7
+ data.tar.gz: 6cca951e838bf718be509b0f0882ef54c4e6ee8d2955d25982f0ab9d6a595e08535b4f3ed63f17b84103fef1a3f813c23d282e6e34f253afbbbe688bbcaab061
data/README.md CHANGED
@@ -1,39 +1,59 @@
1
- # Sponsor
1
+ # Amazon Ads
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
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
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
7
+ Add to your Gemfile:
8
+
9
+ ```ruby
10
+ gem "amazon-ads"
11
+ ```
10
12
 
11
- Install the gem and add to the application's Gemfile by executing:
13
+ Or install directly:
12
14
 
13
15
  ```bash
14
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
16
+ gem install amazon-ads
15
17
  ```
16
18
 
17
- If bundler is not being used to manage dependencies, install the gem by executing:
19
+ ## Configuration
18
20
 
19
- ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
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
- TODO: Write usage instructions here
32
+ Request an access token via Login with Amazon (LWA):
26
33
 
27
- ## Development
34
+ ```ruby
35
+ data = AmazonAds::LWA.request(refresh_token: "your_refresh_token")
36
+ access_token = data.fetch("access_token")
37
+ ```
28
38
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
39
+ The caller owns token caching. Store and reuse the token until it expires.
30
40
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
41
+ Make requests:
32
42
 
33
- ## Contributing
43
+ ```ruby
44
+ # List advertising profiles
45
+ profiles = AmazonAds::Profiles.new(region: "NA", access_token:)
46
+ profiles.list_profiles
34
47
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sponsor.
48
+ # List campaigns under a profile
49
+ campaigns = AmazonAds::Campaigns.new(
50
+ region: "NA",
51
+ access_token:,
52
+ profile_id: "123456789",
53
+ )
54
+ campaigns.list_campaigns
55
+ ```
36
56
 
37
- ## License
57
+ ## Development
38
58
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
59
+ See [AGENTS.md](AGENTS.md).
@@ -1,50 +1,70 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # rbs_inline: enabled
4
-
5
3
  require "http"
6
4
 
7
5
  module AmazonAds
8
- # Base class for Amazon Ads API clients.
9
- # Handles authentication, response parsing, error mapping, and retry logic.
6
+ # Base class for Amazon Ads API endpoints
10
7
  class API
11
8
  ENDPOINTS = { #: Hash[Symbol, String]
12
- na: "https://advertising-api.amazon.com",
13
- eu: "https://advertising-api-eu.amazon.com",
14
- fe: "https://advertising-api-fe.amazon.com",
9
+ na: "advertising-api.amazon.com",
10
+ eu: "advertising-api-eu.amazon.com",
11
+ fe: "advertising-api-fe.amazon.com",
15
12
  }.freeze
16
13
 
17
- MAX_RETRIES = 3 #: Integer
18
- BASE_RETRY_DELAY = 1 #: Integer
19
-
14
+ # API endpoint region
20
15
  attr_reader :region #: Symbol
16
+
17
+ # LWA access token
18
+ attr_reader :access_token #: String
19
+
20
+ # Advertiser profile, scopes requests to a marketplace
21
21
  attr_reader :profile_id #: String?
22
22
 
23
- #: (region: Symbol, ?access_token: String?, ?lwa: LWA?, ?profile_id: String?) -> void
24
- def initialize(region:, access_token: nil, lwa: nil, profile_id: nil)
25
- @region = region
23
+ # Advertiser account
24
+ attr_reader :account_id #: String?
25
+
26
+ # Number of retries when throttled (default: 0)
27
+ attr_reader :retries #: Integer
28
+
29
+ #: (region: Symbol | String, access_token: String, ?profile_id: String?, ?account_id: String?, ?retries: Integer, ?http: untyped) -> void
30
+ def initialize(region:, access_token:, profile_id: nil, account_id: nil, retries: 0, http: HTTP)
31
+ @region = region.to_s.downcase.to_sym
26
32
  @access_token = access_token
27
- @lwa = lwa
28
33
  @profile_id = profile_id
29
-
30
- unless @access_token || @lwa
31
- raise ArgumentError, "Either access_token or lwa must be provided"
32
- end
34
+ @account_id = account_id
35
+ @retries = retries
36
+ @http = http
33
37
  end
34
38
 
35
- private
36
-
37
- # Returns the current access token, refreshing via LWA if needed.
38
- #: () -> String
39
- def access_token
40
- @lwa ? @lwa.access_token : @access_token or raise AmazonAds::AuthenticationError, "No access token"
39
+ #: () -> URI::HTTPS
40
+ def endpoint
41
+ URI::HTTPS.build(host: ENDPOINTS.fetch(region) do
42
+ raise ArgumentError, "Unknown region: #{region}"
43
+ end)
41
44
  end
42
45
 
43
46
  #: () -> HTTP::Client
44
47
  def http
45
- HTTP
48
+ client = @http
46
49
  .headers(default_headers)
47
50
  .use(:auto_inflate)
51
+
52
+ if retries.zero?
53
+ client.use(:raise_error)
54
+ else
55
+ client
56
+ .use(raise_error: { ignore: [429] })
57
+ .retriable(tries: retries + 1, retry_statuses: [429])
58
+ end
59
+ end
60
+
61
+ private
62
+
63
+ #: (HTTP::verb, String, **untyped) -> HTTP::Response
64
+ def request(method, path, **options)
65
+ url = endpoint
66
+ url.path = path
67
+ http.request(method, url.to_s, **options)
48
68
  end
49
69
 
50
70
  #: () -> Hash[String, String]
@@ -55,87 +75,19 @@ module AmazonAds
55
75
  "Content-Type" => "application/json",
56
76
  "Accept" => "application/json",
57
77
  }
58
- headers["Amazon-Advertising-API-Scope"] = profile_id if profile_id
78
+ if (scope = profile_id)
79
+ headers["Amazon-Advertising-API-Scope"] = scope
80
+ end
81
+ if (account = account_id)
82
+ headers["Amazon-Ads-AccountId"] = account
83
+ end
59
84
 
60
85
  headers
61
86
  end
62
87
 
63
88
  #: () -> String
64
89
  def client_id
65
- ENV.fetch("AMAZON_ADS_CLIENT_ID")
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}") }
90
+ AmazonAds.client_id!
139
91
  end
140
92
  end
141
93
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class AdAssociations < API
5
+ # Create Ad Association
6
+ #: (?ad_associations: Array[untyped]?) -> HTTP::Response
7
+ def create_ad_association(ad_associations: nil)
8
+ request(:post, "/adsApi/v1/create/adAssociations", json: { "adAssociations" => ad_associations }.compact)
9
+ end
10
+
11
+ # Delete Ad Association
12
+ #: (?ad_association_ids: Array[untyped]?) -> HTTP::Response
13
+ def delete_ad_association(ad_association_ids: nil)
14
+ request(:post, "/adsApi/v1/delete/adAssociations", json: { "adAssociationIds" => ad_association_ids }.compact)
15
+ end
16
+
17
+ # Query Ad Association
18
+ #: (?ad_association_id_filter: untyped?, ?ad_group_id_filter: untyped?, ?ad_id_filter: untyped?, ?max_results: Integer?, ?next_token: String?) -> HTTP::Response
19
+ def query_ad_association(ad_association_id_filter: nil, ad_group_id_filter: nil, ad_id_filter: nil, max_results: nil, next_token: nil)
20
+ 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)
21
+ end
22
+
23
+ # Update Ad Association
24
+ #: (?ad_associations: Array[untyped]?) -> HTTP::Response
25
+ def update_ad_association(ad_associations: nil)
26
+ request(:post, "/adsApi/v1/update/adAssociations", json: { "adAssociations" => ad_associations }.compact)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class AdExtensions < API
5
+ # Create ad extensions - API is in open beta
6
+ #: (?ad_extensions: Array[untyped]?) -> HTTP::Response
7
+ def create_ad_extension(ad_extensions: nil)
8
+ request(:post, "/adsApi/v1/create/adExtensions", json: { "adExtensions" => ad_extensions }.compact)
9
+ end
10
+
11
+ # Query ad_extension - API is in open beta
12
+ #: (?ad_extension_id_filter: untyped?, ?ad_extension_status_filter: untyped?, ?ad_extension_type_filter: untyped?, ?ad_group_id_filter: untyped?, ?ad_id_filter: untyped?, ?ad_product_filter: untyped?, ?max_results: Integer?, ?next_token: String?, ?state_filter: untyped?) -> HTTP::Response
13
+ 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)
14
+ 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)
15
+ end
16
+
17
+ # Update ad_extension - API is in open beta
18
+ #: (?ad_extensions: Array[untyped]?) -> HTTP::Response
19
+ def update_ad_extension(ad_extensions: nil)
20
+ request(:post, "/adsApi/v1/update/adExtensions", json: { "adExtensions" => ad_extensions }.compact)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class AdGroups < API
5
+ # Create ad groups
6
+ #: (?ad_groups: Array[untyped]?) -> HTTP::Response
7
+ def create_ad_group(ad_groups: nil)
8
+ request(:post, "/adsApi/v1/create/adGroups", json: { "adGroups" => ad_groups }.compact)
9
+ end
10
+
11
+ # Delete ad groups
12
+ #: (?ad_group_ids: Array[untyped]?) -> HTTP::Response
13
+ def delete_ad_group(ad_group_ids: nil)
14
+ request(:post, "/adsApi/v1/delete/adGroups", json: { "adGroupIds" => ad_group_ids }.compact)
15
+ end
16
+
17
+ # List ad groups
18
+ #: (ad_product_filter: untyped, ?ad_group_id_filter: untyped?, ?campaign_id_filter: untyped?, ?marketplace_scope_filter: untyped?, ?max_results: Integer?, ?name_filter: untyped?, ?next_token: String?, ?state_filter: untyped?) -> HTTP::Response
19
+ 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)
20
+ 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)
21
+ end
22
+
23
+ # Update ad groups
24
+ #: (?ad_groups: Array[untyped]?) -> HTTP::Response
25
+ def update_ad_group(ad_groups: nil)
26
+ request(:post, "/adsApi/v1/update/adGroups", json: { "adGroups" => ad_groups }.compact)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class Ads < API
5
+ # Create ads
6
+ #: (?ads: Array[untyped]?) -> HTTP::Response
7
+ def create_ad(ads: nil)
8
+ request(:post, "/adsApi/v1/create/ads", json: { "ads" => ads }.compact)
9
+ end
10
+
11
+ # Delete ads
12
+ #: (?ad_ids: Array[untyped]?) -> HTTP::Response
13
+ def delete_ad(ad_ids: nil)
14
+ request(:post, "/adsApi/v1/delete/ads", json: { "adIds" => ad_ids }.compact)
15
+ end
16
+
17
+ # List ads
18
+ #: (ad_product_filter: untyped, ?ad_group_id_filter: untyped?, ?ad_id_filter: untyped?, ?campaign_id_filter: untyped?, ?marketplace_scope_filter: untyped?, ?max_results: Integer?, ?name_filter: untyped?, ?next_token: String?, ?state_filter: untyped?) -> HTTP::Response
19
+ 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)
20
+ 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)
21
+ end
22
+
23
+ # Update ads
24
+ #: (?ads: Array[untyped]?) -> HTTP::Response
25
+ def update_ad(ads: nil)
26
+ request(:post, "/adsApi/v1/update/ads", json: { "ads" => ads }.compact)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class AdvertisingDealTargets < API
5
+ # Create advertisingDealTarget
6
+ #: (?advertising_deal_targets: Array[untyped]?) -> HTTP::Response
7
+ def sb_create_advertising_deal_target(advertising_deal_targets: nil)
8
+ request(:post, "/adsApi/v1/create/advertisingDealTargets/sb", json: { "advertisingDealTargets" => advertising_deal_targets }.compact)
9
+ end
10
+
11
+ # Delete advertisingDealTarget
12
+ #: (?advertising_deal_target_ids: Array[untyped]?) -> HTTP::Response
13
+ def sb_delete_advertising_deal_target(advertising_deal_target_ids: nil)
14
+ request(:post, "/adsApi/v1/delete/advertisingDealTargets/sb", json: { "advertisingDealTargetIds" => advertising_deal_target_ids }.compact)
15
+ end
16
+
17
+ # Query advertisingDealTarget
18
+ #: (advertising_deal_id_filter: untyped, ?max_results: Integer?, ?next_token: String?) -> HTTP::Response
19
+ def sb_query_advertising_deal_target(advertising_deal_id_filter:, max_results: nil, next_token: nil)
20
+ request(:post, "/adsApi/v1/query/advertisingDealTargets/sb", json: { "advertisingDealIdFilter" => advertising_deal_id_filter, "maxResults" => max_results, "nextToken" => next_token }.compact)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class AdvertisingDeals < API
5
+ # Create advertisingDeal
6
+ #: (?advertising_deals: Array[untyped]?) -> HTTP::Response
7
+ def sb_create_advertising_deal(advertising_deals: nil)
8
+ request(:post, "/adsApi/v1/create/advertisingDeals/sb", json: { "advertisingDeals" => advertising_deals }.compact)
9
+ end
10
+
11
+ # Delete advertisingDeal
12
+ #: (?advertising_deal_ids: Array[untyped]?) -> HTTP::Response
13
+ def sb_delete_advertising_deal(advertising_deal_ids: nil)
14
+ request(:post, "/adsApi/v1/delete/advertisingDeals/sb", json: { "advertisingDealIds" => advertising_deal_ids }.compact)
15
+ end
16
+
17
+ # Query advertisingDeal
18
+ #: (?advertising_deal_id_filter: untyped?, ?max_results: Integer?, ?name_filter: untyped?, ?next_token: String?) -> HTTP::Response
19
+ def sb_query_advertising_deal(advertising_deal_id_filter: nil, max_results: nil, name_filter: nil, next_token: nil)
20
+ request(:post, "/adsApi/v1/query/advertisingDeals/sb", json: { "advertisingDealIdFilter" => advertising_deal_id_filter, "maxResults" => max_results, "nameFilter" => name_filter, "nextToken" => next_token }.compact)
21
+ end
22
+
23
+ # Update advertisingDeal
24
+ #: (?advertising_deals: Array[untyped]?) -> HTTP::Response
25
+ def sb_update_advertising_deal(advertising_deals: nil)
26
+ request(:post, "/adsApi/v1/update/advertisingDeals/sb", json: { "advertisingDeals" => advertising_deals }.compact)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class BrandStoreEditionPublishVersions < API
5
+ # Query store edition publish versions
6
+ #: (edition_id_filter: untyped, publish_status_filter: untyped, store_id_filter: untyped, ?max_results: Integer?, ?next_token: String?) -> HTTP::Response
7
+ def query_brand_store_edition_publish_version(edition_id_filter:, publish_status_filter:, store_id_filter:, max_results: nil, next_token: nil)
8
+ 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)
9
+ end
10
+
11
+ # Update store edition publish versions
12
+ #: (?brand_store_edition_publish_versions: Array[untyped]?) -> HTTP::Response
13
+ def update_brand_store_edition_publish_version(brand_store_edition_publish_versions: nil)
14
+ request(:post, "/adsApi/v1/update/brandStoreEditionPublishVersions", json: { "brandStoreEditionPublishVersions" => brand_store_edition_publish_versions }.compact)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class BrandStoreEditions < API
5
+ # Retrieve brand store page content
6
+ #: (brand_store_id: String, ?next_token: String?, ?max_results: Integer?) -> HTTP::Response
7
+ def list_brand_store_edition(brand_store_id:, next_token: nil, max_results: nil)
8
+ request(:get, "/adsApi/v1/brandStoreEditions", params: { "brandStoreId" => brand_store_id, "nextToken" => next_token, "maxResults" => max_results }.compact)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class BrandStorePages < API
5
+ # Retrieve brand store page content
6
+ #: (edition_id_filter: untyped, page_id_filter: untyped, store_id_filter: untyped, ?max_results: Integer?, ?next_token: String?, ?store_edition_publish_id_filter: untyped?) -> HTTP::Response
7
+ 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)
8
+ 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)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class BrandStores < API
5
+ # Query brand store content
6
+ #: (store_name_filter: untyped, ?max_results: Integer?, ?next_token: String?, ?sort: Array[untyped]?) -> HTTP::Response
7
+ def query_brand_store(store_name_filter:, max_results: nil, next_token: nil, sort: nil)
8
+ request(:post, "/adsApi/v1/query/brandStores", json: { "maxResults" => max_results, "nextToken" => next_token, "sort" => sort, "storeNameFilter" => store_name_filter }.compact)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class BrandedKeywordsPricings < API
5
+ # Create brandedKeywords pricing
6
+ #: (?branded_keywords_pricings: Array[untyped]?) -> HTTP::Response
7
+ def sb_create_branded_keywords_pricing(branded_keywords_pricings: nil)
8
+ request(:post, "/adsApi/v1/create/brandedKeywordsPricings/sb", json: { "brandedKeywordsPricings" => branded_keywords_pricings }.compact)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class CampaignForecasts < API
5
+ # Retrieve campaign forecast
6
+ #: (?campaign_forecast_descriptions: Array[untyped]?) -> HTTP::Response
7
+ def dsp_retrieve_campaign_forecast(campaign_forecast_descriptions: nil)
8
+ request(:post, "/adsApi/v1/retrieve/campaignForecasts/dsp", json: { "campaignForecastDescriptions" => campaign_forecast_descriptions }.compact)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class Campaigns < API
5
+ # Create campaigns
6
+ #: (?campaigns: Array[untyped]?) -> HTTP::Response
7
+ def create_campaign(campaigns: nil)
8
+ request(:post, "/adsApi/v1/create/campaigns", json: { "campaigns" => campaigns }.compact)
9
+ end
10
+
11
+ # Delete campaigns
12
+ #: (?campaign_ids: Array[untyped]?) -> HTTP::Response
13
+ def delete_campaign(campaign_ids: nil)
14
+ request(:post, "/adsApi/v1/delete/campaigns", json: { "campaignIds" => campaign_ids }.compact)
15
+ end
16
+
17
+ # Query campaign
18
+ #: (ad_product_filter: untyped, ?campaign_id_filter: untyped?, ?goal_filter: untyped?, ?marketplace_scope_filter: untyped?, ?max_results: Integer?, ?name_filter: untyped?, ?next_token: String?, ?portfolio_id_filter: untyped?, ?state_filter: untyped?) -> HTTP::Response
19
+ 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)
20
+ 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)
21
+ end
22
+
23
+ # Update campaign
24
+ #: (?campaigns: Array[untyped]?) -> HTTP::Response
25
+ def update_campaign(campaigns: nil)
26
+ request(:post, "/adsApi/v1/update/campaigns", json: { "campaigns" => campaigns }.compact)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class CommitmentSpends < API
5
+ # Retrieve commitment spend
6
+ #: (?commitment_ids: Array[untyped]?) -> HTTP::Response
7
+ def dsp_retrieve_commitment_spend(commitment_ids: nil)
8
+ request(:post, "/adsApi/v1/retrieve/commitmentSpends/dsp", json: { "commitmentIds" => commitment_ids }.compact)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class Commitments < API
5
+ # Create commitments
6
+ #: (?commitments: Array[untyped]?) -> HTTP::Response
7
+ def dsp_create_commitment(commitments: nil)
8
+ request(:post, "/adsApi/v1/create/commitments/dsp", json: { "commitments" => commitments }.compact)
9
+ end
10
+
11
+ # List commitments
12
+ #: (?next_token: String?, ?max_results: Integer?) -> HTTP::Response
13
+ def dsp_list_commitment(next_token: nil, max_results: nil)
14
+ request(:get, "/adsApi/v1/commitments/dsp", params: { "nextToken" => next_token, "maxResults" => max_results }.compact)
15
+ end
16
+
17
+ # Get Commitments
18
+ #: (?commitment_ids: Array[untyped]?) -> HTTP::Response
19
+ def dsp_retrieve_commitment(commitment_ids: nil)
20
+ request(:post, "/adsApi/v1/retrieve/commitments/dsp", json: { "commitmentIds" => commitment_ids }.compact)
21
+ end
22
+
23
+ # Update commitments
24
+ #: (?commitments: Array[untyped]?) -> HTTP::Response
25
+ def dsp_update_commitment(commitments: nil)
26
+ request(:post, "/adsApi/v1/update/commitments/dsp", json: { "commitments" => commitments }.compact)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmazonAds
4
+ class KeywordReservationValidations < API
5
+ # Validate keyword reservation
6
+ #: (?keyword_reservation_validations: Array[untyped]?) -> HTTP::Response
7
+ def sb_create_keyword_reservation_validation(keyword_reservation_validations: nil)
8
+ request(:post, "/adsApi/v1/create/keywordReservationValidations/sb", json: { "keywordReservationValidations" => keyword_reservation_validations }.compact)
9
+ end
10
+ end
11
+ end