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
@@ -0,0 +1,9 @@
1
+ # Generated from lib/amazon_ads/apis/brand_stores.rb with RBS::Inline
2
+
3
+ module AmazonAds
4
+ class BrandStores < API
5
+ # Query brand store content
6
+ # : (store_name_filter: String, ?max_results: Integer?, ?next_token: String?, ?sort: Array[untyped]?) -> HTTP::Response
7
+ def query_brand_store: (store_name_filter: String, ?max_results: Integer?, ?next_token: String?, ?sort: Array[untyped]?) -> HTTP::Response
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # Generated from lib/amazon_ads/apis/branded_keywords_pricings.rb with RBS::Inline
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: Array[untyped]?) -> HTTP::Response
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # Generated from lib/amazon_ads/apis/campaign_forecasts.rb with RBS::Inline
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: Array[untyped]?) -> HTTP::Response
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ # Generated from lib/amazon_ads/apis/campaigns.rb with RBS::Inline
2
+
3
+ module AmazonAds
4
+ class Campaigns < API
5
+ # Create campaigns
6
+ # : (?campaigns: Array[untyped]?) -> HTTP::Response
7
+ def create_campaign: (?campaigns: Array[untyped]?) -> HTTP::Response
8
+
9
+ # Delete campaigns
10
+ # : (?campaign_ids: Array[untyped]?) -> HTTP::Response
11
+ def delete_campaign: (?campaign_ids: Array[untyped]?) -> HTTP::Response
12
+
13
+ # Query campaign
14
+ # : (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
15
+ def query_campaign: (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
16
+
17
+ # Update campaign
18
+ # : (?campaigns: Array[untyped]?) -> HTTP::Response
19
+ def update_campaign: (?campaigns: Array[untyped]?) -> HTTP::Response
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ # Generated from lib/amazon_ads/apis/commitment_spends.rb with RBS::Inline
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: Array[untyped]?) -> HTTP::Response
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ # Generated from lib/amazon_ads/apis/commitments.rb with RBS::Inline
2
+
3
+ module AmazonAds
4
+ class Commitments < API
5
+ # Create commitments
6
+ # : (?commitments: Array[untyped]?) -> HTTP::Response
7
+ def dsp_create_commitment: (?commitments: Array[untyped]?) -> HTTP::Response
8
+
9
+ # List commitments
10
+ # : (?next_token: String?, ?max_results: Integer?) -> HTTP::Response
11
+ def dsp_list_commitment: (?next_token: String?, ?max_results: Integer?) -> HTTP::Response
12
+
13
+ # Get Commitments
14
+ # : (?commitment_ids: Array[untyped]?) -> HTTP::Response
15
+ def dsp_retrieve_commitment: (?commitment_ids: Array[untyped]?) -> HTTP::Response
16
+
17
+ # Update commitments
18
+ # : (?commitments: Array[untyped]?) -> HTTP::Response
19
+ def dsp_update_commitment: (?commitments: Array[untyped]?) -> HTTP::Response
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ # Generated from lib/amazon_ads/apis/keyword_reservation_validations.rb with RBS::Inline
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: Array[untyped]?) -> HTTP::Response
8
+ end
9
+ end
@@ -0,0 +1,56 @@
1
+ # Generated from lib/amazon_ads/apis/marketing_stream.rb with RBS::Inline
2
+
3
+ module AmazonAds
4
+ # Amazon Marketing Stream
5
+ class MarketingStream < API
6
+ # Create a new subscription Note: trailing slash in request uri is not allowed
7
+ # @rbs client_request_token: String -- Unique value supplied by the caller used to track identical API requests. Should request be re-tried, the caller should supply the same value. We recommend using GUID.
8
+ # @rbs data_set_id: String -- Identifier of data set, callers can be subscribed to. Please refer to https://advertising.amazon.com/API/docs/en-us/amazon-marketing-stream/data-guide for the list of all data sets.
9
+ # @rbs destination_arn: String -- AWS ARN of the destination endpoint associated with the subscription. Supported destination types: - SQS
10
+ # @rbs notes: String -- Additional details associated with the subscription
11
+ # : (client_request_token: String, data_set_id: String, ?destination: String?, ?destination_arn: String?, ?notes: String?) -> HTTP::Response
12
+ def create_dsp_stream_subscription: (client_request_token: String, data_set_id: String, ?destination: String?, ?destination_arn: String?, ?notes: String?) -> HTTP::Response
13
+
14
+ # Create a new subscription Note: trailing slash in request uri is not allowed
15
+ # @rbs client_request_token: String -- Unique value supplied by the caller used to track identical API requests. Should request be re-tried, the caller should supply the same value. We recommend using GUID.
16
+ # @rbs data_set_id: String -- Identifier of data set, callers can be subscribed to. Please refer to https://advertising.amazon.com/API/docs/en-us/amazon-marketing-stream/data-guide for the list of all data sets.
17
+ # @rbs destination_arn: String -- AWS ARN of the destination endpoint associated with the subscription. Supported destination types: - SQS
18
+ # @rbs notes: String -- Additional details associated with the subscription
19
+ # : (client_request_token: String, data_set_id: String, ?destination: String?, ?destination_arn: String?, ?notes: String?) -> HTTP::Response
20
+ def create_stream_subscription: (client_request_token: String, data_set_id: String, ?destination: String?, ?destination_arn: String?, ?notes: String?) -> HTTP::Response
21
+
22
+ # Fetch a specific subscription by Id Note: trailing slash in request uri is not allowed
23
+ # @rbs subscription_id: String -- Unique subscription identifier
24
+ # : (String) -> HTTP::Response
25
+ def get_dsp_stream_subscription: (String) -> HTTP::Response
26
+
27
+ # Fetch a specific subscription by Id Note: trailing slash in request uri is not allowed
28
+ # @rbs subscription_id: String -- Unique subscription identifier
29
+ # : (String) -> HTTP::Response
30
+ def get_stream_subscription: (String) -> HTTP::Response
31
+
32
+ # List subscriptions Note: trailing slash in request uri is not allowed
33
+ # @rbs max_results: Numeric -- desired number of entries in the response, defaults to maximum value
34
+ # @rbs starting_token: String -- Token which can be used to get the next page of results, if more entries exist
35
+ # : (?max_results: Numeric?, ?starting_token: String?) -> HTTP::Response
36
+ def list_dsp_stream_subscriptions: (?max_results: Numeric?, ?starting_token: String?) -> HTTP::Response
37
+
38
+ # List subscriptions Note: trailing slash in request uri is not allowed
39
+ # @rbs max_results: Numeric -- desired number of entries in the response, defaults to maximum value
40
+ # @rbs starting_token: String -- Token which can be used to get the next page of results, if more entries exist
41
+ # : (?max_results: Numeric?, ?starting_token: String?) -> HTTP::Response
42
+ def list_stream_subscriptions: (?max_results: Numeric?, ?starting_token: String?) -> HTTP::Response
43
+
44
+ # Update an existing subscription Note: trailing slash in request uri is not allowed
45
+ # @rbs subscription_id: String -- Unique subscription identifier
46
+ # @rbs notes: String -- Additional details associated with the subscription
47
+ # : (String, ?notes: String?, ?status: String?) -> HTTP::Response
48
+ def update_dsp_stream_subscription: (String, ?notes: String?, ?status: String?) -> HTTP::Response
49
+
50
+ # Update an existing subscription Note: trailing slash in request uri is not allowed
51
+ # @rbs subscription_id: String -- Unique subscription identifier
52
+ # @rbs notes: String -- Additional details associated with the subscription
53
+ # : (String, ?notes: String?, ?status: String?) -> HTTP::Response
54
+ def update_stream_subscription: (String, ?notes: String?, ?status: String?) -> HTTP::Response
55
+ end
56
+ end
@@ -2,19 +2,21 @@
2
2
 
