Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
ab17279
Add CLAUDE.md
nina-saule Aug 31, 2026
3341473
Delete Travis config, gemset, and gitmodules
nina-saule Aug 31, 2026
e4d8384
Add LICENSE, changelog, and gem metadata
nina-saule Aug 31, 2026
31ee32d
Fix spec state leaks and helper setup
nina-saule Aug 31, 2026
7b028bd
Add characterization specs for the v1 surface
nina-saule Aug 31, 2026
c4babc2
Set up RuboCop and apply safe autocorrections
nina-saule Aug 31, 2026
09c7b7f
Add GitHub Actions CI
nina-saule Aug 31, 2026
24697f8
Replace swagger-codegen with a Ruby generator
nina-saule Sep 1, 2026
74fc3c2
Regenerate vendor clients with the new generator
nina-saule Sep 1, 2026
c378629
Add generator verify job and nightly model update
nina-saule Sep 1, 2026
44c6b3d
Run model updates monthly instead of nightly
nina-saule Sep 1, 2026
b0a8e2a
Delete 17 unused vendor API modules
nina-saule Sep 1, 2026
a4271a6
Delete generated scaffolding from vendor modules
nina-saule Sep 1, 2026
1b89321
Delete dead code left by the swagger-codegen client
nina-saule Sep 1, 2026
61638f2
Remove AWS SigV4 signing and the STS session call
nina-saule Sep 1, 2026
25cfbb9
Fix grantless sessions never re-authenticating
nina-saule Sep 1, 2026
7ad086f
Fix dropped query params on POST, PUT and PATCH
nina-saule Sep 1, 2026
1721101
Send the header params built for each operation
nina-saule Sep 1, 2026
240379a
Redact secrets in raised error payloads
nina-saule Sep 1, 2026
7ea69ec
Raise a clear error for an unknown endpoint
nina-saule Sep 1, 2026
9e9151e
Stop nil-ing string-keyed ApiResponse payloads
nina-saule Sep 1, 2026
9720324
Add Saudi Arabia to MARKETPLACE_IDS
nina-saule Sep 1, 2026
3a34ac5
Apply the configured timeout to every connection
nina-saule Sep 1, 2026
5279dd0
Keep session expiry times as Time objects
nina-saule Sep 1, 2026
c32fc25
Document phase 2 changes and bump version to 1.8.0
nina-saule Sep 1, 2026
f0dd892
Update Gemfile.lock for the 1.8.0 bump
nina-saule Sep 1, 2026
b74f305
Harden error payload redaction
nina-saule Sep 1, 2026
9ea4d66
Validate marketplace id before mutating config
nina-saule Sep 1, 2026
e011f24
Pin the deprecated AWS config writers
nina-saule Sep 1, 2026
04715be
Remove debug gated logging
nina-saule Sep 1, 2026
d22404e
Remove unused faraday_middleware dependency
nina-saule Sep 1, 2026
d7a6c89
Port RaiseError to Faraday::Middleware
nina-saule Sep 1, 2026
423b84d
Allow Faraday 2
nina-saule Sep 1, 2026
f5b253d
Run the test suite against Faraday 1 and 2 in CI
nina-saule Sep 1, 2026
25b923e
Document Faraday 2 support and bump version to 1.9.0
nina-saule Sep 1, 2026
b79aa33
Fail clearly on Faraday 2 with a stale adapter
nina-saule Sep 1, 2026
1c2b5b2
Correct the Faraday 2 upgrade note
nina-saule Sep 1, 2026
342411b
Move marketplace tables to their own file
nina-saule Sep 3, 2026
9ea2b6e
Keep the deprecated settings past 2.0
nina-saule Sep 3, 2026
91eb4af
Add V2 config, token and errors
nina-saule Sep 3, 2026
988ded8
Add the V2 LWA client
nina-saule Sep 3, 2026
631eef6
Add V2 credentials
nina-saule Sep 3, 2026
7fa6640
Add the V2 client, API base and RDT
nina-saule Sep 3, 2026
6cfcc78
Add V2 document helpers
nina-saule Sep 3, 2026
4de9404
Add the V2 template set to the generator
nina-saule Sep 3, 2026
130cb28
Enforce YARD on the V2 surface
nina-saule Sep 3, 2026
f5f2df8
Generate the V2 API classes
nina-saule Sep 3, 2026
85efcc4
Pin the V2 API contract
nina-saule Sep 3, 2026
711421f
Document V2 and bump to 2.0.0
nina-saule Sep 3, 2026
e369ef7
Carry request context on parse errors
nina-saule Sep 3, 2026
c2e7503
Raise DocumentError on bodies that will not parse
nina-saule Sep 3, 2026
bfac3d3
Harden the error mapper against odd bodies and LWA 429
nina-saule Sep 3, 2026
2e276ca
Treat an empty rdt list as no RDT; stop freezing caller arrays
nina-saule Sep 3, 2026
0375c24
Keep secrets out of inspect output
nina-saule Sep 3, 2026
9db9097
Drop nil headers; tighten the generator name guard
nina-saule Sep 4, 2026
0fef2af
Correct V2 docs from review
nina-saule Sep 4, 2026
720ad32
Complete the migration table from the dry runs
nina-saule Sep 4, 2026
d1d2cbb
Match v1 files, not the whole vendor directory
nina-saule Sep 4, 2026
a08db50
Correct the LWA error row in the migration table
nina-saule Sep 4, 2026
bd6f963
Ship only the library in the built gem
nina-saule Sep 6, 2026
c8b8631
Publish only to GitHub Packages
nina-saule Sep 6, 2026
7bfd8e6
Publish the gem from version tags
nina-saule Sep 6, 2026
55edfa6
Document installing and releasing the gem
nina-saule Sep 6, 2026
238fd4f
Encode request bodies with to_json
nina-saule Sep 6, 2026
54c1977
Keep the LWA and gateway text in error messages
nina-saule Sep 6, 2026
ac5a214
Name the missing url in a document payload
nina-saule Sep 6, 2026
d3e3239
Add an RDT preset for report documents
nina-saule Sep 6, 2026
e895432
Fill in the migration table from the cart review
nina-saule Sep 6, 2026
a2656c0
Publish to rubygems.org instead of GitHub Packages
nina-saule Sep 7, 2026
c142123
Mark the gem experimental and point to peddler
nina-saule Sep 7, 2026
f90a0ca
Rename the gem to sp_api_clients
nina-saule Sep 7, 2026
5778fb5
Document the gem name in README and CLAUDE.md
nina-saule Sep 7, 2026
150cfc7
Add a standalone check of SP-API authorization
nina-saule Sep 7, 2026
8e00882
Drop internal project names from docs and specs
nina-saule Sep 7, 2026
cff98aa
Add a rake task that prepares a release
nina-saule Sep 7, 2026
cb5632f
Document the release task
nina-saule Sep 7, 2026
5021942
Add the 2.0.1 CHANGELOG entry
nina-saule Sep 7, 2026
ed10a89
Release 2.0.1
nina-saule Sep 7, 2026
951ff1d
Advance the Amazon models pin to 2026-08-26
nina-saule Sep 7, 2026
fb56c62
Let a module opt out of the rdt keyword
nina-saule Sep 7, 2026
5df0c1d
Add the Orders API v2026-01-01 to V2
nina-saule Sep 7, 2026
b0f156c
Document the 2026 Orders API
nina-saule Sep 7, 2026
d13b35a
Release 2.1.0
nina-saule Sep 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

