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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -16
  3. data/lib/amazon_ads/api.rb +47 -97
  4. data/lib/amazon_ads/apis/ad_associations.rb +30 -0
  5. data/lib/amazon_ads/apis/ad_extensions.rb +24 -0
  6. data/lib/amazon_ads/apis/ad_groups.rb +30 -0
  7. data/lib/amazon_ads/apis/ads.rb +30 -0
  8. data/lib/amazon_ads/apis/advertising_deal_targets.rb +24 -0
  9. data/lib/amazon_ads/apis/advertising_deals.rb +30 -0
  10. data/lib/amazon_ads/apis/brand_store_edition_publish_versions.rb +18 -0
  11. data/lib/amazon_ads/apis/brand_store_editions.rb +12 -0
  12. data/lib/amazon_ads/apis/brand_store_pages.rb +12 -0
  13. data/lib/amazon_ads/apis/brand_stores.rb +12 -0
  14. data/lib/amazon_ads/apis/branded_keywords_pricings.rb +12 -0
  15. data/lib/amazon_ads/apis/campaign_forecasts.rb +12 -0
  16. data/lib/amazon_ads/apis/campaigns.rb +30 -0
  17. data/lib/amazon_ads/apis/commitment_spends.rb +12 -0
  18. data/lib/amazon_ads/apis/commitments.rb +30 -0
  19. data/lib/amazon_ads/apis/keyword_reservation_validations.rb +12 -0
  20. data/lib/amazon_ads/apis/marketing_stream.rb +73 -0
  21. data/lib/amazon_ads/apis/profiles.rb +15 -14
  22. data/lib/amazon_ads/apis/recommendation_types.rb +12 -0
  23. data/lib/amazon_ads/apis/recommendations.rb +12 -0
  24. data/lib/amazon_ads/apis/reporting.rb +30 -0
  25. data/lib/amazon_ads/apis/targets.rb +30 -0
  26. data/lib/amazon_ads/lwa.rb +36 -57
  27. data/lib/amazon_ads/version.rb +1 -1
  28. data/lib/amazon_ads.rb +28 -15
  29. data/sig/generated/amazon_ads/api.rbs +20 -38
  30. data/sig/generated/amazon_ads/apis/ad_associations.rbs +21 -0
  31. data/sig/generated/amazon_ads/apis/ad_extensions.rbs +17 -0
  32. data/sig/generated/amazon_ads/apis/ad_groups.rbs +21 -0
  33. data/sig/generated/amazon_ads/apis/ads.rbs +21 -0
  34. data/sig/generated/amazon_ads/apis/advertising_deal_targets.rbs +17 -0
  35. data/sig/generated/amazon_ads/apis/advertising_deals.rbs +21 -0
  36. data/sig/generated/amazon_ads/apis/brand_store_edition_publish_versions.rbs +13 -0
  37. data/sig/generated/amazon_ads/apis/brand_store_editions.rbs +9 -0
  38. data/sig/generated/amazon_ads/apis/brand_store_pages.rbs +9 -0
  39. data/sig/generated/amazon_ads/apis/brand_stores.rbs +9 -0
  40. data/sig/generated/amazon_ads/apis/branded_keywords_pricings.rbs +9 -0
  41. data/sig/generated/amazon_ads/apis/campaign_forecasts.rbs +9 -0
  42. data/sig/generated/amazon_ads/apis/campaigns.rbs +21 -0
  43. data/sig/generated/amazon_ads/apis/commitment_spends.rbs +9 -0
  44. data/sig/generated/amazon_ads/apis/commitments.rbs +21 -0
  45. data/sig/generated/amazon_ads/apis/keyword_reservation_validations.rbs +9 -0
  46. data/sig/generated/amazon_ads/apis/marketing_stream.rbs +56 -0
  47. data/sig/generated/amazon_ads/apis/profiles.rbs +12 -10
  48. data/sig/generated/amazon_ads/apis/recommendation_types.rbs +9 -0
  49. data/sig/generated/amazon_ads/apis/recommendations.rbs +9 -0
  50. data/sig/generated/amazon_ads/apis/reporting.rbs +23 -0
  51. data/sig/generated/amazon_ads/apis/streams.rbs +40 -0
  52. data/sig/generated/amazon_ads/apis/targets.rbs +21 -0
  53. data/sig/generated/amazon_ads/lwa.rbs +21 -23
  54. data/sig/generated/amazon_ads.rbs +23 -9
  55. metadata +59 -9
  56. data/lib/amazon_ads/apis/sponsored_products.rb +0 -76
  57. data/lib/amazon_ads/client.rb +0 -38
  58. data/lib/amazon_ads/configuration.rb +0 -34
  59. data/lib/amazon_ads/errors.rb +0 -43
  60. data/sig/generated/amazon_ads/client.rbs +0 -28
  61. data/sig/generated/amazon_ads/configuration.rbs +0 -24
  62. data/sig/generated/amazon_ads/errors.rbs +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4e68acc1d736bb5c7f6a59b10163bce7a2622065a291fcebfe3aafd7e028fa2
4
- data.tar.gz: 3f33dd9eeae73cfb943bf548efbb842393aea4b42d6b8f87fb79e8faad4f9d49
3
+ metadata.gz: 576fb2a70351a890db1f8792fb65fca433b06f9aa33ce4b037b674b2bcc8beff
4
+ data.tar.gz: 4326197b234cd8917b176645c7732a9ab77e66fc1fe79173907b7ff2c1640381
5
5
  SHA512:
6
- metadata.gz: ef4d4bf550a0c1cbee2ca11b469906d576e35a1db35978e52896572ad202a0905d32087810e1ee750b358ee9409bb073b1f863485847588bfd1f2cfce7f901bf
7
- data.tar.gz: 6755c1f89af12711d7dd3970e1ac37e9e3ac1872c944f497030bfa74a84e5cbbd825af087719cf68104e6be019302f7639138c0dcbe6006b2294dcf490448080
6
+ metadata.gz: dac34993c1d5100be01ded6aedaf59bc6819bae76fb18817eff7839a43723468e1d54419f9ae4ba0b7cf8bb4cd53bd85a5a98cc6891b8804c9350728d167fc0c
7
+ data.tar.gz: 2f2de968113e103e2422b61687b1e01b10962c628c188d60e3c0dabc69895814bb216013e35744a8f17551b515f832179ed1a6e5c563ecbc5b74dd7ec66aa592
data/README.md CHANGED
@@ -1,39 +1,72 @@
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:
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 at https://github.com/[USERNAME]/sponsor.
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
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
72
+ MIT
@@ -5,46 +5,68 @@
5
5
  require "http"
6
6
 
7
7
  module AmazonAds
8
- # Base class for Amazon Ads API clients.
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: "https://advertising-api.amazon.com",
13
- eu: "https://advertising-api-eu.amazon.com",
14
- fe: "https://advertising-api-fe.amazon.com",
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
- MAX_RETRIES = 3 #: Integer
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
- #: (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
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
- unless @access_token || @lwa
31
- raise ArgumentError, "Either access_token or lwa must be provided"
32
- end
36
+ @account_id = account_id
37
+ @retries = retries
38
+ @http = http
33
39
  end
34
40
 
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"
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
- HTTP
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
- 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}") }
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