3
3
  module AmazonAds
4
4
  # Amazon Ads API - Profiles
5
- #
6
- # @see https://advertising.amazon.com/API/docs/en-us/reference/profiles
7
5
  class Profiles < API
6
+ # Gets a profile specified by identifier.
7
+ # : (Integer) -> HTTP::Response
8
+ def get_profile_by_id: (Integer) -> HTTP::Response
9
+
8
10
  # Gets a list of profiles.
9
- # : (?api_program: String?, ?access_level: String?, ?profile_type_filter: String?, ?valid_payment_method_filter: String?) -> untyped
10
- def list_profiles: (?api_program: String?, ?access_level: String?, ?profile_type_filter: String?, ?valid_payment_method_filter: String?) -> untyped
11
+ # @rbs api_program: String -- Filters response to include profiles that have permissions for the specified Advertising API program only. Setting `apiProgram=billing` filters the response to include only profiles to which the user and application associated with the access token have permission to view or edit billing information.
12
+ # @rbs access_level: String -- Filters response to include profiles that have specified permissions for the specified Advertising API program only. Currently, the only supported access level is `view` and `edit`. Setting `accessLevel=view` filters the response to include only profiles to which the user and application associated with the access token have view permission to the provided api program.
13
+ # @rbs profile_type_filter: String -- Filters response to include profiles that are of the specified types in the comma-delimited list. Default is all types. Note that this filter performs an inclusive AND operation on the types.
14
+ # @rbs valid_payment_method_filter: String -- Filter response to include profiles that have valid payment methods. Default is to include all profiles. Setting this filter to `true` returns only profiles with either no `validPaymentMethod` field, or the `validPaymentMethod` field set to `true`. Setting this to `false` returns profiles with the `validPaymentMethod` field set to `false` only.
15
+ # : (?api_program: String?, ?access_level: String?, ?profile_type_filter: String?, ?valid_payment_method_filter: String?) -> HTTP::Response
16
+ def list_profiles: (?api_program: String?, ?access_level: String?, ?profile_type_filter: String?, ?valid_payment_method_filter: String?) -> HTTP::Response
11
17
 