on: [push, pull_request]

permissions:
contents: read

jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
- run: bundle exec rubocop

test:
strategy:
fail-fast: false
matrix:
ruby: ["3.3", "3.4"]
gemfile: [faraday_1, faraday_2]
runs-on: ubuntu-latest
# BUNDLE_GEMFILE must be job-level so setup-ruby installs and
# caches against the matrix gemfile instead of the root Gemfile.
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rspec

# Every public object under lib/amazon_sp_clients/v2 must carry a
# doc comment; .yardopts scopes the check.
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
- run: bundle exec rake yard:verify

# Regenerates vendor/ at the pinned Amazon spec revision and fails
# if the committed files drift from what the generator produces.
verify-generated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
- run: bundle exec rake generate:verify
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

# A version tag is the only release path. It builds the gem, pushes it
# to rubygems.org through Trusted Publishing (no API key stored anywhere)
# and opens a GitHub Release with that version's CHANGELOG entry.
# rubygems.org trusts this workflow file by name; see README, "Releasing".
on:
push:
tags: ["v*"]

permissions:
contents: write # the GitHub Release
id-token: write # the OIDC token rubygems.org exchanges for a push key

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true

# The tag must be "v" plus AmazonSpClients::VERSION.
- name: Check the tag against version.rb
run: |
version=$(ruby -Ilib -e 'require "amazon_sp_clients/version"; puts AmazonSpClients::VERSION')
if [ "v${version}" != "${GITHUB_REF_NAME}" ]; then
echo "Tag ${GITHUB_REF_NAME} does not match version ${version}" >&2
exit 1
fi

# The release notes are the CHANGELOG section for this version.
- name: Extract the CHANGELOG entry
run: |
awk -v v="${GITHUB_REF_NAME#v}" '$0 ~ "^## \\[" v "\\]" {p=1; next} /^## \[/ {p=0} p' CHANGELOG.md > release_notes.md
if [ ! -s release_notes.md ]; then
echo "CHANGELOG.md has no entry for ${GITHUB_REF_NAME#v}" >&2
exit 1
fi

- run: bundle exec rspec
- run: gem build sp_api_clients.gemspec

# Trades this job's OIDC token for a short-lived rubygems.org key
# that can push only this gem. Needs the trusted publisher set up
# on rubygems.org for repository dropstream/amazon_sp_clients and
# workflow release.yml.
- uses: rubygems/configure-rubygems-credentials@v2.1.0
- name: Push the gem to rubygems.org
run: gem push sp_api_clients-*.gem

- name: Create the GitHub Release
run: gh release create "${GITHUB_REF_NAME}" sp_api_clients-*.gem --title "${GITHUB_REF_NAME}" --notes-file release_notes.md
env:
GH_TOKEN: ${{ github.token }}
76 changes: 76 additions & 0 deletions .github/workflows/update-models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Update models

on:
schedule:
# First day of every month at 2:00 UTC. Run manually via
# workflow_dispatch when needed.
- cron: "0 2 1 * *"
workflow_dispatch:

permissions:
contents: read

jobs:
update-models:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0

- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true

- name: Pull latest Amazon specs and regenerate
run: bundle exec rake generate:update

# Uses a machine-user PAT (not GITHUB_TOKEN) so the PR triggers CI.
- name: Create pull request
uses: actions/github-script@v8
env:
MACHINE_USER_NAME: ${{ secrets.MACHINE_USER_NAME }}
MACHINE_USER_EMAIL: ${{ secrets.MACHINE_USER_EMAIL }}
with:
github-token: ${{ secrets.MACHINE_USER_PAT }}
script: |
const { execSync } = require('child_process');

const status = execSync('git status --porcelain', { encoding: 'utf8' });
if (!status.trim()) {
console.log('No changes');
return;
}

execSync(`git config user.name "${process.env.MACHINE_USER_NAME}"`);
execSync(`git config user.email "${process.env.MACHINE_USER_EMAIL}"`);

// One fixed branch; recreate it on every run.
const branchName = 'update-api-models';
try {
execSync(`git push origin --delete ${branchName}`, { stdio: 'ignore' });
} catch (e) { /* branch did not exist */ }
try {
execSync(`git branch -D ${branchName}`, { stdio: 'ignore' });
} catch (e) { /* branch did not exist */ }