12
18
  # Update the daily budget for one or more profiles.
13
- # : (?body: Hash[String, untyped]) -> untyped
14
- def update_profiles: (?body: Hash[String, untyped]) -> untyped
15
-
16
- # Gets a profile specified by identifier.
17
- # : (Integer) -> untyped
18
- def get_profile_by_id: (Integer) -> untyped
19
+ # : (?json: untyped) -> HTTP::Response
20
+ def update_profiles: (?json: untyped) -> HTTP::Response
19
21
  end
20
22
  end
@@ -0,0 +1,9 @@
1
+ # Generated from lib/amazon_ads/apis/recommendation_types.rb with RBS::Inline
2
+
3
+ module AmazonAds
4
+ class RecommendationTypes < API
5
+ # Query RecommendationTypes
6
+ # : (?max_results: Integer?, ?next_token: String?) -> HTTP::Response
7
+ def sb_query_recommendation_type: (?max_results: Integer?, ?next_token: String?) -> HTTP::Response
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # Generated from lib/amazon_ads/apis/recommendations.rb with RBS::Inline
2
+
3
+ module AmazonAds
4
+ class Recommendations < API
5
+ # Create recommendations
6
+ # : (?recommendations: Array[untyped]?) -> HTTP::Response
7
+ def sb_create_recommendation: (?recommendations: Array[untyped]?) -> HTTP::Response
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ # Generated from lib/amazon_ads/apis/reporting.rb with RBS::Inline
2
+
3
+ module AmazonAds
4
+ # Offline Report
5
+ class Reporting < API
6
+ # Creates a report request
7
+ # @rbs end_date: String -- YYYY-MM-DD format. The maximum lookback window supported depends on the selection of reportTypeId. Most report types support `95 days` as lookback window.
8
+ # @rbs name: String -- The name of the report.
9
+ # @rbs start_date: String -- YYYY-MM-DD format. The maximum lookback window supported depends on the selection of reportTypeId. Most report types support `95 days` as lookback window.
10
+ # : (configuration: untyped, end_date: String, start_date: String, ?name: String?) -> HTTP::Response
11
+ def create_async_report: (configuration: untyped, end_date: String, start_date: String, ?name: String?) -> HTTP::Response
12
+
13
+ # Deletes a report by id
14
+ # @rbs report_id: String -- The identifier of the requested report.
15
+ # : (String) -> HTTP::Response
16
+ def delete_async_report: (String) -> HTTP::Response
17
+
18
+ # Gets a generation status of report by id
19
+ # @rbs report_id: String -- The identifier of the requested report.
20
+ # : (String) -> HTTP::Response
21
+ def get_async_report: (String) -> HTTP::Response
22
+ end
23
+ end
@@ -0,0 +1,40 @@
1
+ # Generated from lib/amazon_ads/apis/streams.rb with RBS::Inline
2
+
3
+ module AmazonAds
4
+ # Amazon Marketing Stream subscription management
5
+ class Streams < API
6
+ CONTENT_TYPE: ::String
7
+
8
+ # Lists stream subscriptions
9
+ # : (?max_results: Integer?, ?starting_token: String?) -> HTTP::Response
10
+ def list_subscriptions: (?max_results: Integer?, ?starting_token: String?) -> HTTP::Response
11
+
12
+ # Creates a new stream subscription
13
+ # : (?json: untyped) -> HTTP::Response
14
+ def create_subscription: (?json: untyped) -> HTTP::Response
15
+
16
+ # Fetches a specific subscription by ID
17
+ # : (String) -> HTTP::Response
18
+ def get_subscription: (String) -> HTTP::Response
19
+
20
+ # Updates an existing subscription
21
+ # : (String, ?json: untyped) -> HTTP::Response
22
+ def update_subscription: (String, ?json: untyped) -> HTTP::Response
23
+
24
+ # Lists DSP stream subscriptions
25
+ # : (?max_results: Integer?, ?starting_token: String?) -> HTTP::Response
26
+ def dsp_list_subscriptions: (?max_results: Integer?, ?starting_token: String?) -> HTTP::Response
27
+
28
+ # Creates a new DSP stream subscription
29
+ # : (?json: untyped) -> HTTP::Response
30
+ def dsp_create_subscription: (?json: untyped) -> HTTP::Response
31
+
32
+ # Fetches a specific DSP subscription by ID
33
+ # : (String) -> HTTP::Response
34
+ def dsp_get_subscription: (String) -> HTTP::Response
35
+
36
+ # Updates an existing DSP subscription
37
+ # : (String, ?json: untyped) -> HTTP::Response
38
+ def dsp_update_subscription: (String, ?json: untyped) -> HTTP::Response
39
+ end
40
+ end
@@ -0,0 +1,21 @@
1
+ # Generated from lib/amazon_ads/apis/targets.rb with RBS::Inline
2
+
3
+ module AmazonAds
4
+ class Targets < API
5
+ # Create target
6
+ # : (?targets: Array[untyped]?) -> HTTP::Response
7
+ def create_target: (?targets: Array[untyped]?) -> HTTP::Response
8
+
9
+ # Delete target
10
+ # : (?target_ids: Array[untyped]?) -> HTTP::Response
11
+ def delete_target: (?target_ids: Array[untyped]?) -> HTTP::Response
12
+
13
+ # List target
14
+ # : (ad_product_filter: String, ?ad_group_id_filter: String?, ?campaign_id_filter: String?, ?keyword_filter: String?, ?marketplace_scope_filter: String?, ?match_type_filter: String?, ?max_results: Integer?, ?native_language_locale_filter: String?, ?negative_filter: String?, ?next_token: String?, ?product_id_filter: String?, ?state_filter: String?, ?target_id_filter: String?, ?target_type_filter: String?) -> HTTP::Response
15
+ def query_target: (ad_product_filter: String, ?ad_group_id_filter: String?, ?campaign_id_filter: String?, ?keyword_filter: String?, ?marketplace_scope_filter: String?, ?match_type_filter: String?, ?max_results: Integer?, ?native_language_locale_filter: String?, ?negative_filter: String?, ?next_token: String?, ?product_id_filter: String?, ?state_filter: String?, ?target_id_filter: String?, ?target_type_filter: String?) -> HTTP::Response
16
+
17
+ # Update target
18
+ # : (?targets: Array[untyped]?) -> HTTP::Response
19
+ def update_target: (?targets: Array[untyped]?) -> HTTP::Response
20
+ end
21
+ end
@@ -1,39 +1,37 @@
1
1
  # Generated from lib/amazon_ads/lwa.rb with RBS::Inline
2
2
 
3
3
  module AmazonAds
4
- # Requests Login with Amazon (LWA) access tokens for the Amazon Ads API.
5
- # Handles token caching and automatic refresh when tokens expire.
6
- #
7
- # @see https://advertising.amazon.com/API/docs/en-us/info/api-overview
4
+ # Requests Login with Amazon (LWA) access tokens for the Amazon Ads API
5
+ # Stateless: each call to #request hits the token endpoint; the caller
6
+ # owns caching
8
7
  class LWA
9
8
  URL: String
10
9
 
11
- TOKEN_EXPIRY_BUFFER: Integer
10
+ # The OAuth refresh token
11
+ attr_reader refresh_token: String
12
12
 
13
- attr_reader client_id: String
13
+ # : (**untyped) -> Hash[String, untyped]
14
+ def self.request: (**untyped) -> Hash[String, untyped]
14
15
 
15
- attr_reader client_secret: String
16
+ # : (refresh_token: String, ?http: untyped) -> void
17
+ def initialize: (refresh_token: String, ?http: untyped) -> void
16
18
 
17
- attr_reader refresh_token: String
19
+ # Requests a fresh access token from LWA
20
+ # : () -> Hash[String, untyped]
21
+ def request: () -> Hash[String, untyped]
18
22
 