execSync(`git checkout -b ${branchName}`);
execSync('git add -A');
execSync('git commit -m "Update Amazon models"');
execSync(`git push --set-upstream origin ${branchName}`);

const { data: pr } = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Update Amazon models',
body: 'Nightly regeneration against the latest Amazon SP-API specs. ' +
'Review the pin change in selling-partner-api-models.sha and the regenerated files.',
head: branchName,
base: 'master'
});

console.log(`Created PR #${pr.number}: ${pr.html_url}`);
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
.env
# rspec failure tracking
.rspec_status

# Local clone of amzn/selling-partner-api-models (managed by lib/generator)
/amzn-models/
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

32 changes: 32 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
inherit_from: .rubocop_todo.yml

AllCops:
NewCops: enable
TargetRubyVersion: 3.3
SuggestExtensions: false
Exclude:
- vendor/**/*
- amzn-models/**/*
- tmp/**/*
- bin/**/*
# CI matrix gemfiles, not gem code.
- gemfiles/**/*
# Autogenerated require shims; the Rakefile writes them.
- lib/amazon_sp_clients/sp_*.rb
# Generated V2 API classes and their entry file; the generator writes them.
- lib/amazon_sp_clients/v2/apis/**/*
- lib/amazon_sp_clients/v2/apis.rb

# Start permissive on the handwritten code; tighten later.
Metrics:
Enabled: false

Style/Documentation:
Enabled: false

# Grouping accessors would detach them from their doc comments.
Style/AccessorGrouping:
Enabled: false

Layout/LineLength:
Max: 100
120 changes: 120 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2026-08-31 19:00:44 UTC using RuboCop version 1.86.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 6
# Configuration parameters: EnforcedStyle, AllowedGems.
# SupportedStyles: Gemfile, gems.rb, gemspec
Gemspec/DevelopmentDependencies:
Exclude:
- 'sp_api_clients.gemspec'

# Offense count: 10
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Exclude:
- 'Rakefile'
- 'lib/amazon_sp_clients/session.rb'
- 'spec/amazon_sp_clients/uploader_spec.rb'
- 'spec/amazon_sp_clients_spec.rb'

# Offense count: 1
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/amazon_sp_clients_spec.rb'

# Offense count: 3
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
Lint/DuplicateBranch:
Exclude:
- 'lib/amazon_sp_clients/configuration.rb'

# Offense count: 4
Lint/DuplicateMethods:
Exclude:
- 'lib/amazon_sp_clients/configuration.rb'

# Offense count: 1
# Configuration parameters: AllowKeywordBlockArguments.
Lint/UnderscorePrefixedVariableName:
Exclude:
- 'lib/amazon_sp_clients/api_client.rb'

# Offense count: 2
Naming/AccessorMethodName:
Exclude:
- 'lib/amazon_sp_clients/configuration.rb'

# Offense count: 1
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'Rakefile'

# Offense count: 17
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Enabled: false

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
Exclude:
- 'Rakefile'
- 'lib/amazon_sp_clients/configuration.rb'

# Offense count: 6
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: literals, strict
Style/MutableConstant:
Exclude:
- 'Rakefile'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: short, verbose
Style/PreferredHashMethods:
Exclude:
- 'lib/amazon_sp_clients/api_client.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/RedundantInterpolation:
Exclude:
- 'Rakefile'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'lib/amazon_sp_clients/api_error.rb'
- 'lib/amazon_sp_clients/configuration.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/StructInheritance:
Exclude:
- 'lib/amazon_sp_clients/api_error.rb'
- 'lib/amazon_sp_clients/token_exchange_auth.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
# AllowedMethods: define_method
Style/SymbolProc:
Exclude:
- 'spec/amazon_sp_clients/api_client_spec.rb'
1 change: 0 additions & 1 deletion .ruby-gemset

This file was deleted.

9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--no-private
--list-undoc
lib/amazon_sp_clients/v2.rb
lib/amazon_sp_clients/v2/**/*.rb
Loading