19
- # : (?client_id: String, ?client_secret: String, ?refresh_token: String) -> void
20
- def initialize: (?client_id: String, ?client_secret: String, ?refresh_token: String) -> void
23
+ private
21
24
 
22
- # Returns a valid access token, refreshing if necessary.
23
- # : () -> String
24
- def access_token: () -> String
25
+ # : () -> HTTP::Client
26
+ def http: () -> HTTP::Client
25
27
 
26
- # Forces a token refresh regardless of expiry.
27
- # : () -> String
28
- def refresh!: () -> String
28
+ # : () -> Hash[Symbol, String]
29
+ def params: () -> Hash[Symbol, String]
29
30
 
30
- # Returns true if the token is expired or not yet fetched.
31
- # : () -> bool
32
- def token_expired?: () -> bool
33
-
34
- private
31
+ # : () -> String
32
+ def client_id: () -> String
35
33
 
36
- # : () -> Hash[String, String]
37
- def params: () -> Hash[String, String]
34
+ # : () -> String
35
+ def client_secret: () -> String
38
36
  end
39
37
  end
@@ -2,15 +2,29 @@
2
2
 
3
3
  # Amazon Ads API client for Ruby
4
4
  module AmazonAds
5
- # Returns the global configuration object.
6
- # : () -> Configuration
7
- def self.configuration: () -> Configuration
5
+ # Returns the client ID
6
+ # Falls back to the `AMAZON_ADS_CLIENT_ID` env var
7
+ # : () -> String?
8
+ def self.client_id: () -> String?
8
9
 
9
- # Configures the AmazonAds library.
10
- # : () { (Configuration) -> void } -> void
11
- def self.configure: () { (Configuration) -> void } -> void
10
+ # Sets the client ID
11
+ # : (String?) -> String?
12
+ attr_writer client_id: untyped
12
13
 
13
- # Resets the configuration to defaults.
14
- # : () -> void
15
- def self.reset_configuration!: () -> void
14
+ # Returns the client ID or raises
15
+ # : () -> String
16
+ def self.client_id!: () -> String
17
+
18
+ # Returns the client secret
19
+ # Falls back to the `AMAZON_ADS_CLIENT_SECRET` env var
20
+ # : () -> String?
21
+ def self.client_secret: () -> String?
22
+
23
+ # Sets the client secret
24
+ # : (String?) -> String?
25
+ attr_writer client_secret: untyped
26
+
27
+ # Returns the client secret or raises
28
+ # : () -> String
29
+ def self.client_secret!: () -> String
16
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon-ads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
@@ -9,6 +9,20 @@ bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: cgi
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
12
26
  - !ruby/object:Gem::Dependency
13
27
  name: http
14
28
  requirement: !ruby/object:Gem::Requirement
@@ -47,20 +61,56 @@ files:
47
61
  - README.md
48
62
  - lib/amazon_ads.rb
49
63
  - lib/amazon_ads/api.rb
64
+ - lib/amazon_ads/apis/ad_associations.rb
65
+ - lib/amazon_ads/apis/ad_extensions.rb
66
+ - lib/amazon_ads/apis/ad_groups.rb
67
+ - lib/amazon_ads/apis/ads.rb
68
+ - lib/amazon_ads/apis/advertising_deal_targets.rb
69
+ - lib/amazon_ads/apis/advertising_deals.rb
70
+ - lib/amazon_ads/apis/brand_store_edition_publish_versions.rb
71
+ - lib/amazon_ads/apis/brand_store_editions.rb
72
+ - lib/amazon_ads/apis/brand_store_pages.rb
73
+ - lib/amazon_ads/apis/brand_stores.rb
74
+ - lib/amazon_ads/apis/branded_keywords_pricings.rb
75
+ - lib/amazon_ads/apis/campaign_forecasts.rb
76
+ - lib/amazon_ads/apis/campaigns.rb
77
+ - lib/amazon_ads/apis/commitment_spends.rb
78
+ - lib/amazon_ads/apis/commitments.rb
79
+ - lib/amazon_ads/apis/keyword_reservation_validations.rb
80
+ - lib/amazon_ads/apis/marketing_stream.rb
50
81
  - lib/amazon_ads/apis/profiles.rb
51
- - lib/amazon_ads/apis/sponsored_products.rb
52
- - lib/amazon_ads/client.rb
53
- - lib/amazon_ads/configuration.rb
54
- - lib/amazon_ads/errors.rb
82
+ - lib/amazon_ads/apis/recommendation_types.rb
83
+ - lib/amazon_ads/apis/recommendations.rb
84
+ - lib/amazon_ads/apis/reporting.rb
85
+ - lib/amazon_ads/apis/targets.rb
55
86
  - lib/amazon_ads/lwa.rb
56
87
  - lib/amazon_ads/version.rb
57
88
  - sig/generated/amazon_ads.rbs
58
89
  - sig/generated/amazon_ads/api.rbs
90
+ - sig/generated/amazon_ads/apis/ad_associations.rbs
91
+ - sig/generated/amazon_ads/apis/ad_extensions.rbs
92
+ - sig/generated/amazon_ads/apis/ad_groups.rbs
93
+ - sig/generated/amazon_ads/apis/ads.rbs
94
+ - sig/generated/amazon_ads/apis/advertising_deal_targets.rbs
95
+ - sig/generated/amazon_ads/apis/advertising_deals.rbs
96
+ - sig/generated/amazon_ads/apis/brand_store_edition_publish_versions.rbs
97
+ - sig/generated/amazon_ads/apis/brand_store_editions.rbs
98
+ - sig/generated/amazon_ads/apis/brand_store_pages.rbs
99
+ - sig/generated/amazon_ads/apis/brand_stores.rbs
100
+ - sig/generated/amazon_ads/apis/branded_keywords_pricings.rbs
101
+ - sig/generated/amazon_ads/apis/campaign_forecasts.rbs
102
+ - sig/generated/amazon_ads/apis/campaigns.rbs
103
+ - sig/generated/amazon_ads/apis/commitment_spends.rbs
104
+ - sig/generated/amazon_ads/apis/commitments.rbs
105
+ - sig/generated/amazon_ads/apis/keyword_reservation_validations.rbs
106
+ - sig/generated/amazon_ads/apis/marketing_stream.rbs
59
107
  - sig/generated/amazon_ads/apis/profiles.rbs
108
+ - sig/generated/amazon_ads/apis/recommendation_types.rbs
109
+ - sig/generated/amazon_ads/apis/recommendations.rbs
110
+ - sig/generated/amazon_ads/apis/reporting.rbs
60
111
  - sig/generated/amazon_ads/apis/sponsored_products.rbs
61
- - sig/generated/amazon_ads/client.rbs
62
- - sig/generated/amazon_ads/configuration.rbs
63
- - sig/generated/amazon_ads/errors.rbs
112
+ - sig/generated/amazon_ads/apis/streams.rbs
113
+ - sig/generated/amazon_ads/apis/targets.rbs
64
114
  - sig/generated/amazon_ads/lwa.rbs
65
115
  homepage: https://github.com/lineofflight/amazon-ads-ruby
66
116
  licenses:
@@ -77,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
127
  requirements:
78
128
  - - ">="
79
129
  - !ruby/object:Gem::Version
80
- version: 3.2.0
130
+ version: 3.3.0
81
131
  required_rubygems_version: !ruby/object:Gem::Requirement
82
132
  requirements:
83
133
  - - ">="
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # rbs_inline: enabled
4
-
5
- module AmazonAds
6
- # Amazon Ads API - Sponsored Products
7
- #
8
- # @see https://advertising.amazon.com/API/docs/en-us/sponsored-products
9
- class SponsoredProducts < API
10
- # Gets a bid recommendation for an ad group. [PLANNED DEPRECATION 3/27/2024]
11
- #: (Numeric) -> untyped
12
- def get_ad_group_bid_recommendations(ad_group_id)
13
- get("/v2/sp/adGroups/#{ad_group_id}/bidRecommendations")
14
- end
15
-
16
- # Gets a bid recommendation for a keyword. [PLANNED DEPRECATION 3/27/2024]
17
- #: (Numeric) -> untyped
18
- def get_keyword_bid_recommendations(keyword_id)
19
- get("/v2/sp/keywords/#{keyword_id}/bidRecommendations")
20
- end
21
-
22
- # Gets bid recommendations for keywords. [PLANNED DEPRECATION 3/27/2024]
23
- #: (?body: Hash[String, untyped]) -> untyped
24
- def create_keyword_bid_recommendations(body: {})
25
- post("/v2/sp/keywords/bidRecommendations", body: body)
26
- end
27
-
28
- # Gets suggested keywords for the specified ad group.
29
- #: (Numeric, ?max_num_suggestions: Integer?, ?ad_state_filter: String?) -> untyped
30
- def get_ad_group_suggested_keywords(ad_group_id, max_num_suggestions: nil, ad_state_filter: nil)
31
- get("/v2/sp/adGroups/#{ad_group_id}/suggested/keywords", params: { "maxNumSuggestions" => max_num_suggestions, "adStateFilter" => ad_state_filter }.compact)
32
- end
33
-
34
- # Gets suggested keywords with extended data for the specified ad group.
35
- #: (Numeric, ?max_num_suggestions: Integer?, ?suggest_bids: String?, ?ad_state_filter: String?) -> untyped
36
- def get_ad_group_suggested_keywords_ex(ad_group_id, max_num_suggestions: nil, suggest_bids: nil, ad_state_filter: nil)
37
- get("/v2/sp/adGroups/#{ad_group_id}/suggested/keywords/extended", params: { "maxNumSuggestions" => max_num_suggestions, "suggestBids" => suggest_bids, "adStateFilter" => ad_state_filter }.compact)
38
- end
39
-
40
- # Gets suggested keywords for the specified ASIN.
41
- #: (String, ?max_num_suggestions: Integer?) -> untyped
42
- def get_asin_suggested_keywords(asin_value, max_num_suggestions: nil)
43
- get("/v2/sp/asins/#{asin_value}/suggested/keywords", params: { "maxNumSuggestions" => max_num_suggestions }.compact)
44
- end
45
-
46
- # Gets suggested keyword for a specified list of ASINs.
47
- #: (?body: Hash[String, untyped]) -> untyped
48
- def bulk_get_asin_suggested_keywords(body: {})
49
- post("/v2/sp/asins/suggested/keywords", body: body)
50
- end
51
-
52
- # Gets a list of bid recommendations for keyword, product, or auto targeting expressions.
53
- #: (?body: Hash[String, untyped]) -> untyped
54
- def get_bid_recommendations(body: {})
55
- post("/v2/sp/targets/bidRecommendations", body: body)
56
- end
57
-
58
- # Request a snapshot
59
- #: (String, ?body: Hash[String, untyped]) -> untyped
60
- def request_snapshot(record_type, body: {})
61
- post("/v2/sp/#{record_type}/snapshot", body: body)
62
- end
63
-
64
- # Get the status of a requested snapshot
65
- #: (Numeric) -> untyped
66
- def get_snapshot_status(snapshot_id)
67
- get("/v2/sp/snapshots/#{snapshot_id}")
68
- end
69
-
70
- # Download requested snapshot
71
- #: (Numeric) -> untyped
72
- def download_snapshot(snapshot_id)
73
- get("/v2/sp/snapshots/#{snapshot_id}/download")
74
- end
75
- end
76
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # rbs_inline: enabled
4
-
5
- module AmazonAds
6
- # High-level client for Amazon Ads API.
7
- # Provides convenient access to all API endpoints with automatic authentication.
8
- class Client
9
- attr_reader :lwa #: LWA
10
- attr_reader :region #: Symbol
11
- attr_reader :profile_id #: String?
12
-
13
- #: (?region: Symbol, ?profile_id: String?, ?lwa: LWA?) -> void
14
- def initialize(region: AmazonAds.configuration.region, profile_id: AmazonAds.configuration.profile_id, lwa: nil)
15
- @lwa = lwa || AmazonAds.configuration.lwa
16
- @region = region
17
- @profile_id = profile_id
18
- end
19
-
20
- # Access Profiles API
21
- #: () -> Profiles
22
- def profiles
23
- @profiles ||= Profiles.new(region: region, lwa: lwa, profile_id: profile_id)
24
- end
25
-
26
- # Access Sponsored Products API
27
- #: () -> SponsoredProducts
28
- def sponsored_products
29
- @sponsored_products ||= SponsoredProducts.new(region: region, lwa: lwa, profile_id: profile_id)
30
- end
31
-
32
- # Creates a new client with a different profile ID
33
- #: (String) -> Client
34
- def with_profile(profile_id)
35
- Client.new(region: region, profile_id: profile_id, lwa: lwa)
36
- end
37
- end
38
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # rbs_inline: enabled
4
-
5
- module AmazonAds
6
- # Configuration for the AmazonAds library.
7
- # Centralizes settings for authentication and API access.
8
- class Configuration
9
- attr_accessor :client_id #: String?
10
- attr_accessor :client_secret #: String?
11
- attr_accessor :refresh_token #: String?
12
- attr_accessor :region #: Symbol
13
- attr_accessor :profile_id #: String?
14
-
15
- #: () -> void
16
- def initialize
17
- @client_id = ENV["AMAZON_ADS_CLIENT_ID"]
18
- @client_secret = ENV["AMAZON_ADS_CLIENT_SECRET"]
19
- @refresh_token = ENV["AMAZON_ADS_REFRESH_TOKEN"]
20
- @region = :na
21
- @profile_id = nil
22
- end
23
-
24
- # Builds an LWA instance from the configuration.
25
- #: () -> LWA
26
- def lwa
27
- LWA.new(
28
- client_id: client_id || raise(ArgumentError, "client_id is required"),
29
- client_secret: client_secret || raise(ArgumentError, "client_secret is required"),
30
- refresh_token: refresh_token || raise(ArgumentError, "refresh_token is required"),
31
- )
32
- end
33
- end
34
- end